You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Ayazur Rehman <re...@gmail.com> on 2015/06/05 16:30:53 UTC

Reading Json files in hive

Hi,

Can someone tell me how to read Json file in hive
My Hive version is 0.14

the schema is something like this-

{"columnA": "some_string", "columnB": 227958.0, "columnC": [0.0, 0.0,
0.0, 0.0], "columnD": {"some_string":10.0}}

If there is documentation about it, please let me know as well

-- 
Thanking You,
Ayazur Rehman
+1 720 917 8540

Re: Reading Json files in hive

Posted by DU DU <wi...@gmail.com>.
You can use json_tuple which has better performance as I remember as
follows. Your table should have single column to keep each line of Json
string.

select * from json_table
lateral view json_tuple(json_table_cloumn, 'columnA') val as columnA
...

On Fri, Jun 5, 2015 at 10:38 AM, Wollert, Fabian <fa...@zalando.de>
wrote:

> Hey Ayazur, please see here for doc's on how to read JSON in Hive:
>
>
> https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF#LanguageManualUDF-get_json_object
>
> Cheers
> Fabian
>
> 2015-06-05 16:30 GMT+02:00 Ayazur Rehman <re...@gmail.com>:
>
>> Hi,
>>
>> Can someone tell me how to read Json file in hive
>> My Hive version is 0.14
>>
>> the schema is something like this-
>>
>> {"columnA": "some_string", "columnB": 227958.0, "columnC": [0.0, 0.0, 0.0, 0.0], "columnD": {"some_string":10.0}}
>>
>> If there is documentation about it, please let me know as well
>>
>> --
>> Thanking You,
>> Ayazur Rehman
>> +1 720 917 8540
>>
>
>
>
> --
> *Fabian Wollert*
> Business Intelligence
>
>
>
> *POSTAL ADDRESS*
> Zalando SE
> 11501 Berlin
>
> *OFFICE*
> Zalando SE
> Mollstraße 1
> 10178 Berlin
> Germany
>
> Phone: +49 30 20968 1819
> Fax:   +49 30 27594 693
> E-Mail: fabian.wollert@zalando.de
> Web: www.zalando.de
> Jobs: jobs.zalando.de
>
> Zalando SE, Tamara-Danz-Straße 1, 10243 Berlin
> Company registration: Amtsgericht Charlottenburg, HRB 158855 B
> Tax ID: 29/560/00596 * VAT registration number: DE 260543043
> Management Board: Robert Gentz, David Schneider, Rubin Ritter
> Chairperson of the Supervisory Board: Cristina Stenbeck
> Registered office: Berlinn
>



-- 
Thanks,
Will

RE: Reading Json files in hive

Posted by Gary Clark <gc...@neces.com>.
Yes you will need to import the jar file. I don’t think it comes with the hive by default.

From: Ayazur Rehman [mailto:rehman.ayazur90@gmail.com]
Sent: Friday, June 05, 2015 9:58 AM
To: user@hive.apache.org
Subject: Re: Reading Json files in hive

Hi Gary,

Thanks for the response.
I tried creating a simple json table -
create table jsonTable(id string, type string) row format serde 'org.apache.hadoop.hive.contrib.serde2.JsonSerde';

And I got the following error-

 Cannot validate serde: org.apache.hadoop.hive.contrib.serde2.JsonSerde


Do I need to add an external library for this?

My Hive version is - 0.14

On Fri, Jun 5, 2015 at 10:39 AM, Gary Clark <gc...@neces.com>> wrote:
CREATE EXTERNAL TABLE IF NOT EXISTS sampledata (
          id string,
          type string,
          label string,
          realpoweroutput string,
          realpowerdemand string,
          reactivepoweroutput string,
          kvarpowerdemand string,
          averagesoc string,
          date string
       )
       ROW FORMAT SERDE 'org.apache.hadoop.hive.contrib.serde2.JsonSerde'
       LOCATION '/user/hdfs/testdir/';

From: Wollert, Fabian [mailto:fabian.wollert@zalando.de<ma...@zalando.de>]
Sent: Friday, June 05, 2015 9:38 AM
To: user@hive.apache.org<ma...@hive.apache.org>
Subject: Re: Reading Json files in hive

