SemanticException [错误 10128]:Hive/Hue 中的 UDAF 'sum' 尚不支持的位置
SemanticException [Error 10128]: Not yet supported place for UDAF 'sum' in Hive/Hue
来自这句话:
SELECT a.comunity, sum(b.cont_woman),sum(b.cont_men)
FROM cont_per_comunity.states_per_comunities a
JOIN cont_per_comunity.cont_per_state b
ON a.state = b.state
WHERE sum(b.cont_woman) >= sum(b.cont_men)
GROUP BY a.comunity;
我收到以下错误:
Error occurred executing hive query: Error while compiling statement: FAILED: SemanticException [Error 10128]: Line 9:6 Not yet supported place for UDAF 'sum'
还有其他方法可以select数据的总和吗?
您需要在 having
子句或外部查询中执行此操作。您不能像您尝试的那样在 where 子句中使用聚合函数。
试试这个:
SELECT a.comunity, sum(b.cont_woman),sum(b.cont_men)
FROM cont_per_comunity.states_per_comunities a
JOIN cont_per_comunity.cont_per_state b
ON a.state = b.state
GROUP BY a.comunity
having sum(b.cont_woman) >= sum(b.cont_men)
或
select * from (
SELECT a.comunity, sum(b.cont_woman) as cont_woman
,sum(b.cont_men) as cont_men
FROM cont_per_comunity.states_per_comunities a
JOIN cont_per_comunity.cont_per_state b
ON a.state = b.state
GROUP BY a.comunity ) t
where cont_woman >= cont_men
来自这句话:
SELECT a.comunity, sum(b.cont_woman),sum(b.cont_men)
FROM cont_per_comunity.states_per_comunities a
JOIN cont_per_comunity.cont_per_state b
ON a.state = b.state
WHERE sum(b.cont_woman) >= sum(b.cont_men)
GROUP BY a.comunity;
我收到以下错误:
Error occurred executing hive query: Error while compiling statement: FAILED: SemanticException [Error 10128]: Line 9:6 Not yet supported place for UDAF 'sum'
还有其他方法可以select数据的总和吗?
您需要在 having
子句或外部查询中执行此操作。您不能像您尝试的那样在 where 子句中使用聚合函数。
试试这个:
SELECT a.comunity, sum(b.cont_woman),sum(b.cont_men)
FROM cont_per_comunity.states_per_comunities a
JOIN cont_per_comunity.cont_per_state b
ON a.state = b.state
GROUP BY a.comunity
having sum(b.cont_woman) >= sum(b.cont_men)
或
select * from (
SELECT a.comunity, sum(b.cont_woman) as cont_woman
,sum(b.cont_men) as cont_men
FROM cont_per_comunity.states_per_comunities a
JOIN cont_per_comunity.cont_per_state b
ON a.state = b.state
GROUP BY a.comunity ) t
where cont_woman >= cont_men