Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add new sql test "partition by combined with rank" #772

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion test/sql/p3.20-window-function.slt
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,37 @@ select sum(v2) over (partition by v1 order by v2), sum(v2) over (order by v2) fr
300 300
600 600
400 1000
900 1500
900 1500

# Create table t3
statement ok
create table t3(v1 int, v2 int);

# Insert something
query
insert into t3 values (2, 3), (3, 2), (1, 2), (3, 1), (3, 1), (2, 2), (1, 1),(1, 3), (3, 1), (2, 1), (3, 1), (1, 1);
----
12

# partition by combined with rank
query rank_partition
select *
from (
select v1, v2, rank() OVER (PARTITION BY v1 ORDER BY v2) AS rank
FROM t3
) as subquery
order by v1, rank;
----
1 1 1
1 1 1
1 2 3
1 3 4
2 1 1
2 2 2
2 3 3
3 1 1
3 1 1
3 1 1
3 1 1
3 2 5

Loading