SemanticException [错误10128]:Hive / Hue中的UDAF“sum”尚不支持

时间:2017-10-26 17:53:56

标签: hive yarn hiveql hue

从这句话:

df.rolling(window=3, min_periods=1, win_type='hanning').sum()

   apple  oranges  pears
0    0.0      0.0    0.0
1    0.0      0.2    0.6
2    0.0      0.1    0.2
3    0.0      0.0    0.0
4    0.2      0.1    0.2

我收到以下错误:

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;

有没有其他方法可以选择数据总和?

1 个答案:

答案 0 :(得分:0)

您需要在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