<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Creating a HIVE table with org.apache.hcatalog.data.JsonSerDe in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Creating-a-HIVE-table-with-org-apache-hcatalog-data/m-p/109716#M25754</link>
    <description>&lt;P&gt;You can use lateral view &amp;amp; explode or inline keyword to get at the data in the struct column.&lt;/P&gt;&lt;P&gt;&lt;A href="http://Hive Wiki"&gt;https://cwiki.apache.org/confluence/display/Hive/LanguageManual+LateralView&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://cheat sheet"&gt;https://www.qubole.com/resources/cheatsheet/hive-function-cheat-sheet/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;P&gt;Andrew&lt;/P&gt;</description>
    <pubDate>Fri, 22 Apr 2016 09:05:24 GMT</pubDate>
    <dc:creator>andrew_sears</dc:creator>
    <dc:date>2016-04-22T09:05:24Z</dc:date>
    <item>
      <title>Creating a HIVE table with org.apache.hcatalog.data.JsonSerDe</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Creating-a-HIVE-table-with-org-apache-hcatalog-data/m-p/109712#M25750</link>
      <description>&lt;P&gt;Hello there,&lt;/P&gt;&lt;P&gt;I am creating a table for storing json twitter data. I see different ways of using &lt;EM&gt;org.apache.hcatalog.data.JsonSerDe for it, but what would be the simpler process to use &lt;/EM&gt;&lt;EM&gt;org.apache.hcatalog.data.JsonSerDe for this purpose. &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Where should I get &lt;/EM&gt;&lt;EM&gt;org.apache.hcatalog.data.JsonSerDe, and how to integrate it into my HIVE instance?&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;
