gpt4 book ai didi

Hive 查询 - 使用 OR 运算符在三个连接条件下连接两个表

转载 作者:行者123 更新时间:2023-12-04 01:57:03 28 4
gpt4 key购买 nike

我正面临一个错误

"FAILED: Error in semantic analysis: Line 1:101 OR not supported in JOIN currently dob"

在运行下面提到的查询时..

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 运算符在三个条件中的任何一个条件下连接这两个表。
请帮忙..

最佳答案

抱歉,Hive 仅支持 equi-joins。您始终可以尝试从这些表的完整笛卡尔积中进行选择(您必须处于非严格模式):

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 运算符在三个连接条件下连接两个表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16272804/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com