-
Notifications
You must be signed in to change notification settings - Fork 592
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(over window): fix error in using aggregate function result as win… (
#12551) (#12720) Co-authored-by: jinser <[email protected]>
- Loading branch information
Showing
13 changed files
with
353 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
statement ok | ||
create table t (a int, b int, c int, d int, e int); | ||
|
||
statement ok | ||
insert into t values | ||
(1, 23, 84, 11, 87), | ||
(2, 34, 29, 22, 98), | ||
(3, 45, 43, 33, 10), | ||
(4, 56, 83, 44, 26), | ||
(5, 68, 20, 55, 12), | ||
(5, 68, 90, 66, 34), | ||
(5, 68, 11, 77, 32); | ||
|
||
query II | ||
select | ||
a, | ||
sum((sum(b))) over (partition by a order by a) | ||
from t | ||
group by a | ||
order by a; | ||
---- | ||
1 23 | ||
2 34 | ||
3 45 | ||
4 56 | ||
5 204 | ||
|
||
query II | ||
select | ||
a, | ||
row_number() over (partition by a order by a) | ||
from t | ||
group by a | ||
order by a; | ||
---- | ||
1 1 | ||
2 1 | ||
3 1 | ||
4 1 | ||
5 1 | ||
|
||
query II | ||
select | ||
a, | ||
row_number() over (partition by a order by a desc) | ||
from t | ||
group by a | ||
order by a; | ||
---- | ||
1 1 | ||
2 1 | ||
3 1 | ||
4 1 | ||
5 1 | ||
|
||
query III | ||
select | ||
a, | ||
b, | ||
sum(sum(c)) over (partition by a order by b) | ||
from t | ||
group by a, b | ||
order by a, b; | ||
---- | ||
1 23 84 | ||
2 34 29 | ||
3 45 43 | ||
4 56 83 | ||
5 68 121 | ||
|
||
query III | ||
select | ||
a, | ||
b, | ||
sum(sum(c)) over (partition by a, avg(d) order by max(e), b) | ||
from t | ||
group by a, b | ||
order by a, b; | ||
---- | ||
1 23 84 | ||
2 34 29 | ||
3 45 43 | ||
4 56 83 | ||
5 68 121 | ||
|
||
statement ok | ||
drop table t; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.