文章目录
问题 1 说一下hive底层转为MapReduce ,底层是怎么转的
(3) 优化器(Query Optimizer):对逻辑执行计划进行优化。
> explain select * from mytest_staff_info_demo4_cp1
> where statis_date='20180229'
> order by name
> limit 3;
OK
STAGE DEPENDENCIES:
Stage-1 is a root stage
Stage-0 is a root stage
STAGE PLANS:
Stage: Stage-1
Map Reduce
Map Operator Tree:
TableScan
alias: mytest_staff_info_demo4_cp1
Statistics: Num rows: 0 Data size: 195 Basic stats: PARTIAL Column
stats: NONE
Select Operator
expressions: name (type: string), deptcode (type: string), id (type:
int), account (type: string), areacode (type: string), statis_date (type: string)
outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
Statistics: Num rows: 0 Data size: 195 Basic stats: PARTIAL Column
stats: NONE
Reduce Output Operator
key expressions: _col0 (type: string)
sort order: +
Statistics: Num rows: 0 Data size: 195 Basic stats: PARTIAL Column
stats: NONE
value expressions: _col0 (type: string), _col1 (type: string),
_col2 (type: int), _col3 (type: string), _col4 (type: string), _col5 (type:
string)
Reduce Operator Tree:
Extract
Statistics: Num rows: 0 Data size: 195 Basic stats: PARTIAL Column
stats: NONE
Limit
Number of rows: 3
Statistics: Num rows: 0 Data size: 195 Basic stats: PARTIAL Column
stats: NONE
File Output Operator
compressed: true
Statistics: Num rows: 0 Data size: 195 Basic stats: PARTIAL Column
stats: NONE
table:
input format: org.apache.hadoop.mapred.TextInputFormat
(4) 执行器(Execution):把逻辑执行计划转换成可以运行的物理计划。对于 Hive 来说,就是
MR/Spark。
可以使用 explain 命令,查看语法树,即 hive 先将 sql 语法转成对应的语法树
output format:
org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
serde: org.apache.hadoop.hive.serde2.lazy