Repository navigation
Ordering satisfy consider ordering equivalence of different lengths - #6330
Merged
Merged
Conversation
Contributor
|
This PR also includes some drive-by cleanups in the adjacent code in |
mustafasrepo
approved these changes
May 11, 2023
mustafasrepo
left a comment
Contributor
There was a problem hiding this comment.
I have reviewed this PR (in our internal review process). It is LGTM!. We welcome community feedback, I will leave it open a little while. In case community has feedback
alamb
reviewed
May 12, 2023
alamb
left a comment
Contributor
There was a problem hiding this comment.
Thank you @berkaysynnada and @mustafasrepo -- I skimmed the code and reviewed the test changes. 👍
| statement error DataFusion error: Error during planning: Invalid window frame: frame offsets must be non negative integers | ||
| select row_number() over (rows between current row and -1 following) from (select 1 a) x | ||
|
|
||
| # This test shows that ordering satisfy considers ordering equivalences, |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Closes #6280.
Rationale for this change
ordering_satisfy_concrete()function first checks whether the required PhysicalSortExpr's length is greater than provided PhysicalSortExpr's length. If so, it directly returns false. However, there may be cases such as:Provided: (a)
Required: (a,b) ,but a and b are in an equivalent class.
In that case, an unnecessary sort is added. We can remove it by changing the implementation of
ordering_satisfy_concrete().What changes are included in this PR?
Required PhysicalSortExpr's are normalized, and simplified to have unique elements. Provided PhysicalSortExpr's are also normalized before the comparison of expressions. The length check is moved to the final, after the normalization and compression steps.
Additionally, there have been a few cleanups and silent bug fixes related to ordering equivalences.
Are these changes tested?
Yes, both in utils.rs and window.slt.
Are there any user-facing changes?