&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Thanks!&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2016 18:16:43 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Creating-a-HIVE-table-with-org-apache-hcatalog-data/m-p/109712#M25750</guid>
      <dc:creator>junnnninho</dc:creator>
      <dc:date>2016-04-21T18:16:43Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a HIVE table with org.apache.hcatalog.data.JsonSerDe</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Creating-a-HIVE-table-with-org-apache-hcatalog-data/m-p/109713#M25751</link>
      <description>&lt;P&gt;considering you have the following data&lt;/P&gt;&lt;PRE&gt;{  "user": {    "userlocation": "California, Santa Clara",    "id": 222222,    "name": "Hortonworks",    "screenname": "hortonworks",    "geoenabled": true  },  "tweetmessage": "Learn more about #Spark in #HDP 2.3 with @Hortonworks founder @acmurthy in this video overview &lt;A href="http://bit.ly/1gOyr9w" target="_blank"&gt;http://bit.ly/1gOyr9w&lt;/A&gt;  #hadoop",  "createddate": "2015-07-24T16:30:33",  "geolocation": null}&lt;/PRE&gt;&lt;P&gt;your schema would look like so with JsonSerDe&lt;/P&gt;&lt;PRE&gt;CREATE EXTERNAL TABLE tweets (  createddate string,  geolocation string,  tweetmessage string,  `user` struct&amp;lt;geoenabled:boolean, id:int, name:string, screenname:string, userlocation:string&amp;gt;)
	ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe' LOCATION '/user/root/';

SELECT DISTINCT tweetmessage, user.name, createddate 
	FROM tweets WHERE user.name = 'Hortonworks'
		ORDER BY createddate;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Apr 2016 22:42:47 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Creating-a-HIVE-table-with-org-apache-hcatalog-data/m-p/109713#M25751</guid>
      <dc:creator>aervits</dc:creator>
      <dc:date>2016-04-21T22:42:47Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a HIVE table with org.apache.hcatalog.data.JsonSerDe</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Creating-a-HIVE-table-with-org-apache-hcatalog-data/m-p/109714#M25752</link>
      <description>&lt;P&gt;Thanks Arten!  quick question what does the folder '/user/root/' refers to? In my example I am specifying the /tmp/ folder where I store my twitter sample file. &lt;/P&gt;&lt;P&gt;CREATE TABLE TwitterExample_0(  createddate string,  geolocation string,  tweetmessage string,  `user` struct&amp;lt;geoenabled:boolean, id:int, name:string, screenname:string, userlocation:string&amp;gt;)
ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe' LOCATION '/tmp/';&lt;/P&gt;&lt;P&gt;I am getting this error when I try a simple SELECT * FROM TwitterExample_0 LIMIT 10;&lt;/P&gt;&lt;P&gt;trace":"org.apache.ambari.view.hive.client.HiveErrorStatusException: H170 Unable to fetch results. java.io.IOException: org.apache.hadoop.security.AccessControlException: Permission denied: user=admin, access=READ_EXECUTE, inode=\"/tmp/ambari-qa\":ambari-qa:hdfs:drwx------\n\tat....&lt;/P&gt;&lt;P&gt;----------------------------------------------------&lt;/P&gt;&lt;P&gt;[hdfs@ip-172-31-34-25 ~]$ hadoop fs -chmod 777 /tmp/&lt;/P&gt;&lt;P&gt;[hdfs@ip-172-31-34-25 ~]$ hadoop fs -ls /tmp/&lt;/P&gt;&lt;P&gt;drwx------   - ambari-qa hdfs          0 2016-04-16 17:47 /tmp/ambari-qa&lt;/P&gt;&lt;P&gt;drwxr-xr-x   - hdfs      hdfs          0 2016-04-16 17:43 /tmp/entity-file-history&lt;/P&gt;&lt;P&gt;drwx-wx-wx   - hive      hdfs          0 2016-04-16 20:10 /tmp/hive&lt;/P&gt;&lt;P&gt;-rwxr-xr-x   3 hdfs      hdfs       1902 2016-04-16 17:45 /tmp/id1fac3f21_date451616&lt;/P&gt;&lt;P&gt;-rwxr-xr-x   3 ambari-qa hdfs       1902 2016-04-16 17:50 /tmp/idtest.ambari-qa.1460843437.95.in&lt;/P&gt;&lt;P&gt;-rwxr-xr-x   3 ambari-qa hdfs        957 2016-04-16 17:50 /tmp/idtest.ambari-qa.1460843437.95.pig&lt;/P&gt;&lt;P&gt;-rwxrwxrwx   3 hdfs      hdfs       2755 2016-04-21 20:35 /tmp/sample_twitter_data.txt&lt;/P&gt;&lt;P&gt;drwxr-xr-x   - ambari-qa hdfs          0 2016-04-16 17:48 /tmp/tezsmokeinput&lt;/P&gt;&lt;P&gt;drwxr-xr-x   - ambari-qa hdfs          0 2016-04-16 17:48 /tmp/tezsmokeoutput&lt;/P&gt;&lt;P&gt;Any help appreciated.&lt;/P&gt;&lt;P&gt;Thanks- &lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2016 07:49:34 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Creating-a-HIVE-table-with-org-apache-hcatalog-data/m-p/109714#M25752</guid>
      <dc:creator>junnnninho</dc:creator>
      <dc:date>2016-04-22T07:49:34Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a HIVE table with org.apache.hcatalog.data.JsonSerDe</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Creating-a-HIVE-table-with-org-apache-hcatalog-data/m-p/109715#M25753</link>
      <description>&lt;P&gt;Hey Artem. I was able to get it working by doing: &lt;/P&gt;&lt;P&gt;CREATE TABLE TwitterTest(  createddate string,  geolocation string,  tweetmessage string,  `user` struct&amp;lt;geoenabled:boolean, id:int, name:string, screenname:string, userlocation:string&amp;gt;) &lt;/P&gt;&lt;P&gt;ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe'
STORED AS TEXTFILE; &lt;/P&gt;&lt;P&gt;LOAD DATA LOCAL INPATH '/tmp/sample_twitter_data.txt' OVERWRITE INTO TABLE TwitterTest;&lt;/P&gt;&lt;P&gt;However, when I try to do the query you did I get the following error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Error while compiling statement: FAILED: ParseException line 1:39 cannot recognize input near 'user' '.' 'name' in selection target [ERROR_STATUS]&lt;/P&gt;&lt;P&gt;When I look at the table structure by doing a simple SELECT * FROM TwitterTest LIMIT 10; I see that all the fields inside the user struct are inside the same column (twittertest.user) ... As for the other fields (createddate, geolocation, twittermessage) they have their own columns....  Is that normal? &lt;/P&gt;&lt;P&gt;Thanks-&lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2016 08:15:27 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Creating-a-HIVE-table-with-org-apache-hcatalog-data/m-p/109715#M25753</guid>
      <dc:creator>junnnninho</dc:creator>
      <dc:date>2016-04-22T08:15:27Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a HIVE table with org.apache.hcatalog.data.JsonSerDe</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Creating-a-HIVE-table-with-org-apache-hcatalog-data/m-p/109716#M25754</link>
      <description>&lt;P&gt;You can use lateral view &amp;amp; explode or inline keyword to get at the data in the struct column.&lt;/P&gt;&lt;P&gt;&lt;A href="http://Hive Wiki"&gt;https://cwiki.apache.org/confluence/display/Hive/LanguageManual+LateralView&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://cheat sheet"&gt;https://www.qubole.com/resources/cheatsheet/hive-function-cheat-sheet/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;P&gt;Andrew&lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2016 09:05:24 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Creating-a-HIVE-table-with-org-apache-hcatalog-data/m-p/109716#M25754</guid>
      <dc:creator>andrew_sears</dc:creator>
      <dc:date>2016-04-22T09:05:24Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a HIVE table with org.apache.hcatalog.data.JsonSerDe</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Creating-a-HIVE-table-with-org-apache-hcatalog-data/m-p/109717#M25755</link>
      <description>&lt;P&gt;1. /user/root is my own user directory, you're doing it in /tmp and most likely you will have permissions issues, which you are. Make sure user running query has rwx on directory in schema&lt;/P&gt;&lt;P&gt;2. if you're copying my schema one to one, then you need one more thing as "user" is a keyword in Hive 1.2. My full examples are here &lt;A href="https://github.com/dbist/workshops/tree/master/hive/JSON"&gt;https://github.com/dbist/workshops/tree/master/hive/JSON&lt;/A&gt;&lt;/P&gt;&lt;P&gt;run this before create schema and again before select on the table&lt;/P&gt;&lt;P&gt;SET hive.support.sql11.reserved.keywords=false;&lt;/P&gt;&lt;P&gt;3. That depends on your JSON, some columns are part of inner structures and some are on their own. It is normal. &lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2016 09:06:59 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Creating-a-HIVE-table-with-org-apache-hcatalog-data/m-p/109717#M25755</guid>
      <dc:creator>aervits</dc:creator>
      <dc:date>2016-04-22T09:06:59Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a HIVE table with org.apache.hcatalog.data.JsonSerDe</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Creating-a-HIVE-table-with-org-apache-hcatalog-data/m-p/109718#M25756</link>
      <description>&lt;P&gt;Thanks Artem. Point 2 solved it! My JSON is identical to yours. &lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2016 09:41:57 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Creating-a-HIVE-table-with-org-apache-hcatalog-data/m-p/109718#M25756</guid>
      <dc:creator>junnnninho</dc:creator>
      <dc:date>2016-04-22T09:41:57Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a HIVE table with org.apache.hcatalog.data.JsonSerDe</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Creating-a-HIVE-table-with-org-apache-hcatalog-data/m-p/109719#M25757</link>
      <description>&lt;P&gt;Thanks for the info, Andrew!&lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2016 09:42:47 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Creating-a-HIVE-table-with-org-apache-hcatalog-data/m-p/109719#M25757</guid>
      <dc:creator>junnnninho</dc:creator>
      <dc:date>2016-04-22T09:42:47Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a HIVE table with org.apache.hcatalog.data.JsonSerDe</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Creating-a-HIVE-table-with-org-apache-hcatalog-data/m-p/109720#M25758</link>
      <description>&lt;P&gt;It's a workaround but in general I would avoid reserved words like 'user' in schema because you always have to set that property otherwise. Rename your data to 'usr'. If this solves your question, please accept the best answer to close this thread. &lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2016 14:46:50 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Creating-a-HIVE-table-with-org-apache-hcatalog-data/m-p/109720#M25758</guid>
      <dc:creator>aervits</dc:creator>
      <dc:date>2016-04-22T14:46:50Z</dc:date>
    </item>
  </channel>
</rss>

