hive查询SQL报错,
怎么办,通过分析是在where语句当中使用了 count聚合函数,我们的目的筛选出数量大于2的。
Error while compiling statement: FAILED: SemanticException [Error 10128]: Line 14:8 Not yet supported place for UDAF 'count'
报错代码如下:
SELECT
user_id
,count(distinct order_id)
FROM order
WHERE create_date BETWEEN date_sub(CURRENT_DATE(),7)
AND date_sub(CURRENT_DATE(),1)
Group by 1
having count(distinct order_id)>1
这样就没问题了。同时group by 和having 顺序不能调换,先后是固定的。
文章讨论了在Hive查询中遇到的错误,涉及COUNT聚合函数在WHERE子句的使用限制。解决方案是将COUNT(distinctorder_id)放在GROUPBY之后,HAVING子句之前,并确保筛选数量大于2的订单。
4775





