The Vertica Forum recently got a makeover! Let us know what you think by filling out this short, anonymous survey.
Please take this survey to help us learn more about how you use third party tools. Your input is greatly appreciated!

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(
    at org.apache.pig.PigServer.registerQuery(
    at org.apache.pig.Main.main(
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(
    at java.lang.reflect.Method.invoke(
    at org.apache.hadoop.util.RunJar.main(
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(
    at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.JobControlCompiler.compile(
    at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher.launchPig(
    at org.apache.pig.PigServer.launchPlan(
    at org.apache.pig.PigServer.executeCompiledLogicalPlan(
    at org.apache.pig.PigServer.execute(
    at org.apache.pig.PigServer.access$400(
    at org.apache.pig.PigServer$Graph.registerQuery(
    ... 13 more
So could you please help in identifying what has gone wrong in this case?


Leave a Comment

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