Hey Ayazur, please see here for doc's on how to read JSON in Hive:

https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF#LanguageManualUDF-get_json_object
Cheers
Fabian

2015-06-05 16:30 GMT+02:00 Ayazur Rehman <re...@gmail.com>>:
Hi,

Can someone tell me how to read Json file in hive
My Hive version is 0.14

the schema is something like this-

{"columnA": "some_string", "columnB": 227958.0, "columnC": [0.0, 0.0, 0.0, 0.0], "columnD": {"some_string":10.0}}
If there is documentation about it, please let me know as well

--
Thanking You,
Ayazur Rehman
+1 720 917 8540<tel:%2B1%20720%20917%208540>



--
Fabian Wollert
Business Intelligence

[Image removed by sender.]

POSTAL ADDRESS
Zalando SE
11501 Berlin

OFFICE
Zalando SE
Mollstraße 1
10178 Berlin
Germany

Phone: +49 30 20968 1819<tel:%2B49%2030%2020968%201819>
Fax:   +49 30 27594 693<tel:%2B49%2030%2027594%20693>
E-Mail: fabian.wollert@zalando.de<ma...@zalando.de>
Web: www.zalando.de<http://www.zalando.de>
Jobs: jobs.zalando.de<http://jobs.zalando.de>

Zalando SE, Tamara-Danz-Straße 1, 10243 Berlin
Company registration: Amtsgericht Charlottenburg, HRB 158855 B
Tax ID: 29/560/00596 * VAT registration number: DE 260543043
Management Board: Robert Gentz, David Schneider, Rubin Ritter
Chairperson of the Supervisory Board: Cristina Stenbeck
Registered office: Berlinn



--
Thanking You,
Ayazur Rehman
+1 720 917 8540

Re: Reading Json files in hive

Posted by Ayazur Rehman <re...@gmail.com>.
Hi Gary,

Thanks for the response.
I tried creating a simple json table -
create table jsonTable(id string, type string) row format serde
'org.apache.hadoop.hive.contrib.serde2.JsonSerde';

And I got the following error-

 Cannot validate serde: org.apache.hadoop.hive.contrib.serde2.JsonSerde


Do I need to add an external library for this?

My Hive version is - 0.14

On Fri, Jun 5, 2015 at 10:39 AM, Gary Clark <gc...@neces.com> wrote:

>  CREATE EXTERNAL TABLE IF NOT EXISTS sampledata (
>
>           id string,
>
>           type string,
>
>           label string,
>
>           realpoweroutput string,
>
>           realpowerdemand string,
>
>           reactivepoweroutput string,
>
>           kvarpowerdemand string,
>
>           averagesoc string,
>
>           date string
>
>        )
>
>        ROW FORMAT SERDE 'org.apache.hadoop.hive.contrib.serde2.JsonSerde'
>
>        LOCATION '/user/hdfs/testdir/';
>
>
>
> *From:* Wollert, Fabian [mailto:fabian.wollert@zalando.de]
> *Sent:* Friday, June 05, 2015 9:38 AM
> *To:* user@hive.apache.org
> *Subject:* Re: Reading Json files in hive
>
>
>
> Hey Ayazur, please see here for doc's on how to read JSON in Hive:
>
>
> https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF#LanguageManualUDF-get_json_object
>
> Cheers
>
> Fabian
>
>
>
> 2015-06-05 16:30 GMT+02:00 Ayazur Rehman <re...@gmail.com>:
>
> Hi,
>
>
>
> Can someone tell me how to read Json file in hive
>
> My Hive version is 0.14
>
>
>
> the schema is something like this-
>
> {"columnA": "some_string", "columnB": 227958.0, "columnC": [0.0, 0.0, 0.0, 0.0], "columnD": {"some_string":10.0}}
>
>  If there is documentation about it, please let me know as well
>
>
>
> --
>
> Thanking You,
>
> Ayazur Rehman
>
> +1 720 917 8540
>
>
>
>
> --
>
> *Fabian Wollert*
>
> Business Intelligence
>
>
> [image: Image removed by sender.]
>
> *POSTAL ADDRESS*
> Zalando SE
> 11501 Berlin
>
> *OFFICE*
> Zalando SE
> Mollstraße 1
> 10178 Berlin
> Germany
>
> Phone: +49 30 20968 1819
> Fax:   +49 30 27594 693
> E-Mail: fabian.wollert@zalando.de
> Web: www.zalando.de
> Jobs: jobs.zalando.de
>
> Zalando SE, Tamara-Danz-Straße 1, 10243 Berlin
> Company registration: Amtsgericht Charlottenburg, HRB 158855 B
> Tax ID: 29/560/00596 * VAT registration number: DE 260543043
> Management Board: Robert Gentz, David Schneider, Rubin Ritter
> Chairperson of the Supervisory Board: Cristina Stenbeck
> Registered office: Berlinn
>



