Hive面试题:multi group by的好处,举例说明

版权声明:版权声明:本文为博主原创文章,转载请附上博文链接! https://blog.csdn.net/qq_42246689/article/details/84671976

multi group by 可以将查询中的多个group by操作组装到一个MapReduce任务中,起到优化作用

例子:

select Provice,city,county,count(rainfall) from area where data="2018-09-02" group by provice,city,count

select Provice,count(rainfall) from area where data="2018-09-02" group by provice

 

#使用multi group by

from area

 insert overwrite table temp1

  select Provice,city,county,count(rainfall) from area where data="2018-09-02" group by provice,city,count

 insert overwrite table temp2

  select Provice,count(rainfall) from area where data="2018-09-02" group by provice

 

使用multi group by 之前必须配置参数:

<property>

    <name>hive.multigroupby.singlemr</name>

    <value>true</value>

</property>

猜你喜欢

转载自blog.csdn.net/qq_42246689/article/details/84671976
今日推荐