{"id":6662,"date":"2014-04-20T21:49:12","date_gmt":"2014-04-20T21:49:12","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/04\/20\/load-json-format-table-into-pig-collection-of-common-programming-errors\/"},"modified":"2014-04-20T21:49:12","modified_gmt":"2014-04-20T21:49:12","slug":"load-json-format-table-into-pig-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/04\/20\/load-json-format-table-into-pig-collection-of-common-programming-errors\/","title":{"rendered":"Load json format table into Pig-Collection of common programming errors"},"content":{"rendered":"<p>I have a table created with Hive. It takes a <code>JSON<\/code> format data (I have used <code>SERDE<\/code> to create it).<\/p>\n<p>I would like to know if it is possible to load data from this table to <code>Pig<\/code> and then make some transformations.<\/p>\n<p>This is my JSON data:<\/p>\n<pre><code>{\"id\":\"1\", \"word\":\"2\" ,\"flag\":1}.\n<\/code><\/pre>\n<p>Do you have any clue?<\/p>\n<p>I have tried<\/p>\n<pre><code>A = LOAD 'data.json'\nUSING PigJsonLoader();\n<\/code><\/pre>\n<p>but with no success. This is the error I get:<\/p>\n<blockquote>\n<p>[main] ERROR org.apache.pig.tools.grunt.Grunt &#8211; ERROR 1200: Unexpected character &#8221;<\/p>\n<\/blockquote>\n<p>I turned to<\/p>\n<pre><code>json_objects = LOAD 'hdfs:\/\/user\/cloudera\/test.json' \n               USING org.apache.pig.piggybank.storage.JsonLoader();\n<\/code><\/pre>\n<p>but it says:<\/p>\n<blockquote>\n<p>Could not resolve org.apache.pig.piggybank.storage.JsonLoader using imports: [, org.apache.pig.builtin., org.apache.pig.impl.builtin.].<\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>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: {&#8220;id&#8221;:&#8221;1&#8243;, &#8220;word&#8221;:&#8221;2&#8243; ,&#8221;flag&#8221;:1}. Do you have any clue? [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6662","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6662","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=6662"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6662\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=6662"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=6662"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=6662"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}