Tuesday 15 May 2012

hadoop - ERROR 1200: Unexpected Symbol? -



hadoop - ERROR 1200: Unexpected Symbol? -

i programming in pig, , error occurred, have not been able resolve.

here code i'm trying run:

--load files relations month1 = load 'hdfs:/data/big/data/weather/201201hourly.txt' using pigstorage(','); month2 = load 'hdfs:/data/big/data/weather/201202hourly.txt' using pigstorage(','); month3 = load 'hdfs:/data/big/data/weather/201203hourly.txt' using pigstorage(','); month4 = load 'hdfs:/data/big/data/weather/201204hourly.txt' using pigstorage(','); month5 = load 'hdfs:/data/big/data/weather/201205hourly.txt' using pigstorage(','); month6 = load 'hdfs:/data/big/data/weather/201206hourly.txt' using pigstorage(','); --combine relations months = union month1, month2, month3, month4, month5, month6; /* splitting relations split months splitmonth1 if substring(date, 4, 6) == '01', splitmonth2 if substring(date, 4, 6) == '02', splitmonth3 if substring(date, 4, 6) == '03', splitrest if (substring(date, 4, 6) == '04' or substring(date, 4, 6) == '04'); */ /* joining relations stations = load 'hdfs:/data/big/data/qclcd201211/stations.txt' using pigstorage() (id:int, name:chararray) bring together months wban, stations id; */ --filter out unwanted info clearweather = filter months skycondition == 'clr'; --transform , shape relation shapedweather = foreach clearweather generate date, substring(date, 0, 4) year, substring(date, 4, 6) month, substring(date, 6, 8) day, skycondition, drytemp; --group relation specifying number of reducers groupedmonthday = grouping shapedweather month, day parallel 10; --aggregate relation aggedresults = foreach groupedbymonthday generate grouping monthday, avg(shapedweather.drytemp), min(shapedweather.drytemp), max(shapedweather.drytemp), count(shapedweather.drytemp) parallel 10; --sort relation sortedresults = sort aggedresults $1 desc; --store results in hdfs store sortedresults 'hdfs:/data/big/data/weather/pigresults' using pigstorage(':');

here homecoming when run code:

pig stack trace --------------- error 1200: <file /home/eduardo/documentos/pig/weather.pig, line 35, column 52> syntax error, unexpected symbol @ or near 'parallel' org.apache.pig.impl.logicallayer.frontendexception: error 1000: error during parsing. <file /home/eduardo/documentos/pig/weather.pig, line 35, column 52> syntax error, unexpected symbol @ or near 'parallel' @ org.apache.pig.pigserver$graph.parsequery(pigserver.java:1691) @ org.apache.pig.pigserver$graph.access$000(pigserver.java:1411) @ org.apache.pig.pigserver.parseandbuild(pigserver.java:344) @ org.apache.pig.pigserver.executebatch(pigserver.java:369) @ org.apache.pig.pigserver.executebatch(pigserver.java:355) @ org.apache.pig.tools.grunt.gruntparser.executebatch(gruntparser.java:140) @ org.apache.pig.tools.grunt.gruntparser.parsestoponerror(gruntparser.java:202) @ org.apache.pig.tools.grunt.gruntparser.parsestoponerror(gruntparser.java:173) @ org.apache.pig.tools.grunt.grunt.exec(grunt.java:84) @ org.apache.pig.main.run(main.java:607) @ org.apache.pig.main.main(main.java:156) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:606) @ org.apache.hadoop.util.runjar.main(runjar.java:160) caused by: failed parse: <file /home/eduardo/documentos/pig/weather.pig, line 35, column 52> syntax error, unexpected symbol @ or near 'parallel' @ org.apache.pig.parser.queryparserdriver.parse(queryparserdriver.java:241) @ org.apache.pig.parser.queryparserdriver.parse(queryparserdriver.java:179) @ org.apache.pig.pigserver$graph.parsequery(pigserver.java:1678) ... 15 more ================================================================================

if grouping more 1 column have set within function bracket

groupedmonthday = grouping shapedweather (month, day) parallel 10;

the other point can avoid multiple load , union using below command, load files starting above combination.

allmonths = load 'hdfs:/data/big/data/weather/[0-9]*hourly.txt' using pigstorage(',');

incase want load above 6 files bunch of files, can load this

allmonths = load 'hdfs:/data/big/data/weather/20120[1-6]*hourly.txt' using pigstorage(',');

hadoop apache-pig hadoop-streaming hadoop2

No comments:

Post a Comment