Options

Loading JSON data from PIG to Vertica

I have a JSON which I could parse using PIG. As the next step I wanted to load this into Vertica. I used the following lines of code in PIG to do that. The Vertica table is already created before running the code.
register /home/user/pig_libs/elephant-bird-pig-4.0.jar;
register /home/user/pig_libs/elephant-bird-hadoop-compat-4.4.jar;
register /home/user/pig_libs/elephant-bird-core-4.3.jar;
register /home/user/pig_libs/json-simple-1.1.jar;
register /home/user/pig_libs/pig-vertica.jar;
register /home/user/pig_libs/hadoop-vertica.jar;
register /home/user/pig_libs/vertica-jdbc-7.1.1-0.jar;
raw = LOAD '/user/1.json' using com.twitter.elephantbird.pig.load.JsonLoader();
cc = foreach raw generate (chararray)$0#'colA' as colA,
(chararray)$0#'colB' as colB,
(chararray)$0#'colC' as colC,
(chararray)$0#'colD' as colD;

STORE cc INTO '{myschema.test_table}' USING com.vertica.pig.VerticaStorer('verticaserver','databasename','5433','userid','password');
The last line throws an error. Following is the PIG stack trace
Pig Stack Trace
---------------
ERROR 1002: Unable to store alias cc
org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1002: Unable to store alias cc
    at org.apache.pig.PigServer$Graph.registerQuery(PigServer.java:1635)
    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:197)
Caused by: org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.JobCreationException: ERROR 0: URISyntaxException:Output Path URI is malformed:null
    at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.JobControlCompiler.getJob(JobControlCompiler.java:608)
    at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.JobControlCompiler.compile(JobControlCompiler.java:296)
    at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher.launchPig(MapReduceLauncher.java:192)
    at org.apache.pig.PigServer.launchPlan(PigServer.java:1322)
    at org.apache.pig.PigServer.executeCompiledLogicalPlan(PigServer.java:1307)
    at org.apache.pig.PigServer.execute(PigServer.java:1297)
    at org.apache.pig.PigServer.access$400(PigServer.java:122)
    at org.apache.pig.PigServer$Graph.registerQuery(PigServer.java:1630)
    ... 13 more
So could you please help in identifying what has gone wrong in this case?

Thanks




Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file