我正在尝试根据某些条件过滤表格, 我想做以下事情: 如果wire_on ='true'我想过滤CUSTOMER_PARTITION_DT和国家条件,否则只是CUSTOMER_PARTITION_DT。 以下是我在猪脚本中使用的声明:
B = FILTER A by ((wire_on=='true')?(dt=='$CUSTOMER_PARTITION_DT' AND NOT( country == 'RU' OR country == 'BG' OR country == 'LV' OR country == 'LT' OR country== 'EE' OR country=='KG' OR country=='KZ' OR country == 'MD' OR country == 'TJ' OR country =='TM' OR country == 'UA' OR country == 'GE' OR country == 'BY' OR country == 'UZ' OR country =='AM' OR country == 'AZ')):(dt=='$CUSTOMER_PARTITION_DT'));
我收到NoViableAltException
有人可以帮助我吗
EDIT :
Failed to parse: Pig script failed to parse: NoViableAltException(6@[])
at org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:199)
at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1735)
at org.apache.pig.PigServer$Graph.access$000(PigServer.java:1443)
at org.apache.pig.PigServer.parseAndBuild(PigServer.java:387)
at org.apache.pig.PigServer.executeBatch(PigServer.java:412)
at org.apache.pig.PigServer.executeBatch(PigServer.java:398)
at org.apache.pig.tools.grunt.GruntParser.executeBatch(GruntParser.java:171)
at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:234)
at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:205)
at org.apache.pig.tools.grunt.Grunt.exec(Grunt.java:81)
at org.apache.pig.Main.run(Main.java:624)
at org.apache.pig.Main.main(Main.java:170)
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.run(RunJar.java:221)
at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
Caused by: NoViableAltException(6@[])
at org.apache.pig.parser.AstValidator.expr(AstValidator.java:8637)
at org.apache.pig.parser.AstValidator.expr(AstValidator.java:9115)
at org.apache.pig.parser.AstValidator.bin_expr(AstValidator.java:10531)
at org.apache.pig.parser.AstValidator.projectable_expr(AstValidator.java:9790)
at org.apache.pig.parser.AstValidator.var_expr(AstValidator.java:9582)
at org.apache.pig.parser.AstValidator.expr(AstValidator.java:8985)
at org.apache.pig.parser.AstValidator.cond(AstValidator.java:7820)
at org.apache.pig.parser.AstValidator.filter_clause(AstValidator.java:7328)
at org.apache.pig.parser.AstValidator.op_clause(AstValidator.java:1683)
at org.apache.pig.parser.AstValidator.general_statement(AstValidator.java:1035)
at org.apache.pig.parser.AstValidator.statement(AstValidator.java:499)
at org.apache.pig.parser.AstValidator.query(AstValidator.java:373)
at org.apache.pig.parser.QueryParserDriver.validateAst(QueryParserDriver.java:258)
at org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:186)
... 17 more
答案 0 :(得分:0)
以下是调试情况的方法,我希望通过让您自己找到问题来解答您的问题,否则我可以根据您的其他输入进行更新:
如果你找到添加并发症使其失败的确切位置(可能在这个问题中),逐渐使它变得更复杂
如果即使是最微不足道的案例都失败了,请务必创建一个可重现的示例并检查它(可能在此问题中)