如何重命名包中的字段。我已经找到了投射字段的方法,但是我不能重命名它们。
例如:
renamed = FOREACH named GENERATE
field0,
elements.(
field1,
field2
);
如果我尝试以下操作,则会出现错误:
renamed = FOREACH named GENERATE
field0,
elements.(
field1 AS renamed1,
field2
);
错误消息如下
2014-06-10 08:34:14,701 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1200: <line 233, column 16> mismatched input 'AS' expecting RIGHT_PAREN
2014-06-10 08:34:14,702 [main] WARN org.apache.pig.tools.grunt.Grunt - There is no log file to write to.
2014-06-10 08:34:14,702 [main] ERROR org.apache.pig.tools.grunt.Grunt - Failed to parse: <line 233, column 16> mismatched input 'AS' expecting RIGHT_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.validateQuery(PigServer.java:1648)
at org.apache.pig.PigServer$Graph.registerQuery(PigServer.java:1621)
at org.apache.pig.PigServer.registerQuery(PigServer.java:575)
at org.apache.pig.tools.grunt.GruntParser.processPig(GruntParser.java:1093)
at org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:501)
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.run(Grunt.java:69)
at org.apache.pig.Main.run(Main.java:541)
at org.apache.pig.Main.main(Main.java:156)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.hadoop.util.RunJar.main(RunJar.java:212)
1条答案
按热度按时间ddrv8njm1#
你需要把
AS
在你对袋子的定义之后。请尝试以下操作: