Reputation: 37
I can't seem to figure out where I'm going wrong with this. The script works perfectly well for PigStorage but gives me this ClassCastException for CSVLoader.
I checked the documentation and it didn't help.
Here is the Stack Trace:
Pig Stack Trace
---------------
ERROR 1200: Pig script failed to parse:
<file pig_script.pig, line 15, column 0> pig script failed to validate: java.lang.ClassCastException: org.apache.pig.piggybank.storage.CSVLoader cannot be cast to org.apache.pig.StoreFuncInterface
org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1000: Error during parsing. Pig script failed to parse:
<file pig_script.pig, line 15, column 0> pig script failed to validate: java.lang.ClassCastException: org.apache.pig.piggybank.storage.CSVLoader cannot be cast to org.apache.pig.StoreFuncInterface
at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1597)
at org.apache.pig.PigServer$Graph.registerQuery(PigServer.java:1540)
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.exec(Grunt.java:84)
at org.apache.pig.Main.run(Main.java:555)
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)
Upvotes: 0
Views: 597
Reputation: 30089
Without your pig script, this is a guess, but are you trying to use CSVLoader in a STORE statement?
CSVLoader doesn't implement the StoreFuncInterface, which is required for anything you want to use to store your results to. CSVLoader is used in LOAD statements.
You probably want CSVExcelStorage instead as this does implement the interface. The previous link details usage too:
STORE x INTO '<destFileName>'
USING CSVExcelStorage(['<delimiter>' [,{'YES_MULTILINE' | 'NO_MULTILINE'} [,{'UNIX' | 'WINDOWS' | 'UNCHANGED'}]]]);
Upvotes: 2