-- 
Thanking You,
Ayazur Rehman
+1 720 917 8540

RE: Reading Json files in hive

Posted by Gary Clark <gc...@neces.com>.
CREATE EXTERNAL TABLE IF NOT EXISTS sampledata (
          id string,
          type string,
          label string,
          realpoweroutput string,
          realpowerdemand string,
          reactivepoweroutput string,
          kvarpowerdemand string,
          averagesoc string,
          date string
       )
       ROW FORMAT SERDE 'org.apache.hadoop.hive.contrib.serde2.JsonSerde'
       LOCATION '/user/hdfs/testdir/';

From: Wollert, Fabian [mailto:fabian.wollert@zalando.de]
Sent: Friday, June 05, 2015 9:38 AM
To: user@hive.apache.org
Subject: Re: Reading Json files in hive

Hey Ayazur, please see here for doc's on how to read JSON in Hive:

https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF#LanguageManualUDF-get_json_object
Cheers
Fabian

2015-06-05 16:30 GMT+02:00 Ayazur Rehman <re...@gmail.com>>:
Hi,

Can someone tell me how to read Json file in hive
My Hive version is 0.14

the schema is something like this-

{"columnA": "some_string", "columnB": 227958.0, "columnC": [0.0, 0.0, 0.0, 0.0], "columnD": {"some_string":10.0}}
If there is documentation about it, please let me know as well

--
Thanking You,
Ayazur Rehman
+1 720 917 8540<tel:%2B1%20720%20917%208540>



--
Fabian Wollert
Business Intelligence

[Image removed by sender.]

POSTAL ADDRESS
Zalando SE
11501 Berlin

OFFICE
Zalando SE
Mollstraße 1
10178 Berlin
Germany

Phone: +49 30 20968 1819
Fax:   +49 30 27594 693
E-Mail: fabian.wollert@zalando.de<ma...@zalando.de>
Web: www.zalando.de<http://www.zalando.de>
Jobs: jobs.zalando.de<http://jobs.zalando.de>

Zalando SE, Tamara-Danz-Straße 1, 10243 Berlin
Company registration: Amtsgericht Charlottenburg, HRB 158855 B
Tax ID: 29/560/00596 * VAT registration number: DE 260543043
Management Board: Robert Gentz, David Schneider, Rubin Ritter
Chairperson of the Supervisory Board: Cristina Stenbeck
Registered office: Berlinn

Re: Reading Json files in hive

Posted by DU DU <wi...@gmail.com>.
Fix column here means you have to define the table using SerDe in advance.
If you have new columns added to the json, the table has to be changed.
Create a table only have a column, such as value. Each row is line of json.
Then use the jason tuple UDF to parcer the json on the fly

On Fri, Jun 5, 2015 at 11:55 AM, Ayazur Rehman <re...@gmail.com>
wrote:

