hive在表关联时尽量避免隐式转化,可以使用cast强转,下面例子中tableA表的order_no是bigint类型,tableB的order_no是string类型
select
a.order_no,
c.order_no as c_order_no,
a.order_no=c.order_no
from tableA a
left join tableB b
on a.order_no=b.order_no
left join
(select
t1.order_no
from tableA t1
join tableB t2
on t1.order_no=t2.order_no
) c
on a.order_no=c.order_no
where a.order_no=81268102217186906;
±-------------------±-------------------±-------+
| a.order_no | c_order_no | _c5 |
±-------------------±-------------------±-------+
| 81268102217186906 | 81268102217186920 | false |
| 81268102217186906 | 81268102217186906 | true |
±-------------------±-------------------±-------+
出现错误