Hive中的rollup
1.rollup有什么用?
可以实现从右到左递减多级的统计,显示统计某一层次结构的聚合。
2.举个例子
select device_id,os_id,app_id,client_v,channel,count(user_id) from test_1 group by device_id,os_id,app_id,client_v,channel with rollup;
等价于
select device_id,os_id,app_id,client_v,channel,count(user_id) from test_1 group by device_id,os_id,app_id,client_v,channel grouping sets ((device_id,os_id,app_id,client_v,channel),(device_id,os_id,app_id,client_v),(device_id,os_id,app_id),(device_id,os_id),(device_id),());

浙公网安备 33010602011771号