> What is the meaning of fix column...does it mean non-nested columns?
> So I decided to use the UDF ...
> But I am still struggling with a command to create a table .... Is it
> necessary to use String datatype...even if I have integers....and how do I
> specify the nested data types....like the following ....
>
> "columnD": {"some_string":10.0}
>
> Also, how can I run group by queries on this file...
>
> Apologies for the silly questions...I haven't dealt with complicated
> things on hive and..the latest stable release of Pig has a bug...where it
> can't read array data type...
>
>
> On Fri, Jun 5, 2015 at 11:33 AM, DU DU <wi...@gmail.com> wrote:
>
>> Using Json serde requires you have fix column. In your case, you should
>> consider using HIVE UDF mentioned above
>>
>> On Fri, Jun 5, 2015 at 11:13 AM, Wollert, Fabian <
>> fabian.wollert@zalando.de> wrote:
>>
>>> you can either pursuit the approaches from the others (reading the whole
>>> table with JSON Input Format) or you read the File with normal Input Format
>>> and STRING Datatype and then apply the function i mentioned afterwards.
>>> Both Approaches work, i usually use mine. I don't know though which one is
>>> best for performance.
>>>
>>> Cheers
>>> Fabian
>>>
>>> 2015-06-05 17:03 GMT+02:00 Ayazur Rehman <re...@gmail.com>:
>>>
>>>> Hi Fabian,
>>>>
>>>> The documentation only points to how to run some queries with json
>>>> format table and I could not find the documentation for creating a Json
>>>> Table. Did I miss something in the documentation?
>>>> I apologize if my question was not clear.
>>>> Thanks
>>>>
>>>> On Fri, Jun 5, 2015 at 10:38 AM, Wollert, Fabian <
>>>> fabian.wollert@zalando.de> wrote:
>>>>
>>>>> Hey Ayazur, please see here for doc's on how to read JSON in Hive:
>>>>>
>>>>>
>>>>> https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF#LanguageManualUDF-get_json_object
>>>>>
>>>>> Cheers
>>>>> Fabian
>>>>>
>>>>> 2015-06-05 16:30 GMT+02:00 Ayazur Rehman <re...@gmail.com>:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> Can someone tell me how to read Json file in hive
>>>>>> My Hive version is 0.14
>>>>>>
>>>>>> the schema is something like this-
>>>>>>
>>>>>> {"columnA": "some_string", "columnB": 227958.0, "columnC": [0.0, 0.0, 0.0, 0.0], "columnD": {"some_string":10.0}}
>>>>>>
>>>>>> If there is documentation about it, please let me know as well
>>>>>>
>>>>>> --
>>>>>> Thanking You,
>>>>>> Ayazur Rehman
>>>>>> +1 720 917 8540
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> *Fabian Wollert*
>>>>> Business Intelligence
>>>>>
>>>>>
>>>>>
>>>>> *POSTAL ADDRESS*
>>>>> Zalando SE
>>>>> 11501 Berlin
>>>>>
>>>>> *OFFICE*
>>>>> Zalando SE
>>>>> Mollstraße 1
>>>>> 10178 Berlin
>>>>> Germany
>>>>>
>>>>> Phone: +49 30 20968 1819
>>>>> Fax:   +49 30 27594 693
>>>>> E-Mail: fabian.wollert@zalando.de
>>>>> Web: www.zalando.de
>>>>> Jobs: jobs.zalando.de
>>>>>
>>>>> Zalando SE, Tamara-Danz-Straße 1, 10243 Berlin
>>>>> Company registration: Amtsgericht Charlottenburg, HRB 158855 B
>>>>> Tax ID: 29/560/00596 * VAT registration number: DE 260543043
>>>>> Management Board: Robert Gentz, David Schneider, Rubin Ritter
>>>>> Chairperson of the Supervisory Board: Cristina Stenbeck
>>>>> Registered office: Berlinn
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Thanking You,
>>>> Ayazur Rehman
>>>> +1 720 917 8540
>>>>
>>>
>>>
>>>
>>> --
>>> *Fabian Wollert*
>>> Business Intelligence
>>>
>>>
>>>
>>> *POSTAL ADDRESS*
>>> Zalando SE
>>> 11501 Berlin
>>>
>>> *OFFICE*
>>> Zalando SE
>>> Mollstraße 1
>>> 10178 Berlin
>>> Germany
>>>
>>> Phone: +49 30 20968 1819
>>> Fax:   +49 30 27594 693
>>> E-Mail: fabian.wollert@zalando.de
>>> Web: www.zalando.de
>>> Jobs: jobs.zalando.de
>>>
>>> Zalando SE, Tamara-Danz-Straße 1, 10243 Berlin
>>> Company registration: Amtsgericht Charlottenburg, HRB 158855 B
>>> Tax ID: 29/560/00596 * VAT registration number: DE 260543043
>>> Management Board: Robert Gentz, David Schneider, Rubin Ritter
>>> Chairperson of the Supervisory Board: Cristina Stenbeck
>>> Registered office: Berlinn
>>>
>>
>>
>>
>> --
>> Thanks,
>> Will
>>
>
>
>
> --
> Thanking You,
> Ayazur Rehman
> +1 720 917 8540
>



