Pig - exception on simple load

筅森魡賤 提交于 2019-12-12 00:22:56

问题


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)
================================================================================

The content of sample_data.csv is:

1, John, Smith
2, Jane, Doe
3, George, Washington
4, Ben, Franklin

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

However, even if I set my $PIG_CLASSPATH variable as instructed, and echoed the $PIG_CLASSPATH to make sure that it is set correctly, I still get the same error.


回答1:


After scratching my head for 24 hours. I finally figured it out with the help of my colleage.

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=


来源:https://stackoverflow.com/questions/17179200/pig-exception-on-simple-load

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!