Hive Joining tables using bigint key give wrong result

Viewed 24

I'm joining one table with a view in Hive using "key" variable which is of bigint data type but getting wrong result.

Below is my query

select t1.key,t2.key,stcd,zpcd,
(case
when t1.key=t2.key then 'equal'
else 'not_equal'
end) as key_comparision,
from
(select stcd,zpcd,key,release,tm_series_dt 
from level2.final
where key = '7668810213909968440')
as t1
left join 
level2.fincl_view as t2
on t1.key=t2.key;

'''

And getting the below results

enter image description here

Could Anyone please help me to explain why it's picking the wrong record and equating both keys as equal.

Ideally it should give only 1st row as a result but it's giving me two records.

Could anyone please help me to resolve this ?

1 Answers

t2.key can't equal 7688***680

Because, table t1 returns only 768***440 result

t1 left join t2 only get result table t1, so only result 768***440 appears.

More clear, let's send info ddl.

Related