-- 
Thanks,
Will

Re: Reading Json files in hive

Posted by Ayazur Rehman <re...@gmail.com>.
What is the meaning of fix column...does it mean non-nested columns?
So I decided to use the UDF ...
But I am still struggling with a command to create a table .... Is it
necessary to use String datatype...even if I have integers....and how do I
specify the nested data types....like the following ....

"columnD": {"some_string":10.0}

Also, how can I run group by queries on this file...

Apologies for the silly questions...I haven't dealt with complicated things
on hive and..the latest stable release of Pig has a bug...where it can't
read array data type...


On Fri, Jun 5, 2015 at 11:33 AM, DU DU <wi...@gmail.com> wrote:

> Using Json serde requires you have fix column. In your case, you should
> consider using HIVE UDF mentioned above
>
> On Fri, Jun 5, 2015 at 11:13 AM, Wollert, Fabian <
> fabian.wollert@zalando.de> wrote:
>
>> you can either pursuit the approaches from the others (reading the whole
>> table with JSON Input Format) or you read the File with normal Input Format
>> and STRING Datatype and then apply the function i mentioned afterwards.
>> Both Approaches work, i usually use mine. I don't know though which one is
>> best for performance.
>>
>> Cheers
>> Fabian
>>
>> 2015-06-05 17:03 GMT+02:00 Ayazur Rehman <re...@gmail.com>:
>>
>>> Hi Fabian,
>>>
>>> The documentation only points to how to run some queries with json
>>> format table and I could not find the documentation for creating a Json
>>> Table. Did I miss something in the documentation?
>>> I apologize if my question was not clear.
>>> Thanks
>>>
>>> On Fri, Jun 5, 2015 at 10:38 AM, Wollert, Fabian <
>>> fabian.wollert@zalando.de> wrote:
>>>
>>>> Hey Ayazur, please see here for doc's on how to read JSON in Hive:
>>>>
>>>>
>>>> https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF#LanguageManualUDF-get_json_object
>>>>
>>>> Cheers
>>>> Fabian
>>>>
>>>> 2015-06-05 16:30 GMT+02:00 Ayazur Rehman <re...@gmail.com>:
>>>>
>>>>> Hi,
>>>>>
>>>>> Can someone tell me how to read Json file in hive
>>>>> My Hive version is 0.14
>>>>>
>>>>> the schema is something like this-
>>>>>
>>>>> {"columnA": "some_string", "columnB": 227958.0, "columnC": [0.0, 0.0, 0.0, 0.0], "columnD": {"some_string":10.0}}
>>>>>
>>>>> If there is documentation about it, please let me know as well
>>>>>
>>>>> --
>>>>> Thanking You,
>>>>> Ayazur Rehman
>>>>> +1 720 917 8540
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> *Fabian Wollert*
>>>> Business Intelligence
>>>>
>>>>
>>>>
>>>> *POSTAL ADDRESS*
>>>> Zalando SE
>>>> 11501 Berlin
>>>>
>>>> *OFFICE*
>>>> Zalando SE
>>>> Mollstraße 1
>>>> 10178 Berlin
>>>> Germany
>>>>
>>>> Phone: +49 30 20968 1819
>>>> Fax:   +49 30 27594 693
>>>> E-Mail: fabian.wollert@zalando.de
>>>> Web: www.zalando.de
>>>> Jobs: jobs.zalando.de
>>>>
>>>> Zalando SE, Tamara-Danz-Straße 1, 10243 Berlin
>>>> Company registration: Amtsgericht Charlottenburg, HRB 158855 B
>>>> Tax ID: 29/560/00596 * VAT registration number: DE 260543043
>>>> Management Board: Robert Gentz, David Schneider, Rubin Ritter
>>>> Chairperson of the Supervisory Board: Cristina Stenbeck
>>>> Registered office: Berlinn
>>>>
>>>
>>>
>>>
>>> --
>>> Thanking You,
>>> Ayazur Rehman
>>> +1 720 917 8540
>>>
>>
>>
>>
>> --
>> *Fabian Wollert*
>> Business Intelligence
>>
>>
>>
>> *POSTAL ADDRESS*
>> Zalando SE
>> 11501 Berlin
>>
>> *OFFICE*
>> Zalando SE
>> Mollstraße 1
>> 10178 Berlin
>> Germany
>>
>> Phone: +49 30 20968 1819
>> Fax:   +49 30 27594 693
>> E-Mail: fabian.wollert@zalando.de
>> Web: www.zalando.de
>> Jobs: jobs.zalando.de
>>
>> Zalando SE, Tamara-Danz-Straße 1, 10243 Berlin
>> Company registration: Amtsgericht Charlottenburg, HRB 158855 B
>> Tax ID: 29/560/00596 * VAT registration number: DE 260543043
>> Management Board: Robert Gentz, David Schneider, Rubin Ritter
>> Chairperson of the Supervisory Board: Cristina Stenbeck
>> Registered office: Berlinn
>>
>
>
>
> --
> Thanks,
> Will
>



