采用同一代码:
with t1 as (
select '1' as time ,'a' as id ,'lyq' b
union
select null as time ,'a' as id ,'' b
)
select * from t1 order by time desc
1、hive执行结果:
2、impala执行结果:
结论:
hive与NULL比对,会将NULL看成最小,也就是desc会排在最后,asc会排在最前;
impala与NULL比对,会将NULL看成最大值,也就是desc排在最前,asc排在最后;