1

对不起一个天真的问题。我是新手。我有一个 Pig 脚本并出现以下错误:

ERROR [main]      org.apache.pig.tools.grunt.Grunt     - ERROR 1200: <file xxx.script, line 2, column 20>  mismatched input ';' expecting LEFT_PAREN

这就是我的 scipt 的样子:

a = load 'xxx.csv' using PigStorage(',') as (person:chararray,store:chararray,spent:float);
b = group a by store;
dump b;

这是堆栈跟踪:

ERROR 1200: <file xxx.script, line 2, column 20>  mismatched input ';' expecting LEFT_PAREN

org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1000: Error during parsing. <file xxx.script, line 2, column 20>  mismatched input ';' expecting LEFT_PAREN
at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1689)
at org.apache.pig.PigServer$Graph.access$000(PigServer.java:1409)
at org.apache.pig.PigServer.parseAndBuild(PigServer.java:342)
at org.apache.pig.PigServer.executeBatch(PigServer.java:367)
at org.apache.pig.PigServer.executeBatch(PigServer.java:353)
at org.apache.pig.tools.grunt.GruntParser.executeBatch(GruntParser.java:140)
at org.apache.pig.tools.grunt.GruntParser.processDump(GruntParser.java:769)
at org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:372)
at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:198)
at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:173)
at org.apache.pig.tools.grunt.Grunt.exec(Grunt.java:84)
at org.apache.pig.Main.run(Main.java:607)
at org.apache.pig.Main.main(Main.java:156)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:94)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:619)
at org.apache.hadoop.util.RunJar.main(RunJar.java:212)
Caused by: Failed to parse: <file /home/biadmin/xxx.script, line 2, column 20>  mismatched input ';' expecting LEFT_PAREN
at org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:241)
at org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:179)
at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1676)
... 17 more
4

1 回答 1

1

正如@Surender Raja 所指出的,store 是一个关键字,在将其更改为 deptStore 后,我可以使用名称而不是 $1 来引用它

于 2015-09-28T19:45:39.563 回答