问题描述
我刚刚开始学习 pig 并尝试用它做一些事情,所以我进入 pig 控制台并简单地输入 a = load 'sample_data.csv';
(我有一个名为 sample_data.csv
).我收到以下异常:
I just started learning pig and trying to do something with it, so I enter the pig console and simply type a = load 'sample_data.csv';
( I have a file named sample_data.csv
). I received the following exception:
Pig Stack Trace
---------------
ERROR 2998: Unhandled internal error. name
java.lang.NoSuchFieldError: name
at org.apache.pig.parser.QueryParserStringStream.<init>(QueryParserStringStream.java:32)
at org.apache.pig.parser.QueryParserDriver.tokenize(QueryParserDriver.java:207)
at org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:175)
at org.apache.pig.PigServer$Graph.validateQuery(PigServer.java:1571)
at org.apache.pig.PigServer$Graph.registerQuery(PigServer.java:1544)
at org.apache.pig.PigServer.registerQuery(PigServer.java:516)
at org.apache.pig.tools.grunt.GruntParser.processPig(GruntParser.java:991)
at org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:412)
at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:194)
at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:170)
at org.apache.pig.tools.grunt.Grunt.run(Grunt.java:69)
at org.apache.pig.Main.run(Main.java:538)
at org.apache.pig.Main.main(Main.java:157)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.hadoop.util.RunJar.main(RunJar.java:156)
================================================================================
sample_data.csv
的内容是:
1, John, Smith
2, Jane, Doe
3, George, Washington
4, Ben, Franklin
我还将 $PIG_HOME
变量设置为 pig 目录的主文件夹.
I have also set the $PIG_HOME
variable to the home folder of the pig directory.
我也知道之前有人提出过类似的问题.这里
I am also aware of the similar question that's been raised before. here
但是,即使我按照指示设置了我的 $PIG_CLASSPATH
变量,并且 echo
编辑了 $PIG_CLASSPATH
以确保它已设置正确,我仍然遇到同样的错误.
However, even if I set my $PIG_CLASSPATH
variable as instructed, and echo
ed the $PIG_CLASSPATH
to make sure that it is set correctly, I still get the same error.
推荐答案
在我挠头 24 小时之后.在我的同事的帮助下,我终于弄明白了.
After scratching my head for 24 hours. I finally figured it out with the help of my colleage.
这是因为Hive
.出于某种原因,当 Pig
和 Hive
都设置在同一台机器上时,这种情况往往会发生.所以我需要做的就是
It was becuase of Hive
. For some reason when both Pig
and Hive
are set on the same machine, this tends to happen. So all I needed to do is
export HIVE_HOME=
这篇关于Pig - 简单加载异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!