hive sql 语句执行顺序及执行计划

hive 语句执行顺序

from... where.... select...group by... having ... order by...

执行计划

Map Operator Tree:
TableScan
            alias: 表名   -- 相当于 from ...

Filter Operator
              predicate: where中的字段  -- 过滤where字段的条件

Select Operator
                expressions: select 中的字段 + 类型type    -- select
                outputColumnNames: 输出的字段  -- select
Group By Operator
                  aggregations: 聚合函数 sum(age)/count(age)等 
                  keys: group by 中的字段 + 类型type 
Reduce Output Operator
                 map端本地的reduce

Reduce Operator Tree:
Group By Operator
          aggregations: sum(VALUE._col0)   --reduce 聚合函数 对虚拟列
          keys: KEY._col0 (type: string), KEY._col1 (type: string), KEY._col2 (type: string) 
          mode: mergepartial
              outputColumnNames: _col0, _col1, _col2, _col3 --为临时结果字段按规则起的临时字段名
Select Operator
            expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: bigint) --select
            outputColumnNames: _col0, _col1, _col2, _col3 -- 输出虚拟列(为临时结果字段按规则起的临时字段名)
            
File Output Operator
              compressed: false
              

未完待续

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容