2

如果有人知道这里的问题是什么?我在 Hive 中运行它

 select * from a left join b
 on a.id=b.id and a.date between b.start_dte and b.end_dte  

编译语句时出错:FAILED: SemanticException line 0:undefined:-1 在 JOIN 'end_dte' 中遇到左右别名

4

1 回答 1

2

Hive 不支持非 equi 连接。

尝试将 b.start_dte 和 b.end_dte 之间的 a.date 移动到 WHERE 子句:

 select * from a left join b on a.id=b.id 
  where (a.date between b.start_dte and b.end_dte) or b.id is null

or b.id is null是允许未加入的记录(左加入)

于 2022-01-11T13:05:01.770 回答