impala、HIVE、Mysql排序字段中含有null
如果升序排序的字段中含有null,null被排在什么位置,要不然最前,要不然最后。
我测试了几个数据库
mysql和hive中null都是在最前
impala中null是在最后
测试代码
SELECT *
FROM
(
SELECT 1 as field1,'zhang' as field2
union
SELECT 2 as field1,'wang' as field2
union
SELECT 3 as field1,'li' as field2
union
SELECT 4 as field1,'zhao' as field2
union
SELECT null as field1,'wu' as field2
) a
ORDER BY field1
留言
張貼留言