基于Hive 2.1.x
首先直接做关联,查看执行计划
explain
select
count(1)
from student t1 inner join student t2
on t1.id = t2.id and t2.name = 'shanghai'
where
t1.city = 'beijing';
1 STAGE DEPENDENCIES:
2 Stage-5 is a root stage
3 Stage-2 depends on stages: Stage-5
4 Stage-0 depends on stages: Stage-2
5
6 STAGE PLANS:
7 Stage: Stage-5
8 Map Reduce Local Work
9 Alias -> Map Local Tables:
10 t1
11 Fetch Operator
12 limit: -1
13 Alias -> Map Local Operator Tree:
14 t1
15 TableScan
16 alias: t1
17 filterExpr: (id is not null and (city = 'beijing')) (type: boolean)
18 Statistics: Num rows: 3 Data size: 9 Basic stats: COMPLETE Column stats: NONE
19 Filter Operator
20