0
votes

I am trying to run this commang over pig env.

grunt> A =  LOAD inp;

But I am getting this error in the log files: Pig Stack Trace:

ERROR 1200: mismatched input 'inp' expecting QUOTEDSTRING

Failed to parse: mismatched input 'inp' expecting QUOTEDSTRING at org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:226) at org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:168) at org.apache.pig.PigServer$Graph.validateQuery(PigServer.java:1565) at org.apache.pig.PigServer$Graph.registerQuery(PigServer.java:1538) at org.apache.pig.PigServer.registerQuery(PigServer.java:540) at org.apache.pig.tools.grunt.GruntParser.processPig(GruntParser.java:970) at org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:386) at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:189) at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:165) at org.apache.pig.tools.grunt.Grunt.run(Grunt.java:69) at org.apache.pig.Main.run(Main.java:490) at org.apache.pig.Main.main(Main.java:111) 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:601) at org.apache.hadoop.util.RunJar.main(RunJar.java:156)

  • And in console Iam getting like this:

grunt> A = LOAD inp;
2012-10-26 12:18:34,627 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1200: mismatched input 'inp' expecting QUOTEDSTRING Details at logfile: /usr/local/hadoop/pig_1351232517175.log

Can any body provide me appropriate solution for this?

2

2 Answers

2
votes

The syntax for load has been used wrongly. Check out the correct example provided herewith. http://pig.apache.org/docs/r0.7.0/piglatin_ref2.html#LOAD

Suppose we have a data file called myfile.txt. The fields are tab-delimited. The records are newline-separated.

1 2 3
4 2 1
8 3 4

In this example the default load function, PigStorage, loads data from myfile.txt to form relation A. The two LOAD statements are equivalent. Note that, because no schema is specified, the fields are not named and all fields default to type bytearray.

A = LOAD 'myfile.txt';

A = LOAD 'myfile.txt' USING PigStorage('\t');

DUMP A;
(1,2,3)
(4,2,1)
(8,3,4)

Example from http://pig.apache.org/docs

I believe the error log is self explanatory, it says - expecting QUOTEDSTRING

1
votes

Please put the file name in single quotes to solve this issue.