I've created a hive table using the AVRO SerDe's sitting on top of a schema
containing a union of records, similar to:
{ "name": "Foo",
"type": "record",
"fields": [
{ "name": "foo", "type": "int" },
{ "name": "details", "type": [
{ "name": "Bar",
"type": "record",
"fields": [{ "name": "bar", "type": "int" }] },
{ "name": "Baz",
"type": "record",
"fields": [{ "name": "baz", "type": "int" }] },
]
}
]
}
How do I "SELECT foo, bar FROM table" or "SELECT foo, baz FROM table",
i.e., select the individual fields of the unioned structs? When I "SELECT
* FROM table", it has either {0:{"bar":42}} or {1:{"baz":42}} and I don't
know how to destructure that any further. LATERAL VIEW doesn't seem to
work for this and my Google-fu is otherwise failing me.
Thanks,
--Jonathan Bryant