For a table, say details, with the schema as,
| Column | Type |
|---|---|
| name | string |
| desc | map<int, string> |
How do I form a select query - to be run by java program - which expects the result set in this structure?
| name | desc |
|---|---|
| Bob | {1,"home"} |
| Alice | {2,"office"} |
Having in mind limitations in impala with regards to complex types here
The result set of an Impala query always contains all scalar types; the elements and fields within any complex type queries must be "unpacked" using join queries.
ie. select * from details; would only return results without the column with map type(complex type).
The closest I've come up with is select name, map_col.key, map_col.value from details, details.desc map_col;. Result set is not in expected format - obviously
.
Thanks in advance.