1

I am trying to create a table from nested json.
The second layer of the the JSON is very complex and I don't want to keep the schema of that JSON in the table definition with struct column.

I am looking for solution that allow me to keep it as string.

for example:

{
"request_id": "3dbd4ee3-96fc-4342-bd62",
"payload": { < COMPLEX NESTED JSON >  },
"timestamp": 1569161622
}

I was trying to use the following create statement:

CREATE EXTERNAL TABLE data (
request_id string,
payload string,
`timestamp` int
)
ROW FORMAT  serde 'org.apache.hive.hcatalog.data.JsonSerDe'
LOCATION 's3a://bucket'

Is there any SerDe property/mapping I can use to define the nested object as String?

4

1 回答 1

1

您可以使用org.openx.data.jsonserde.JsonSerDe SerDe

有关此 SerDe 的更多信息,请参阅 [链接] ( https://github.com/rcongiu/Hive-JSON-Serde )

希望这可以帮助

于 2019-10-29T15:00:01.937 回答