Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #58762 from ClickHouse/backport/23.11/58739
Backport #58739 to 23.11: Fix stream partitioning in parallel window functions
- Loading branch information
Showing
4 changed files
with
69 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
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
18 changes: 18 additions & 0 deletions
18
tests/queries/0_stateless/02962_parallel_window_functions_different_partitioning.reference
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,18 @@ | ||
sales 15000 | ||
sales 15000 | ||
sales 15000 | ||
sales 29400 | ||
sales 29400 | ||
sales 29400 | ||
sales 43800 | ||
sales 43800 | ||
sales 43800 | ||
sales 15000 5000 | ||
sales 15000 5000 | ||
sales 15000 5000 | ||
sales 29400 4800 | ||
sales 29400 4800 | ||
sales 29400 4800 | ||
sales 43800 4800 | ||
sales 43800 4800 | ||
sales 43800 4800 |
32 changes: 32 additions & 0 deletions
32
tests/queries/0_stateless/02962_parallel_window_functions_different_partitioning.sql
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,32 @@ | ||
CREATE TABLE empsalary | ||
( | ||
`depname` LowCardinality(String), | ||
`empno` UInt64, | ||
`salary` Int32, | ||
`enroll_date` Date | ||
) | ||
ENGINE = Memory; | ||
|
||
insert into empsalary values ('sales',3,4800,'2007-08-01'), ('sales',1,5000,'2006-10-01'), ('sales',4,4800,'2007-08-08'); | ||
|
||
|
||
insert into empsalary values ('sales',3,4800,'2007-08-01'), ('sales',1,5000,'2006-10-01'), ('sales',4,4800,'2007-08-08'); | ||
|
||
insert into empsalary values ('sales',3,4800,'2007-08-01'), ('sales',1,5000,'2006-10-01'), ('sales',4,4800,'2007-08-08'); | ||
|
||
-- 1 window function | ||
|
||
SELECT depname, | ||
sum(salary) OVER (PARTITION BY depname order by empno) AS depsalary | ||
FROM empsalary | ||
order by depsalary; | ||
|
||
|
||
-- 2 window functions with different window, | ||
-- but result should be the same for depsalary | ||
|
||
SELECT depname, | ||
sum(salary) OVER (PARTITION BY depname order by empno) AS depsalary, | ||
min(salary) OVER (PARTITION BY depname, empno order by enroll_date) AS depminsalary | ||
FROM empsalary | ||
order by depsalary; |