-
Notifications
You must be signed in to change notification settings - Fork 8.3k
SUM(col) / SUM(SUM(col)) OVER (PARTITION BY col2) aggregate function over WINDOW is not supported. #19857
Copy link
Copy link
Closed
Labels
comp-window-functionsWindow function execution + frame handling (ROW_NUMBER/RANK/LAG/LEAD, frames, partitions, order).Window function execution + frame handling (ROW_NUMBER/RANK/LAG/LEAD, frames, partitions, order).unfinished code
Description
How to reproduce
SELECT sum(number) / sum(sum(number)) OVER (PARTITION BY (number % 10))
FROM numbers(10000)
GROUP BY number % 10
Query id: 76ed1093-b378-45c2-b644-1de44783734a
0 rows in set. Elapsed: 0.003 sec.
Received exception from server (version 21.2.1):
Code: 47. DB::Exception: Received from localhost:9000. DB::Exception: Unknown identifier: sum(sum(number)) OVER (PARTITION BY number % 10) there are columns: modulo(number, 10), sum(number): While processing sum(number) / sum(sum(number)) OVER (PARTITION BY (number % 10)).
postgres=# SELECT sum(generate_series) / sum(sum(generate_series)) OVER (PARTITION BY (generate_series % 10)) FROM generate_series(0,10000) GROUP BY generate_series % 10;
?column?
------------------------
1.00000000000000000000
1.00000000000000000000
1.00000000000000000000
1.00000000000000000000
1.00000000000000000000
1.00000000000000000000
1.00000000000000000000
1.00000000000000000000
1.00000000000000000000
1.00000000000000000000
(10 rows)
**Expected behavior**
Query works
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
comp-window-functionsWindow function execution + frame handling (ROW_NUMBER/RANK/LAG/LEAD, frames, partitions, order).Window function execution + frame handling (ROW_NUMBER/RANK/LAG/LEAD, frames, partitions, order).unfinished code