-- 
Thanking You,
Ayazur Rehman
+1 720 917 8540

Re: Reading Json files in hive

Posted by DU DU <wi...@gmail.com>.
Using Json serde requires you have fix column. In your case, you should
consider using HIVE UDF mentioned above

On Fri, Jun 5, 2015 at 11:13 AM, Wollert, Fabian <fa...@zalando.de>
wrote:

> you can either pursuit the approaches from the others (reading the whole
> table with JSON Input Format) or you read the File with normal Input Format
> and STRING Datatype and then apply the function i mentioned afterwards.
> Both Approaches work, i usually use mine. I don't know though which one is
> best for performance.
>
> Cheers
> Fabian
>
> 2015-06-05 17:03 GMT+02:00 Ayazur Rehman <re...@gmail.com>:
>
>> Hi Fabian,
>>
>> The documentation only points to how to run some queries with json format
>> table and I could not find the documentation for creating a Json Table. Did
>> I miss something in the documentation?
>> I apologize if my question was not clear.
>> Thanks
>>
>> On Fri, Jun 5, 2015 at 10:38 AM, Wollert, Fabian <
>> fabian.wollert@zalando.de> wrote:
>>
>>> Hey Ayazur, please see here for doc's on how to read JSON in Hive:
>>>
>>>
>>> https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF#LanguageManualUDF-get_json_object
>>>
>>> Cheers
>>> Fabian
>>>
>>> 2015-06-05 16:30 GMT+02:00 Ayazur Rehman <re...@gmail.com>:
>>>
>>>> Hi,
>>>>
>>>> Can someone tell me how to read Json file in hive
>>>> My Hive version is 0.14
>>>>
>>>> the schema is something like this-
>>>>
>>>> {"columnA": "some_string", "columnB": 227958.0, "columnC": [0.0, 0.0, 0.0, 0.0], "columnD": {"some_string":10.0}}
>>>>
>>>> If there is documentation about it, please let me know as well
>>>>
>>>> --
>>>> Thanking You,
>>>> Ayazur Rehman
>>>> +1 720 917 8540
>>>>
>>>
>>>
>>>
>>> --
>>> *Fabian Wollert*
>>> Business Intelligence
>>>
>>>
>>>
>>> *POSTAL ADDRESS*
>>> Zalando SE
>>> 11501 Berlin
>>>
>>> *OFFICE*
>>> Zalando SE
>>> Mollstraße 1
>>> 10178 Berlin
>>> Germany
>>>
>>> Phone: +49 30 20968 1819
>>> Fax:   +49 30 27594 693
>>> E-Mail: fabian.wollert@zalando.de
>>> Web: www.zalando.de
>>> Jobs: jobs.zalando.de
>>>
>>> Zalando SE, Tamara-Danz-Straße 1, 10243 Berlin
>>> Company registration: Amtsgericht Charlottenburg, HRB 158855 B
>>> Tax ID: 29/560/00596 * VAT registration number: DE 260543043
>>> Management Board: Robert Gentz, David Schneider, Rubin Ritter
>>> Chairperson of the Supervisory Board: Cristina Stenbeck
>>> Registered office: Berlinn
>>>
>>
>>
>>
>> --
>> Thanking You,
>> Ayazur Rehman
>> +1 720 917 8540
>>
>
>
>
> --
> *Fabian Wollert*
> Business Intelligence
>
>
>
> *POSTAL ADDRESS*
> Zalando SE
> 11501 Berlin
>
> *OFFICE*
> Zalando SE
> Mollstraße 1
> 10178 Berlin
> Germany
>
> Phone: +49 30 20968 1819
> Fax:   +49 30 27594 693
> E-Mail: fabian.wollert@zalando.de
> Web: www.zalando.de
> Jobs: jobs.zalando.de
>
> Zalando SE, Tamara-Danz-Straße 1, 10243 Berlin
> Company registration: Amtsgericht Charlottenburg, HRB 158855 B
> Tax ID: 29/560/00596 * VAT registration number: DE 260543043
> Management Board: Robert Gentz, David Schneider, Rubin Ritter
> Chairperson of the Supervisory Board: Cristina Stenbeck
> Registered office: Berlinn
>



