项目场景:
hive离线数仓,数据从ODS流向DWD时,无法判断struct类型非空
问题描述
把flume采集到的日志数据写入kafka,再从kafak落地到hive的ods层时,使用的类型为复杂数据类型struct。数据从ODS流向DWD层时,即便加上非空的判断条件,仍然出现脏数据
原因分析:
通过查看执行计划,排查
issue
set hive.cbo.enable=TRUE ;
explain select count(*) from ods_log_inc where page is not null;
set hive.cbo.enable=FALSE ;
explain select count(*) from ods_log_inc where page is not null;
对比执行计划:在关闭cbo后,才会添加过滤 filterExpr: page is not null (type: boolean)
解决方案:
1.升级hive版本或者修改源码
2.在执行时sql时禁用CBO
set hive.cbo.enable=false;