Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,8 @@ && child(0).child(0) instanceof LogicalPartitionTopN)) {
if (curPartitionLimit < chosenRowNumberPartitionLimit) {
chosenRowNumberPartitionLimit = curPartitionLimit;
chosenWindowFunc = windowFunc;
hasRowNumber = true;
}
hasRowNumber = true;
} else if (!hasRowNumber) {
// if no row_number, choose the one with minimal limit value
if (curPartitionLimit < chosenPartitionLimit) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,20 @@ suite("push_down_multi_filter_through_window") {
contains "partition limit: 10"
}

explain {
sql ("select * from (select rank() over(partition by c1 order by c3) as rk, row_number() over(partition by c1, c2 order by c3) as rn from push_down_multi_predicate_through_window_t) t where rk <= 1;")
contains "VPartitionTopN"
contains "functions: rank"
contains "partition limit: 1"
}

explain {
sql ("select * from (select rank() over(partition by c1 order by c3) as rk, row_number() over(partition by c1, c2 order by c3) as rn from push_down_multi_predicate_through_window_t) t where rn <= 10;")
contains "VPartitionTopN"
contains "functions: row_number"
contains "partition limit: 10"
}

explain {
sql ("select * from (select rank() over(partition by c1 order by c3) as rk, rank() over(partition by c1, c2 order by c3) as rn from push_down_multi_predicate_through_window_t) t where rn <= 1 and rk <= 10;")
contains "VPartitionTopN"
Expand Down