Grokbase Groups Hive user July 2011
FAQ
Hi All,
I can't find any reasonable documentation about being able to use Serde's.
I have a JSONSerde which I use to create an external table

create external table scratch.json_serde_test (user_id bigint, details struct<request_type: int, more_details: struct<id :bigint> > ) row format serde 'org.apache.hadoop.hive.contrib.serde2.JsonSerde' location '/user/ayon/jsonserde_test';

I can't get any select query to work. What is the syntax for select inside a struct?

-Ayon
See My Photos on Flickr
Also check out my Blog for answers to commonly asked questions.

Search Discussions

  • Roberto Congiu at Jul 29, 2011 at 5:22 pm
    I think the struct for a struct is correct (you can see in
    ObjectInspectorUtils.getStandardStructTypeName() how it is built).

    If you're using this serde:
    http://code.google.com/p/hive-json-serde/source/browse/trunk/src/org/apache/hadoop/hive/contrib/serde2/JsonSerde.java,
    it just doesn't support structs.

    Try the one I wrote here (compiled binary under 'downloads'):
    https://github.com/rcongiu/Hive-JSON-Serde

    it does support structs, even nested like yours.
    R.
    On Thu, Jul 28, 2011 at 11:59 PM, Ayon Sinha wrote:

    Hi All,
    I can't find any reasonable documentation about being able to use Serde's.
    I have a JSONSerde which I use to create an external table
    create external table scratch.json_serde_test (user_id bigint, details
    struct<request_type: int, more_details: struct<id :bigint> > ) row format
    serde 'org.apache.hadoop.hive.contrib.serde2.JsonSerde' location
    '/user/ayon/jsonserde_test';

    I can't get any select query to work. What is the syntax for select inside
    a struct?

    -Ayon
    See My Photos on Flickr <http://www.flickr.com/photos/ayonsinha/>
    Also check out my Blog for answers to commonly asked questions.<http://dailyadvisor.blogspot.com>
  • Ayon Sinha at Jul 29, 2011 at 9:32 pm
    Hi Roberto,
    Yes, your JsonSerde was the one I got working last night. My next question is, do you know of any way to have the Hive Table schema statement (e.g. user_id bigint, details struct<request_type: int, more_details: struct<id :bigint>> )  generated or imported if I have the Thrift definitions?

    Since Thrift & Hive are both Facebook originated, I am hoping there would be a import mechanism that I am yet to discover.

    -Ayon
    See My Photos on Flickr
    Also check out my Blog for answers to commonly asked questions.



    ________________________________
    From: Roberto Congiu <roberto.congiu@openx.com>
    To: user@hive.apache.org; Ayon Sinha <ayonsinha@yahoo.com>
    Sent: Friday, July 29, 2011 10:21 AM
    Subject: Re: JsonSerde usage help


    I think the struct for a struct is correct (you can see in ObjectInspectorUtils.getStandardStructTypeName() how it is built).

    If you're using this serde: http://code.google.com/p/hive-json-serde/source/browse/trunk/src/org/apache/hadoop/hive/contrib/serde2/JsonSerde.java, it just doesn't support structs.

    Try the one I wrote here (compiled binary under 'downloads'): https://github.com/rcongiu/Hive-JSON-Serde

    it does support structs, even nested like yours.
    R.

    On Thu, Jul 28, 2011 at 11:59 PM, Ayon Sinha wrote:

    Hi All,
    I can't find any reasonable documentation about being able to use Serde's.
    I have a JSONSerde which I use to create an external table
    create external table scratch.json_serde_test (user_id bigint, details struct<request_type: int, more_details: struct<id :bigint> > ) row format serde 'org.apache.hadoop.hive.contrib.serde2.JsonSerde' location '/user/ayon/jsonserde_test';


    I can't get any select query to work. What is the syntax for select inside a struct?

    -Ayon
    See My Photos on Flickr
    Also check out my Blog for answers to commonly asked questions.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categorieshive, hadoop
postedJul 29, '11 at 7:00a
activeJul 29, '11 at 9:32p
posts3
users2
websitehive.apache.org

2 users in discussion

Ayon Sinha: 2 posts Roberto Congiu: 1 post

People

Translate

site design / logo © 2022 Grokbase