hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Edward Capriolo <edlinuxg...@gmail.com>
Subject Re: nested JSON structures
Date Fri, 09 Dec 2011 15:22:20 GMT
Hive does have some JSON capabilities. To handle nested structures like
this I have wrtten custom UDFs that return structs and then use LATERAL
VIEW and explode on them.

http://www.slideshare.net/edwardcapriolo/breaking-firstnormal-form-with-hive

On Fri, Dec 9, 2011 at 10:06 AM, Ibrahim Acet <ibrahim.acet@widas.de> wrote:

> Hi,
>
> with nested json I mean something like this:
>
>
>
> {"success": "true", "message": "", "total": "1", "data":
>
> {
>
>         "id": "0001",
>
>         "type": "donut",
>
>         "name": "Cake",
>
>         "ppu": 0.55,
>
>         "batters":
>
>                {
>
>                        "batter":
>
>                                [
>
>                                       { "id": "1001", "type": "Regular" },
>
>                                       { "id": "1002", "type": "Chocolate"
> },
>
>                                       { "id": "1003", "type": "Blueberry"
> },
>
>                                       { "id": "1004", "type": "Devil's
> Food" }
>
>                                ]
>
>                },
>
>         "topping":
>
>                [
>
>                        { "id": "5001", "type": "None" },
>
>                        { "id": "5002", "type": "Glazed" },
>
>                        { "id": "5005", "type": "Sugar" },
>
>                        { "id": "5007", "type": "Powdered Sugar" },
>
>                        { "id": "5006", "type": "Chocolate with Sprinkles"
> },
>
>                        { "id": "5003", "type": "Chocolate" },
>
>                        { "id": "5004", "type": "Maple" }
>
>                ]
>
> }
>
> }
>
> I need to extract all the information.
>
>
>
> Thx
>
>
>
> *Von:* Paul Mackles [mailto:pmackles@adobe.com]
> *Gesendet:* Freitag, 9. Dezember 2011 15:43
> *An:* user@hive.apache.org
> *Betreff:* RE: nested JSON structures
>
>
>
> What exactly do you mean by “nested json structures”? If the built-ins
> don’t work you can always write a UDF.
>
>
>
> *From:* Ibrahim Acet [mailto:ibrahim.acet@widas.de]
> *Sent:* Friday, December 09, 2011 4:05 AM
> *To:* user@hive.apache.org
> *Subject:* nested JSON structures
>
>
>
> Hi,
>
> I was wondering if there is a possibility in HIVE to handle nested JSON
> structures.
>
> I tried get_json_object and json_tuple but could not achieve any results.
>
>
>
> Thanks
>
>
>
>
>
>
>
>
>
> Regelung gemäß § 37a Absatz 4 HGB: WidasConcepts GmbH, Geschäftsführer:
> Thomas Widmann und Christian Kappert, Gerichtsstand Pforzheim,
> Registernummer: HRB 511442, Umsatzsteueridentifikationsnummer: DE205851091
>
>
>
> Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte
> Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail
> irrtuemlich erhalten haben, informieren Sie bitte sofort den Absender und
> vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte
> Weitergabe dieser Mail sind nicht gestattet.
>
>
>
> This e- mail may contain confidential and/or privileged information. If
> you are not the intended recipient (or have received this e-mail in error)
> please notify the sender immediately and destroy this e-mail. Any
> unauthorized copying, disclosure or distribution of the material in this
> e-mail is strictly forbidden.
>
>
>
>
>
> Regelung gemäß § 37a Absatz 4 HGB: WidasConcepts GmbH, Geschäftsführer:
> Thomas Widmann und Christian Kappert, Gerichtsstand Pforzheim,
> Registernummer: HRB 511442, Umsatzsteueridentifikationsnummer: DE205851091
>
>
>
> Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte
> Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail
> irrtuemlich erhalten haben, informieren Sie bitte sofort den Absender und
> vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte
> Weitergabe dieser Mail sind nicht gestattet.
>
>
>
> This e- mail may contain confidential and/or privileged information. If
> you are not the intended recipient (or have received this e-mail in error)
> please notify the sender immediately and destroy this e-mail. Any
> unauthorized copying, disclosure or distribution of the material in this
> e-mail is strictly forbidden.
>
>

Mime
View raw message