-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Deprecate PhysicalSortRequirement::from_sort_exprs and PhysicalSortRequirement::to_sort_exprs
#13222
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
Conversation
…tRequirement::to_sort_exprs`
50ded20 to
79278f8
Compare
| vec![Some(PhysicalSortRequirement::from_sort_exprs( | ||
| self.expr.iter(), | ||
| ))] | ||
| vec![Some(LexRequirement::from(self.expr.clone()))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a pretty good example of the potential improvement -- it is now clear this function is returning a LexRequirement and that it clones the underlying LexOrdering structure
This was still happening on main but the conversion was hidden
| shift_right_required(parent_required, right_offset)?; | ||
| let new_right_required_expr = | ||
| PhysicalSortRequirement::to_sort_exprs(new_right_required); | ||
| let new_right_required_expr = LexOrdering::from(new_right_required); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this structure makes it much clearer what is going on
| // sort and already satisfied by the given ordering | ||
| let child_eq_properties = child.equivalence_properties(); | ||
| let sort_req = PhysicalSortRequirement::from_sort_exprs(sort_plan.expr()); | ||
| let sort_req = LexRequirement::from(sort_plan.expr().clone()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, there is no more cloning going on than previously, just now the clone is explicit
berkaysynnada
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, the code is clearly improving. Thank you @alamb.
|
Thank you for the review @berkaysynnada |
Which issue does this PR close?
Part of #12591
Rationale for this change
Before
LexOrderingandLexRequirementwere actual structs (thanks to @ngli-me and @berkaysynnada on #13146!!!), we couldn't put the conversion betweenLexOrderingandLexRequirementon to the actual structures and thus the conversion is done via free functions onPhysicalSortRequirementsThis is confusing for several reasons:
Fromconversion they aren't there)This structure bothered me for a long time, so it is time to scratch an itch now that @ngli-me started the ball rolling
What changes are included in this PR?
PhysicalSortRequirement::from_sort_exprsandPhysicalSortRequirement::to_sort_exprsLexOrdering::from_lex_requirementandLexOrdering::from_lex_orderingandFromimplsAre these changes tested?
By existint CI
Are there any user-facing changes?
SOme methods are deprecated with hints about what to use instead