美文网首页
大数据开发之Hive案例篇9-Not yet supported

大数据开发之Hive案例篇9-Not yet supported

作者: 只是甲 | 来源:发表于2023-06-04 10:34 被阅读0次

一. 问题描述

一个很简单的group by和count(*) 操作,然后居然报错了

hive> SELECT col1,
    >        count(*) as cnt
    > from  table_name
    > group by col1
    > order by count(*) desc
    > ;
FAILED: SemanticException [Error 10128]: Line 5:9 Not yet supported place for UDAF 'count'
hive> 

二. 解决方案

大概是在Oracle MySQL上写SQL写习惯了,以为可以这么写。
出了问题也是不知道从何排查

后面把order by子句注释掉之后,居然就可以了,那么就是order by 后面不能跟聚合函数了
于是使用了聚合函数的别名,问题搞定

修改为如下:

hive> SELECT col1,
    >        count(*) as cnt
    > from  table_name
    > group by col1
    > order by cnt desc
    > ;

相关文章

网友评论

      本文标题:大数据开发之Hive案例篇9-Not yet supported

      本文链接:https://www.haomeiwen.com/subject/qqgsedtx.html