zoukankan      html  css  js  c++  java
  • 关于hive multi group by的疑惑

     有多条hive语句从同一张表中做count操作,语句如下:

     select pf,way,method,count(distinct id) where push_date_type ='$push_date_type' group by pf,way,method; 
    select pf,way,-1,count(distinct id) where push_date_type ='$push_date_type' group by pf,way;
     ......

      想着用multi group by特性优化下效率,于是把上述语句改写成:

    from push_revisit_info 
        insert overwrite table push_rpt_pf_way_mthd
            select pf,way,method,count(distinct id) where push_date_type ='$push_date_type' group by pf,way,method
        insert overwrite table push_rpt_pf_way
            select pf,way,-1,count(distinct id) where push_date_type ='$push_date_type' group by pf,way
    

    参数hive.multigroupby.singlemr也设置成了true;

    可是这条语句还是会生成两个mapreduce执行,跟未使用multi group by时MR Job数量一样,甚至执行时间还稍长。

    如果这两句的group key用成一样,就会只生成一个MR Job,但不论hive.multigroupby.singlemr是true还是false,都是这样。

    关于这个参数的含义,hive-default.xml是这样写的:

    <property>
        <name>hive.multigroupby.singlemr</name>
        <value>false</value>
        <description>Whether to optimize multi group by query to generate single M/R
            job plan. If the multi group by query has common group by keys, it will be
            optimized to generate single M/R job.</description>
    </property>

    这里的common翻译成什么最合适呢?“共同的”?那依上面的经验,不用开启这个设置也会优化成一个。那么这个参数到底有什么用?multi group by又如何使用呢?  

  • 相关阅读:
    2020软件工程作业05
    一、uart&tty驱动
    柔性数组使用备忘
    指针和数组备忘
    计算信息帧的校验和(备忘)
    Linux系统vim几个常见配置
    C语言实现过滤ASCII在0~127范围内的字符,并去除重复的字符
    extern "C"的用法
    strtol详解
    将一个十进制整数转换为二进制并输出
  • 原文地址:https://www.cnblogs.com/aprilrain/p/2966125.html
Copyright © 2011-2022 走看看