Hive的Explain命令


Hive的Explain命令,用於顯示SQL查詢的執行計划。

Hive查詢被轉化成序列階段(這是一個有向無環圖)。這些階段可能是mapper/reducer階段,或者是Metastore或文件系統的操作,如移動和重命名的階段。

例子 

hive> explain [extended] --加上關鍵字extended,則顯示抽象語法樹 > select * from student > cluster by age;

 1.查詢的抽象語法樹(沒用,可以忽略)

2.執行計划計划的不同階段之間的依賴關系(很重要)

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

3.每個場景的描述

STAGE PLANS: Stage: Stage-1 Map Reduce Map Operator Tree: //發生在job的 map 處理階段過程 TableScan        //讀取表的數據 alias: student //表名為student,若select * from emp e;表有別名則顯示別名e Statistics: Num rows: 0 Data size: 74 Basic stats: PARTIAL Column stats: NONE Select Operator expressions: age (type: int), name (type: string) outputColumnNames: _col0, _col1 Statistics: Num rows: 0 Data size: 74 Basic stats: PARTIAL Column stats: NONE Reduce Output Operator key expressions: _col0 (type: int) sort order: + Map-reduce partition columns: _col0 (type: int) Statistics: Num rows: 0 Data size: 74 Basic stats: PARTIAL Column stats: NONE value expressions: _col0 (type: int), _col1 (type: string) Reduce Operator Tree: //發生在job的 reduce 處理階段過程  Extract Statistics: Num rows: 0 Data size: 74 Basic stats: PARTIAL Column stats: NONE File Output Operator compressed: false Statistics: Num rows: 0 Data size: 74 Basic stats: PARTIAL Column stats: NONE table: //說明輸入格式是TextInputFormat input format: org.apache.hadoop.mapred.TextInputFormat //說明輸出格式是HiveIgnoreKeyTextOutputFormat output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe Stage: Stage-0
    Fetch Operator limit: -1                    //--job中沒有Limit 
 Time taken: 0.085 seconds, Fetched: 36 row(s)

 


免責聲明!

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



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