-- 
Thanks,
Will

Re: Reading Json files in hive

Posted by "Wollert, Fabian" <fa...@zalando.de>.
you can either pursuit the approaches from the others (reading the whole
table with JSON Input Format) or you read the File with normal Input Format
and STRING Datatype and then apply the function i mentioned afterwards.
Both Approaches work, i usually use mine. I don't know though which one is
best for performance.

Cheers
Fabian

2015-06-05 17:03 GMT+02:00 Ayazur Rehman <re...@gmail.com>:

> Hi Fabian,
>
> The documentation only points to how to run some queries with json format
> table and I could not find the documentation for creating a Json Table. Did
> I miss something in the documentation?
> I apologize if my question was not clear.
> Thanks
>
> On Fri, Jun 5, 2015 at 10:38 AM, Wollert, Fabian <
> fabian.wollert@zalando.de> wrote:
>
>> Hey Ayazur, please see here for doc's on how to read JSON in Hive:
>>
>>
>> https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF#LanguageManualUDF-get_json_object
>>
>> Cheers
>> Fabian
>>
>> 2015-06-05 16:30 GMT+02:00 Ayazur Rehman <re...@gmail.com>:
>>
>>> Hi,
>>>
>>> Can someone tell me how to read Json file in hive
>>> My Hive version is 0.14
>>>
>>> the schema is something like this-
>>>
>>> {"columnA": "some_string", "columnB": 227958.0, "columnC": [0.0, 0.0, 0.0, 0.0], "columnD": {"some_string":10.0}}
>>>
>>> If there is documentation about it, please let me know as well
>>>
>>> --
>>> Thanking You,
>>> Ayazur Rehman
>>> +1 720 917 8540
>>>
>>
>>
>>
>> --
>> *Fabian Wollert*
>> Business Intelligence
>>
>>
>>
>> *POSTAL ADDRESS*
>> Zalando SE
>> 11501 Berlin
>>
>> *OFFICE*
>> Zalando SE
>> Mollstraße 1
>> 10178 Berlin
>> Germany
>>
>> Phone: +49 30 20968 1819
>> Fax:   +49 30 27594 693
>> E-Mail: fabian.wollert@zalando.de
>> Web: www.zalando.de
>> Jobs: jobs.zalando.de
>>
>> Zalando SE, Tamara-Danz-Straße 1, 10243 Berlin
>> Company registration: Amtsgericht Charlottenburg, HRB 158855 B
>> Tax ID: 29/560/00596 * VAT registration number: DE 260543043
>> Management Board: Robert Gentz, David Schneider, Rubin Ritter
>> Chairperson of the Supervisory Board: Cristina Stenbeck
>> Registered office: Berlinn
>>
>
>
>
> --
> Thanking You,
> Ayazur Rehman
> +1 720 917 8540
>



-- 
*Fabian Wollert*
Business Intelligence



*POSTAL ADDRESS*
Zalando SE
11501 Berlin

*OFFICE*
Zalando SE
Mollstraße 1
10178 Berlin
Germany

Phone: +49 30 20968 1819
Fax:   +49 30 27594 693
E-Mail: fabian.wollert@zalando.de
Web: www.zalando.de
Jobs: jobs.zalando.de

