such
such

Reputation: 1

Getting error message Unexpected character ' ' when running LOAD command in PIG

I have a file stored in HDFS at this path: /user/hdfs/countries (the file is in comma separated format).

To import this HDFS data into PIG I ran the below command in PIG:

test = load ‘/ user/hdfs/countries’ using PigStorage(',') as (id:int, Name:chararray, Language:chararray);

where, ID: is the primary key column in HDFS file

Name and Language are the column names in HDFS file

I am getting below error when I run the above mentioned pig command:

Pig Stack Trace

ERROR 1200: <line 1, column 12>  Unexpected character ''

Failed to parse: <line 1, column 12>  Unexpected character ''
at    org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:243)
at     org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:179)
    at org.apache.pig.PigServer$Graph.validateQuery(PigServer.java:1648)
    at org.apache.pig.PigServer$Graph.registerQuery(PigServer.java:1621)
    at org.apache.pig.PigServer.registerQuery(PigServer.java:575)
    at org.apache.pig.tools.grunt.GruntParser.processPig(GruntParser.java:1093)
    at  org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:501)
    at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:198)
    at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:173)
    at org.apache.pig.tools.grunt.Grunt.run(Grunt.java:69)
    at org.apache.pig.Main.run(Main.java:541)
    at org.apache.pig.Main.main(Main.java:156)
    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.main(RunJar.java:212)

Can someone please help me with this? Is my command incorrect or any jar file is missing? Thank you in advance!

Upvotes: 0

Views: 3787

Answers (1)

Frederic
Frederic

Reputation: 3284

It tells you exactly where the problem is: the should be replaced by ' which is not the same character.

Also, the space after the / seems fishy.

Upvotes: 1

Related Questions