I have a JSON-file with contents like this:
{
"key1": [
"value1"
],
"key2": [
{
"key3": "value3",
"key4": "value4
}
],
"key5": "value5"
}
To create a serde-table in presto for this file (without "key1") I would do:
create table table_one
(
key2 ARRAY (
ROW (
key3 varchar,
key4 varchar
)
),
key5 varchar
)...
Which works fine. But my problem is how can I get the attribute "key1" displayed in the serde table as well when it doesn't have a key-value inside the [] in the JSON-file?
Thanks, Bjørn
You can just define it straight away as array of varchar, assuming it's a list of strings.
create table table_two
(
key1 ARRAY (varchar),
key2 ARRAY (
ROW (
key3 varchar,
key4 varchar
)
),
key5 varchar
);