hive on tez 发现的问题,hive on mr应该没问题
select
xxxxx
from table
lateral view explode(split(businessdict,',')) col as jsons
where pt=${v_1day} and businessdict like '%name%'
union all
select
xxxx
from table
当使用 lateral view explode 与一个普通sql union all的时候会出现以下问题:
直接求上面的sql的count数量是对的,但是当用上面的sql insert到一张表时,结果表数据只有普通sql的数据,并且跟union all的顺序无关,即使是改变两个sql的顺序目标表中也是只有普通sql的数据
解决办法:
不能使用with as,只能将列转行的sql的数据建设中间的物理模型
注意:不论是不是直接union all 及时是子查询是lateral view explode 也不行