If I have a table mytable and a list
set vals = (1,2,3,4);
and I want to cross-join the table with the list (getting a new table which has 4 time as many rows as the original table and an extra val column), do I have a better option than creating an explicit temp table?
What I can do is:
select a.*, b.val
from mytable a cross join
(select stack(4,1,2,3,4) as (val) from
(select * from mytable limit 1) z) b;
EDIT: My main use case would be passing -hiveconf vals='4,1,2,3,4' to hive and replacing stack(4,1,2,3,4) with stack(${hiveconf:vals}) in the above code.