我撰寫了以下 SQL:
select count(value) as total, name , window from `event`
where count(value) > 1 group by window(event_time,'2 minutes'),name
Spark給我以下錯誤:
nAggregate/Window/Generate expressions are not valid in where clause of the query.\nExpression in where clause: [(count(event.`value`) > CAST(1 AS BIGINT))]\nInvalid expressions: [count(event.`value`)]
什么是正確的語法?
uj5u.com熱心網友回復:
您需要HAVING改用(檔案),它應該放在后面GROUP BY:
select count(value) as total, name , window from `event`
group by window(event_time,'2 minutes'),name
having total > 1
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/434772.html
上一篇:如何告訴HTTP客戶端在哪里可以找到檔案的最新版本?
下一篇:加入2個不明確的SQL表
