order by count(id) 报错
hive> select date, count(id) as idnum from test group by date order by count(id) FAILED:SemanticException[Error 10004]:...Invalid table alias or column reference 'id':(possible column names are:...)
修改为( 用别名idnum替换count(id) ),没有报错
hive> select date, count(id) as idnum from test group by date order by idnum
测试发现,在order by 中使用普通函数是可以的,但是不能使用聚合函数
hive> select to_date(time) as date, id from test order by to_date(time)
感觉很诡异,估计与运行顺序有关,如果各位大神知道原因,欢迎指导!