记录一下报错
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