datos - left semi join hive
Hive Query: unión de dos tablas en tres condiciones de unión con el operador OR (2)
Sorry Hive solo admite equi-join. Siempre puede intentar seleccionar entre producto cartesiano completo de esas tablas (debe estar en modo no estricto):
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;
Estoy enfrentando un error
" FAILED: Error in semantic analysis: Line 1:101 OR not supported in JOIN currently dob
"
mientras ejecuta la consulta mencionada a continuación ..
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;
¿Alguien puede decirme que, en la colmena " OR
" el operador puede ser utilizado o no? si no, entonces ¿cuál debería ser la consulta que dará el mismo resultado que la consulta mencionada anteriormente? Tengo 2 tablas y quiero unirme a las dos tablas en cualquiera de las tres condiciones con o operador. Por favor ayuda..
También podría usar UNION para obtener los mismos resultados:
INSERT OVERWRITE LOCAL DIRECTORY ''./Insurance_Risk/Merged_Data''
-- You can only UNION on subqueries
SELECT * FROM (
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
WHERE s.email IS NOT NULL AND f.email IS NOT NULL;
UNION
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.dob=f.dob
WHERE s.email IS NOT NULL AND f.email IS NOT NULL;
UNION
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 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;
) subquery;