Pig - exception on simple load

2019-08-29 04:08发布

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条回答
戒情不戒烟
2楼-- · 2019-08-29 04:32

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=
查看更多
登录 后发表回答