查看更多Apache Pig的教程请点击这里。
运行Pig脚本时报错:
Error before Pig is launched
----------------------------
ERROR 2997: Encountered IOException. org.apache.pig.tools.parameters.ParseException: Encountered "<EOF>" at line 1, column 8.
Was expecting one of:
<IDENTIFIER> ...
<OTHER> ...
<LITERAL> ...
<SHELLCMD> ...
java.io.IOException: org.apache.pig.tools.parameters.ParseException: Encountered "<EOF>" at line 1, column 8.
Was expecting one of:
<IDENTIFIER> ...
<OTHER> ...
<LITERAL> ...
<SHELLCMD> ...
at org.apache.pig.impl.PigContext.doParamSubstitution(PigContext.java:408)
at org.apache.pig.Main.runParamPreprocessor(Main.java:783)
at org.apache.pig.Main.run(Main.java:446)
at org.apache.pig.Main.main(Main.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
Caused by: org.apache.pig.tools.parameters.ParseException: Encountered "<EOF>" at line 1, column 8.
这个问题有可能有多种原因,比如某行漏写了语句结尾的分号。这里我遇到的是另一个原因:调用该Pig脚本的shell脚本,用 -p "xxx=$X" 这种形式传参时,参数为空,修正参数为空的问题即可解决。