如果使用了hive中的炸裂函数但是没有进一步的聚合仅仅是炸裂之后使用。不能够跟union all连接作为子查询出现insert overwrite table ads_order_by_province select * from ads_order_by_province union select dt , recent_days , province_id , province_name , area_code , iso_code , iso_code_3166_2 , order_count , order_total_amount from( -- 1天 select dt , 1 recent_days , province_id , province_name , area_code , iso_code , iso_3166_2 iso_code_3166_2 , order_count_1d order_count , order_total_amount_1d order_total_amount from dws_trade_province_order_1d where dt 2022-06-08 union all -- 就是这个union all 导致了hive报错修改为union之后就不会报错 -- 7天和30天 select dt , recent_days, province_id , province_name , area_code , iso_code , iso_3166_2, if(recent_days 7,order_count_7d,order_count_30d) order_count, if(recent_days 7,order_total_amount_7d,order_total_amount_30d) order_total_amount from( select dt , province_id , province_name , area_code , iso_code , iso_3166_2, order_count_7d, order_total_amount_7d, order_count_30d, order_total_amount_30d from dws_trade_province_order_nd where dt 2022-06-08 ) t lateral view explode(array(7,30)) tmp as recent_days ) t1;这段sql执行的时候会报[42000][40000] Error while compiling statement: FAILED: SemanticException Exception when trying to remove partition predicates: fail to find child from parent 异常这个异常fail to find child from parent通常发生在 Hive 的CBO基于代价的优化器或RBO基于规则的优化器阶段。具体来说当LATERAL VIEW EXPLODE没有后续聚合时优化器可能会尝试进行“投影下推”或“移除冗余算子”但在处理UNION ALL的子查询树时优化器丢失了对 Lateral View 生成的虚拟列synthetic columns的引用映射导致在语义分析阶段找不到对应的父节点。底层原因就是由于hive在执行炸裂函数的时候会进一步的优化因为你没有进一步的聚合hive会认为这个炸裂函数是可以优化的优化之后就不能够与union all结合使用的sql作为子查询不然就会报fail to find child from parent错误这是hive的底层优化导致的。所以如果使用没有进一步聚合的炸裂函数与union all结合这个结果不能够作为中间表使用。