hive低版本不支持on条件不等连接

记录一下报错

oracle库中有张拉链表前闭后开,抽到hive后使用过程中执行以下sql报错

错误信息:Error while compiling statement: FAILED: SemanticException [Error 10017]: line 4:3 Both left and right aliases encountered in JOIN 'sk_date'

select t1.col
from table1 t1
left join table2 t2
on t1.effective_from <= t2.sk_date
on t1.effective_from > t2.sk_date
and t2.sk_date between 20241101 and 20241120

询问度娘后得知hive低版本不支持不等连接,改为笛卡尔积关联,将不等式条件放在where条件中成功执行,使用笛卡尔积关联请注意表的数据量,如果数据量非常大时效率较低,请另寻他法或者做好长时间等待的准备。

select t1.col
from table1 t1
,table2 t2
where t1.effective_from <= t2.sk_date
on t1.effective_from > t2.sk_date
and t2.sk_date between 20241101 and 20241120

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值