查询:
SELECT DISTINCT seg from mytable ORDER BY 1 ASC
会产生
+-------+--+
| seg |
+-------+--+
| NONE |
| AFS |
+-------+--+
SELECT DISTINCT seg from mytable ORDER BY seg ASC
导致
+-------+--+
| seg |
+-------+--+
| AFS |
| NONE |
+-------+--+
是指Hive不支持的ORDER BY中的位置列?
答案 0 :(得分:0)
自Hive 0.11起支持按位置排序,但仅在Hive 2.2.0中支持默认打开。
https://cwiki.apache.org/confluence/display/Hive/Configuration+Properties
<强> hive.groupby.orderby.position.alias 强>
默认值:false
添加In:Hive 0.11.0 with HIVE-581
不推荐使用:Hive 2.2.0 with HIVE-15797
是否在GROUP BY和ORDER BY子句中启用列位置别名(从Hive 2.2.0开始不推荐使用;请改用hive.groupby.position.alias和hive.orderby.position.alias)。
<强> hive.orderby.position.alias 强>
默认值:true
添加In:Hive 2.2.0 with HIVE-15797
是否在ORDER BY中启用列位置别名。