szs 发表于 2018-10-22 11:20:54

Hive SQL解析/执行计划生成流程分析

STAGE DEPENDENCIES:  
Stage-1 is a root stage
  
Stage-0 is a root stage
  

  
STAGE PLANS:
  
Stage: Stage-1
  
    Map Reduce
  
      Alias -> Map Operator Tree:
  
      logs
  
          TableScan // 扫描表
  
            alias: logs
  
            Select Operator //选择字段
  
            expressions:
  
                  expr: uid
  
                  type: string
  
                  expr: count
  
                  type: int
  
            outputColumnNames: uid, count
  
            Group By Operator //在map端先做一次聚合,减少shuffle数据量
  
                aggregations:
  
                      expr: sum(count) //聚合函数
  
                bucketGroup: false
  
                keys:
  
                      expr: uid
  
                      type: string
  
                mode: hash
  
                outputColumnNames: _col0, _col1
  
                Reduce Output Operator //输出key,value给reduce
  
                  key expressions:
  
                        expr: _col0
  
                        type: string
  
                  sort order: +
  
                  Map-reduce partition columns:
  
                        expr: _col0
  
                        type: string
  
                  tag: -1
  
                  value expressions:
  
                        expr: _col1
  
                        type: bigint
  
      Reduce Operator Tree:
  
      Group By Operator
  
          aggregations:
  
                expr: sum(VALUE._col0) //聚合
  
          bucketGroup: false
  
          keys:
  
                expr: KEY._col0
  
                type: string
  
          mode: mergepartial
  
          outputColumnNames: _col0, _col1
  
          Select Operator //选择字段
  
            expressions:
  
                  expr: _col0
  
                  type: string
  
                  expr: _col1
  
                  type: bigint
  
            outputColumnNames: _col0, _col1
  
            File Output Operator //输出到文件
  
            compressed: false
  
            GlobalTableId: 0
  
            table:
  
                  input format: org.apache.hadoop.mapred.TextInputFormat
  
                  output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
  

  
Stage: Stage-0
  
    Fetch Operator
  
      limit: -1


页: [1]
查看完整版本: Hive SQL解析/执行计划生成流程分析