比如左表关联键是string类型,右表关联键是bigint类型,关联后会出现多条的情况
解决方案:
关联键先统一转成string类型再进行关联
原因:
根据HIVE版本不同,数据位数上限不同,
低版本的超过16位会出现这种情况,高版本的超过19位会出现这种情况
以下为低版本HIVE数据测试情况:
select *
from (select '3618693946106075234' as str_ord -- 19位union allselect '361869394610607523' as str_ord -- 18位union allselect '36186939461060752' as str_ord -- 17位union allselect '3618693946106075' as str_ord -- 16位) a
join (select 3618693946106075234 as int_Ordunion all select 3618693946106075233 as int_Ordunion all select 361869394610607523 as int_Ordunion all select 361869394610607524 as int_Ordunion allselect 36186939461060752 as int_Ord -- 17位union allselect 36186939461060751 as int_Ord -- 17位union allselect 3618693946106075 as int_Ord -- 16位union allselect 3618693946106076 as int_Ord -- 16位) b
on a.str_ord = b.int_Ord