'How can i cross join multiple arrays in Hive?
For example, i have:
[a1, a2, a3]
[b1, b2]
[c1]
And how can i get the following result by using hive sql?
a1,b1,c1
a1,b2,c1
a2,b1,c1
a2,b2,c1
a3,b1,c1
a3,b2,c1
which is same as the result of:
select concat_ws(',', a, b, c)
from (select 1) t
lateral view explode(array('a1', 'a2', 'a3')) t1 as a
lateral view explode(array('b1', 'b2')) t2 as b
lateral view explode(array('c1')) t3 as c;
But, unluckily, the row number of arrays is unknown.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
