Hive 查询 - 使用 OR 运算符在三个连接条件下连接两个表 [英] Hive Query- Joining two tables on three joining conditions with OR operator
问题描述
我遇到了错误
"FAILED: 语义分析错误:Line 1:101 OR not supported in JOIN current dob
"
在运行下面提到的查询时..
while running the below mentioned query..
Insert Overwrite Local Directory './Insurance_Risk/Merged_Data' Select f.name,s.age,f.gender,f.loc,f.marital_status,f.habits1,f.habits2,s.employement_status,s.occupation_class,s.occupation_subclass,s.occupation from sample_member_detail s Join fb_member_detail f
On s.email=f.email or
s.dob=f.dob
or (f.name=s.name and f.loc = s.loc and f.occupation=s.occupation)
where s.email is not null and f.email is not null;
谁能告诉我,在 hive 中是否可以使用OR
"运算符?如果不是,那么应该是什么查询,它会给出与上述查询给出的结果相同的结果.我有 2 个表,我想使用 or 运算符在三个条件中的任何一个条件下连接这两个表.请帮忙..
Can anyone tell me that, in hive "OR
" operator can be used or not?
if not, then what should be the query which will give the same result as given by the above mentioned query.
I have 2 tables and I want to join the two tables on any one of the three conditions with or operator.
Please help..
推荐答案
Sorry Hive 仅支持 equi-joins.您始终可以尝试从这些表的完整笛卡尔积中进行选择(您必须处于非严格模式):
Sorry Hive supports only equi-joins. You can always try select from full Cartesian product of those tables(you have to be in non-strict mode):
Select f.name,s.age,f.gender,f.loc,f.marital_status,f.habits1,f.habits2,s.employement_status,s.occupation_class,s.occupation_subclass,s.occupation
from sample_member_detail s join fb_member_detail f
where (s.email=f.email
or s.dob=f.dob
or (f.name=s.name and f.loc = s.loc and f.occupation=s.occupation))
and s.email is not null and f.email is not null;
这篇关于Hive 查询 - 使用 OR 运算符在三个连接条件下连接两个表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!