explain select hour,count(*),count(distinct uid),count(distinct bg) from table where ds='2021-04-09' and hour = '12' group by hour;
一、开启Map端聚合参数设置,set hive.map.aggr=true;
此时,执行计划会多出在map 端的的预聚合操作
二、执行计划,查看日志可以看出,一个指标对应一个reduce job
三、扫描数据次数,只扫描数据 1次。
spark 中的体现,猜测试