Zalando SE, Tamara-Danz-Straße 1, 10243 Berlin
Company registration: Amtsgericht Charlottenburg, HRB 158855 B
Tax ID: 29/560/00596 * VAT registration number: DE 260543043
Management Board: Robert Gentz, David Schneider, Rubin Ritter
Chairperson of the Supervisory Board: Cristina Stenbeck
Registered office: Berlinn

Re: Reading Json files in hive

Posted by Ayazur Rehman <re...@gmail.com>.
Hi Fabian,

The documentation only points to how to run some queries with json format
table and I could not find the documentation for creating a Json Table. Did
I miss something in the documentation?
I apologize if my question was not clear.
Thanks

On Fri, Jun 5, 2015 at 10:38 AM, Wollert, Fabian <fa...@zalando.de>
wrote:

> Hey Ayazur, please see here for doc's on how to read JSON in Hive:
>
>
> https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF#LanguageManualUDF-get_json_object
>
> Cheers
> Fabian
>
> 2015-06-05 16:30 GMT+02:00 Ayazur Rehman <re...@gmail.com>:
>
>> Hi,
>>
>> Can someone tell me how to read Json file in hive
>> My Hive version is 0.14
>>
>> the schema is something like this-
>>
>> {"columnA": "some_string", "columnB": 227958.0, "columnC": [0.0, 0.0, 0.0, 0.0], "columnD": {"some_string":10.0}}
>>
>> If there is documentation about it, please let me know as well
>>
>> --
>> Thanking You,
>> Ayazur Rehman
>> +1 720 917 8540
>>
>
>
>
> --
> *Fabian Wollert*
> Business Intelligence
>
>
>
> *POSTAL ADDRESS*
> Zalando SE
> 11501 Berlin
>
> *OFFICE*
> Zalando SE
> Mollstraße 1
> 10178 Berlin
> Germany
>
> Phone: +49 30 20968 1819
> Fax:   +49 30 27594 693
> E-Mail: fabian.wollert@zalando.de
> Web: www.zalando.de
> Jobs: jobs.zalando.de
>
> Zalando SE, Tamara-Danz-Straße 1, 10243 Berlin
> Company registration: Amtsgericht Charlottenburg, HRB 158855 B
> Tax ID: 29/560/00596 * VAT registration number: DE 260543043
> Management Board: Robert Gentz, David Schneider, Rubin Ritter
> Chairperson of the Supervisory Board: Cristina Stenbeck
> Registered office: Berlinn
>



-- 
Thanking You,
Ayazur Rehman
+1 720 917 8540

Re: Reading Json files in hive

Posted by "Wollert, Fabian" <fa...@zalando.de>.
Hey Ayazur, please see here for doc's on how to read JSON in Hive:

https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF#LanguageManualUDF-get_json_object

Cheers
Fabian

2015-06-05 16:30 GMT+02:00 Ayazur Rehman <re...@gmail.com>:

> Hi,
>
> Can someone tell me how to read Json file in hive
> My Hive version is 0.14
>
> the schema is something like this-
>
> {"columnA": "some_string", "columnB": 227958.0, "columnC": [0.0, 0.0, 0.0, 0.0], "columnD": {"some_string":10.0}}
>
> If there is documentation about it, please let me know as well
>
> --
> Thanking You,
> Ayazur Rehman
> +1 720 917 8540
>



-- 
*Fabian Wollert*
Business Intelligence



*POSTAL ADDRESS*
Zalando SE
11501 Berlin

*OFFICE*
Zalando SE
Mollstraße 1
10178 Berlin
Germany

Phone: +49 30 20968 1819
Fax:   +49 30 27594 693
E-Mail: fabian.wollert@zalando.de
Web: www.zalando.de
Jobs: jobs.zalando.de

Zalando SE, Tamara-Danz-Straße 1, 10243 Berlin
Company registration: Amtsgericht Charlottenburg, HRB 158855 B
Tax ID: 29/560/00596 * VAT registration number: DE 260543043
Management Board: Robert Gentz, David Schneider, Rubin Ritter
Chairperson of the Supervisory Board: Cristina Stenbeck
Registered office: Berlinn