hadoop explain left join 语句在执行计划变成了 Inner Join ,求大神解惑!

0
在两个sql语句中,第一个是我想要的,但是刚写出来的时候是第二个,第二个sql语句执行计划里的left join变成了inner join,不知所云,希望老师们解答一下!

hive> explain select t1.device_id,t1.sid, t2.sid

> from (select * from playqos_action_detail where curdate='20161101') t1

> left join (select * from seek_pause_buffer_action where curdate='20161101' and action='http://wenda.chinahadoop.cn/SeekAction') t2

> on (t1.sid=t2.sid and t1.device_id=t2.device_id)

> where t1.device_id='015163005010013'

> ;

OK

STAGE DEPENDENCIES:

Stage-1 is a root stage

Stage-0 depends on stages: Stage-1



STAGE PLANS:

Stage: Stage-1

Map Reduce

Map Operator Tree:

TableScan

alias: playqos_action_detail

Statistics: Num rows: 3568808 Data size: 1137545459 Basic stats: COMPLETE Column stats: NONE

Filter Operator

predicate: (device_id = '015163005010013') (type: boolean)

Statistics: Num rows: 1784404 Data size: 568772729 Basic stats: COMPLETE Column stats: NONE

Select Operator

expressions: '015163005010013' (type: string), sid (type: string)

outputColumnNames: _col0, _col1

Statistics: Num rows: 1784404 Data size: 568772729 Basic stats: COMPLETE Column stats: NONE

Reduce Output Operator

key expressions: _col1 (type: string), _col0 (type: string)

sort order: ++

Map-reduce partition columns: _col1 (type: string), _col0 (type: string)

Statistics: Num rows: 1784404 Data size: 568772729 Basic stats: COMPLETE Column stats: NONE

TableScan

alias: seek_pause_buffer_action

Statistics: Num rows: 1296952 Data size: 71839667 Basic stats: COMPLETE Column stats: NONE

Filter Operator

predicate: ((action = 'SeekAction') and (device_id = '015163005010013')) (type: boolean)

Statistics: Num rows: 324238 Data size: 17959916 Basic stats: COMPLETE Column stats: NONE

Select Operator

expressions: '015163005010013' (type: string), sid (type: string)

outputColumnNames: _col0, _col1

Statistics: Num rows: 324238 Data size: 17959916 Basic stats: COMPLETE Column stats: NONE

Reduce Output Operator

key expressions: _col1 (type: string), _col0 (type: string)

sort order: ++

Map-reduce partition columns: _col1 (type: string), _col0 (type: string)

Statistics: Num rows: 324238 Data size: 17959916 Basic stats: COMPLETE Column stats: NONE

Reduce Operator Tree:

Join Operator

condition map:

Left Outer Join0 to 1

keys:

0 _col1 (type: string), _col0 (type: string)

1 _col1 (type: string), _col0 (type: string)

outputColumnNames: _col0, _col1, _col3

Statistics: Num rows: 1962844 Data size: 625650015 Basic stats: COMPLETE Column stats: NONE

Select Operator

expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string)

outputColumnNames: _col0, _col1, _col2

Statistics: Num rows: 1962844 Data size: 625650015 Basic stats: COMPLETE Column stats: NONE

File Output Operator

compressed: false

Statistics: Num rows: 1962844 Data size: 625650015 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: -1

Processor Tree:

ListSink



Time taken: 0.16 seconds, Fetched: 65 row(s)

hive> explain select a.device_id,a.sid,

> (case when b.device_id is NULL then NULL else b.device_id end),

> (case when b.sid is NULL then NULL else b.sid end)

> from playqos_action_detail a left join seek_pause_buffer_action b on a.sid=b.sid

> where a.curdate='20161101' and a.device_id='015163005010013'

> and b.curdate='20161101' and action='http://wenda.chinahadoop.cn/SeekAction';

OK

STAGE DEPENDENCIES:

Stage-1 is a root stage

Stage-0 depends on stages: Stage-1



STAGE PLANS:

Stage: Stage-1

Map Reduce

Map Operator Tree:

TableScan

alias: a

Statistics: Num rows: 3568808 Data size: 1137545459 Basic stats: COMPLETE Column stats: NONE

Filter Operator

predicate: ((device_id = '015163005010013') and sid is not null) (type: boolean)

Statistics: Num rows: 1784404 Data size: 568772729 Basic stats: COMPLETE Column stats: NONE

Select Operator

expressions: sid (type: string)

outputColumnNames: _col1

Statistics: Num rows: 1784404 Data size: 568772729 Basic stats: COMPLETE Column stats: NONE

Reduce Output Operator

key expressions: _col1 (type: string)

sort order: +

Map-reduce partition columns: _col1 (type: string)

Statistics: Num rows: 1784404 Data size: 568772729 Basic stats: COMPLETE Column stats: NONE

TableScan

alias: b

Statistics: Num rows: 1296952 Data size: 71839667 Basic stats: COMPLETE Column stats: NONE

Filter Operator

predicate: ((action = 'SeekAction') and sid is not null) (type: boolean)

Statistics: Num rows: 648476 Data size: 35919833 Basic stats: COMPLETE Column stats: NONE

Select Operator

expressions: device_id (type: string), sid (type: string)

outputColumnNames: _col0, _col1

Statistics: Num rows: 648476 Data size: 35919833 Basic stats: COMPLETE Column stats: NONE

Reduce Output Operator

key expressions: _col1 (type: string)

sort order: +

Map-reduce partition columns: _col1 (type: string)

Statistics: Num rows: 648476 Data size: 35919833 Basic stats: COMPLETE Column stats: NONE

value expressions: _col0 (type: string)

Reduce Operator Tree:

Join Operator

condition map:

Inner Join 0 to 1

keys:

0 _col1 (type: string)

1 _col1 (type: string)

outputColumnNames: _col1, _col3, _col4

Statistics: Num rows: 1962844 Data size: 625650015 Basic stats: COMPLETE Column stats: NONE

Select Operator

expressions: '015163005010013' (type: string), _col1 (type: string), CASE WHEN (_col3 is null) THEN (null) ELSE (_col3) END (type: string), CASE WHEN (_col4 is null) THEN (null) ELSE (_col4) END (type: string)

outputColumnNames: _col0, _col1, _col2, _col3

Statistics: Num rows: 1962844 Data size: 625650015 Basic stats: COMPLETE Column stats: NONE

File Output Operator

compressed: false

Statistics: Num rows: 1962844 Data size: 625650015 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: -1

Processor Tree:

ListSink



Time taken: 0.139 seconds, Fetched: 66 row(s)

hive>
已邀请:

要回复问题请先登录注册