大数据技术架构(组件)7——Hive:Filter PushDown Cases And Outer Join Behavior
创始人
2024-05-17 08:36:07
0

1.2、Filter PushDown Cases And Outer Join Behavior

前提:关闭优化器

set hive.auto.convertjoin=false;
set hive.cbo.enable=false;

Inner Join:

1、Join On中的谓词: 左表下推、右表下推

2、Where谓词:左表下推、右表下推

-- 第一种情况: join on 谓词
selectt1.user_id,t2.user_id
from wedw_tmp.tmp_test 1 t1
join wedw_tmp.tmp_test 2 t2
on tl.user_id = t2.user_idand tl.user_id='111' and t2.user_id='222'-- 第二种情况: where谓词
selectt1.user_id,t2.user_id
from wedw_tmp.tmp_test_1 t1
join wedw_tmp.tmp_test_2 t2
on tl.user_id = t2.user_id
where t1.user_id='111' and t2.user_id='222'

Left join:

1、Join On中的谓词: 左表不下推、右表下推(前提:关闭mapjoin优化)

2、Where谓词:左表下推、右表下推

-- 第一种情况: join on 谓词
selectt1.user_id,t2.user_id
from wedw_tmp.tmp_test_1 t1
left join wedw tmp.tmp_test_2 t2
on tl.user_id = t2.user_id and tl.user_id='111' and t2.user_id='222'-- 第二种情况: where谓词
selectt1.user_id,t2.user_id
from wedw_tmp.tmp_test_1 t1
left join wedw_tmp.tmp_test 2 t2
on tl.user_id = t2.user_id
where t1.user_id='111' and t2.user_id='222'

Right Join:

1、Join On中的谓词: 左表下推、右表不下推(前提:关闭mapjoin优化)

2、Where谓词:左表下推、右表下

-- 第一种情况: join on 谓词
selectt1.user_id,t2.user_id
from wedw_tmp.tmp_test_1 t1
right join wedw_tmp.tmp_test_2 t2
on t1.user_id = t2.user_id and t1.user_id='111' and t2.user_id='222'--第二种情况: where谓词
selectt1.user_id,t2.user_id
from wedw_tmp.tmp_test_1 t1
right join wedw_tmp.tmp_test_2 t2on t1.user_id = t2.user_id
where t1.user_id='111' and t2.user_id='222'

Full Join:

1、Join On中的谓词: 左表不下推、右表不下推(前提:关闭mapjoin优化)

2、Where谓词:左表不下推、右表不下推

-- 第一种情况: join on 谓词
selectt1.user_id,t2.user id
from wedw_tmp.tmp_test_1 t1
full join wedw_tmp.tmp_test 2 t2on t1.user_id = t2.user_id and tl.user_id='111' and t2.user_id='222'-- 第二种情况: where谓词
selectt1.user_id,t2.user_id
from wedw_tmp.tmp_test_1 t1
full join wedw_tmp.tmp_test_2 t2
on t1.user_id = t2 .user_id
where tl.user_id='111' and t2.user_id='222'

总结:

相关内容

热门资讯

监控摄像头接入GB28181平... 流程简介将监控摄像头的视频在网站和APP中直播,要解决的几个问题是:1&...
Windows10添加群晖磁盘... 在使用群晖NAS时,我们需要通过本地映射的方式把NAS映射成本地的一块磁盘使用。 通过...
protocol buffer... 目录 目录 什么是protocol buffer 1.protobuf 1.1安装  1.2使用...
在Word、WPS中插入AxM... 引言 我最近需要写一些文章,在排版时发现AxMath插入的公式竟然会导致行间距异常&#...
【PdgCntEditor】解... 一、问题背景 大部分的图书对应的PDF,目录中的页码并非PDF中直接索引的页码...
Fluent中创建监测点 1 概述某些仿真问题,需要创建监测点,用于获取空间定点的数据࿰...
educoder数据结构与算法...                                                   ...
MySQL下载和安装(Wind... 前言:刚换了一台电脑,里面所有东西都需要重新配置,习惯了所...
修复 爱普生 EPSON L4... L4151 L4153 L4156 L4158 L4163 L4165 L4166 L4168 L4...
MFC文件操作  MFC提供了一个文件操作的基类CFile,这个类提供了一个没有缓存的二进制格式的磁盘...