EXPLAIN [EXTENDED|DEPENDENCY|AUTHORIZATION|LOCKS|VECTORIZATION] query
# explain默認 0: jdbc:hive2://> explain select * from sort_test sort by id desc limit 10; +--------------------------------------------------------------------------------------------------+--+ | Explain | +--------------------------------------------------------------------------------------------------+--+ | STAGE DEPENDENCIES: | | Stage-1 is a root stage | | Stage-2 depends on stages: Stage-1 | | Stage-0 depends on stages: Stage-2 | | | | STAGE PLANS: | | Stage: Stage-1 | | Map Reduce | | Map Operator Tree: | | TableScan | | alias: sort_test | | Statistics: Num rows: 8 Data size: 890 Basic stats: COMPLETE Column stats: NONE | | Select Operator | | expressions: id (type: int), name (type: string) | | outputColumnNames: _col0, _col1 | | Statistics: Num rows: 8 Data size: 890 Basic stats: COMPLETE Column stats: NONE | | Reduce Output Operator | | key expressions: _col0 (type: int) | | sort order: - | | Statistics: Num rows: 8 Data size: 890 Basic stats: COMPLETE Column stats: NONE | | value expressions: _col1 (type: string) | | Reduce Operator Tree: | | Select Operator | | expressions: KEY.reducesinkkey0 (type: int), VALUE._col0 (type: string) | | outputColumnNames: _col0, _col1 | | Statistics: Num rows: 8 Data size: 890 Basic stats: COMPLETE Column stats: NONE | | Limit | | Number of rows: 10 | | Statistics: Num rows: 8 Data size: 890 Basic stats: COMPLETE Column stats: NONE | | File Output Operator | | compressed: false | | table: | | input format: org.apache.hadoop.mapred.SequenceFileInputFormat | | output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat | | serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe | | | | Stage: Stage-2 | | Map Reduce | | Map Operator Tree: | | TableScan | | Reduce Output Operator | | key expressions: _col0 (type: int) | | sort order: - | | Statistics: Num rows: 8 Data size: 890 Basic stats: COMPLETE Column stats: NONE | | value expressions: _col1 (type: string) | | Reduce Operator Tree: | | Select Operator | | expressions: KEY.reducesinkkey0 (type: int), VALUE._col0 (type: string) | | outputColumnNames: _col0, _col1 | | Statistics: Num rows: 8 Data size: 890 Basic stats: COMPLETE Column stats: NONE | | Limit | | Number of rows: 10 | | Statistics: Num rows: 8 Data size: 890 Basic stats: COMPLETE Column stats: NONE | | File Output Operator | | compressed: false | | Statistics: Num rows: 8 Data size: 890 Basic stats: COMPLETE Column stats: NONE | | table: | | input format: org.apache.hadoop.mapred.TextInputFormat | | output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat | | serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe | | | | Stage: Stage-0 | | Fetch Operator | | limit: 10 | | Processor Tree: | | ListSink | | | +--------------------------------------------------------------------------------------------------+--+ # authorization 0: jdbc:hive2://> explain formatted authorization select * from sort_test sort by id desc limit 10; +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--+ | Explain | +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--+ | {"CURRENT_USER":"root","OPERATION":"SWITCHDATABASE","INPUTS":["badou@sort_test"],"OUTPUTS":["hdfs://master:9000/tmp/hive/root/fac1e10c-babb-4927-886e-411b3e9190fb/hive_2018-10-18_11-04-47_534_1155924552647075339-1/-mr-10000"]} | +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--+
【0】Hive wiki - LanguageManual Explainsql
【1】hive入門學習:explain執行計劃的理解express