ankit jain
2017-06-08 09:22:51 UTC
Hi,
I have a few psv file with a few of the columns being a json key value map.
key and values to different columns. How is that possible?
end product being:
id name key1 key2 description
1 xyz value1 value2 abc
Right now am doing something like this but the json column wont explode:
CREATE TABLE dfs.data.`/logs/logsp/` AS SELECT
id name json_column description
1 xyz {"key1":"value1", "key2":"value2"} abc
Thanks in advance,
Ankit Jain
I have a few psv file with a few of the columns being a json key value map.
1|xyz|{"key1":"value1", "key2":"value2"}|abc|
I am converting these files to parquet format but want to convert the jsonkey and values to different columns. How is that possible?
end product being:
id name key1 key2 description
1 xyz value1 value2 abc
Right now am doing something like this but the json column wont explode:
CREATE TABLE dfs.data.`/logs/logsp/` AS SELECT
CAST(columns[0] AS INT) `id`,
columns[1] AS `name`,
columns[2] AS `json_column`,
columns[3] AS `description`,
from dfs.data.`logs/events.tbl`;
And this is what I getcolumns[1] AS `name`,
columns[2] AS `json_column`,
columns[3] AS `description`,
from dfs.data.`logs/events.tbl`;
id name json_column description
1 xyz {"key1":"value1", "key2":"value2"} abc
Thanks in advance,
Ankit Jain