0

I have a table created with Hive. It takes a JSON format data (I have used SERDE to create it).

I would like to know if it is possible to load data from this table to Pig and then make some transformations.

This is my JSON data:

{"id":"1", "word":"2" ,"flag":1}.

Do you have any clue?


I have tried

A = LOAD ‘data.json’
USING PigJsonLoader();

but with no success. This is the error I get:

[main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1200: Unexpected character ''

I turned to

json_objects = LOAD 'hdfs://user/cloudera/test.json' 
               USING org.apache.pig.piggybank.storage.JsonLoader();

but it says:

Could not resolve org.apache.pig.piggybank.storage.JsonLoader using imports: [, org.apache.pig.builtin., org.apache.pig.impl.builtin.].

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Xorsist
  • 207
  • 2
  • 4
  • 11
  • 1
    possible duplicate of [How do I parse JSON in Pig?](http://stackoverflow.com/questions/5013003/how-do-i-parse-json-in-pig) – Jakub Kotowski Mar 04 '14 at 13:47

1 Answers1

0

Reason for your error is that class does not exist. If you are running pig in version 0.12.1 you'll find documentation about contributed piggybank at http://pig.apache.org/docs/r0.12.1/api/org/apache/pig/piggybank/storage/package-summary.html