feat(optimizer): Native TopNRank optimization#24138
Conversation
b45c503 to
ff8a3b5
Compare
BryanCutler
left a comment
There was a problem hiding this comment.
LGTM just a couple questions
| @JsonProperty("rankingType") RankingFunction rankingFunction, | ||
| @JsonProperty("rowNumberVariable") VariableReferenceExpression rowNumberVariable, | ||
| @JsonProperty("maxRowCountPerPartition") int maxRowCountPerPartition, | ||
| @JsonProperty("maxRowCountPerPartition") int maxRankPerPartition, |
There was a problem hiding this comment.
Should the json property be changed too or is that not possible without breaking compat?
| // Write config file | ||
| String configProperties = format("discovery.uri=%s%n" + | ||
| "presto.version=testversion%n" + | ||
| "native-execution-enabled=true" + |
There was a problem hiding this comment.
does this need a %n? I'm guessing that's to give it a newline but not sure
|
Thank you for the release note! Some nits of phrasing and formatting suggestions. |
a63a0e9 to
2118f4c
Compare
|
One more nit about the release note entry: we've automated the link to the PR so you don't have to add it manually anymore. |
35f18b2 to
4b96592
Compare
Summary: Design doc : https://docs.google.com/document/d/1WQfNigR9bVrbM-PqY7F0mswcetN_tdNahzD9ENye-Q0/edit?usp=sharing https://github.com/facebookincubator/velox/discussions/9404 e2e Presto PR (with changes in the Presto optimizer as well) prestodb/presto#24138 Latency for SF1K TPC-DS Q67 fell from 399s to 146s with this change. Pull Request resolved: #14141 Reviewed By: pratikpugalia Differential Revision: D85763891 Pulled By: kevinwilfong fbshipit-source-id: 122bc6d60a4cfbf90c7921ebb1df28ef6edcc0a0
|
Hi! it looks this is ready to merge, just missing one failing check, is that right? if that's the case could you re-run it? it looks this feature can make a significant improvement and it would be great to merge it soon :) |
|
Hmm - looks like we already have: optimize_top_n_row_number that does it in the plan? What is this for? |
Hi @psantos-denodo : I have one failure to debug and will prioritize submitting this change. |
@kaikalur : optimize_top_n_row_number was only for queries with row_number. This PR added support for rank and dense_rank window functions pushdown in that same operator. This had Velox runtime code changes as well. The Velox team wanted to disable the optimization by default (optimize_top_n_row_number is true) and so I added a new config for it. |
|
Codenotify: Notifying subscribers in CODENOTIFY files for diff fc589a5...a43be71. No notifications. |
hantangwangd
left a comment
There was a problem hiding this comment.
Thanks @aditi-pandit, a couple of little nits.
...n-base/src/main/java/com/facebook/presto/sql/planner/optimizations/WindowFilterPushDown.java
Outdated
Show resolved
Hide resolved
3660237 to
6303d65
Compare
|
Submit only after facebookincubator/velox#16190 is updated in Velox submodule. |
Hi @psantos-denodo : I have debugged the failure and have the fix in facebookincubator/velox#16190. We can submit this PR after that one is merged in Velox and the module updated. |
That's great news, thanks for sharing! |
|
@hantangwangd @aaneja @tdcmeehan : This PR is finally clean. Would be great to have a round of review. Really appreciate the help. |
hantangwangd
left a comment
There was a problem hiding this comment.
Thanks @aditi-pandit, lgtm!
|
Thanks @hantangwangd for all the detailed reviews. |
## Description https://docs.google.com/document/d/1WQfNigR9bVrbM-PqY7F0mswcetN_tdNahzD9ENye-Q0/edit?tab=t.0 ## Motivation and Context TPC-DS Q67 ``` == RELEASE NOTES == General Changes * Add Window filter pushdown in native engine for rank and dense_rank functions. Use session property `optimizer.optimize-top-n-rank` to enable the rewrite. ```
Description
https://docs.google.com/document/d/1WQfNigR9bVrbM-PqY7F0mswcetN_tdNahzD9ENye-Q0/edit?tab=t.0
Motivation and Context
TPC-DS Q67