Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

JSON to hive table - displaying nulls

JSON to hive table - displaying nulls

New Contributor

Hi,

 

A Hive table (example: Table1) has a column ( column1) which is of struct type. This struct has a JSON-column which needs to converted to a hive table. ( JSON column data needs to be flattened and displayed in a hive view)

 

sample json

 

Table1:

{

id : " "

 

column1 :

{

json-column:

{

claim-number : "123"

claim-description : "test data"

}

 

}

 

The select query to display the json data is below

 

create view as

select

get_json_object(table1.column1.json-column, $.claim-number),

get_json_object(table1.column1.json-column, $.claim-description)

from table1

 

The result set is all null.

 

can you please suggest.

 

Thanks.

 

 

 

1 REPLY 1
Highlighted

Re: JSON to hive table - displaying nulls

Contributor

Each JSON record must be on a single line (no new-line characters allowed).

 

A return of 'null' just means that Hive cannot parse the JSON as directed.