Member since
01-31-2017
1
Post
0
Kudos Received
0
Solutions
01-31-2017
07:57 PM
I have a situation where I want to build a map by grouping rows resulting from a sequence of "UNION ALL"s.
What Hive syntax (without using custom UDFs) will let me achieve something like this?
Desired result: id1 id2 result 100 200 {k1: v1, k2: v2...} 101 201 {k1: v1, k2: v2...}
select id1, id2, collect_map(col1_key, col2_val) as result from
(
select id1, id2, col1_key, col2_val from table1
union all
select id1, id2, col1_key, col2_val from table2
)
... View more
Labels:
- Labels:
-
Apache Hadoop
-
Apache Hive