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
              

未完待續


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM