-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Do not push down Sorts if it violates the sort requirements #11678
Conversation
@@ -176,6 +176,7 @@ fn pushdown_requirement_to_children( | |||
|| plan.as_any().is::<ProjectionExec>() | |||
|| is_limit(plan) | |||
|| plan.as_any().is::<HashJoinExec>() | |||
|| pushdown_would_violate_requirements(parent_required, plan.as_ref()) |
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.
In general it would be great to avoid these explicit checks for types over time in favor of functions on the ExecutionPlan nodes
37b3b87
to
c0d08d2
Compare
let plan = sort_exec(sort_exprs_b, plan); | ||
|
||
let expected_input = [ | ||
"SortExec: expr=[b@1 ASC], preserve_partitioning=[false]", |
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 test fails on main -- specifically the SortExec is pushed below the RequiredInputOrderingExec so its input is sorted on b
which violates its input requirements that it is sorted on a
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.
LGTM!. thanks @alamb for this fix.
Thank you for the review @mustafasrepo |
…1678) * Do not push down Sorts if it violates the sort requirements * Test for pushing through orders
Which issue does this PR close?
Closes #11675
Closes #11493
Rationale for this change
See #11675 -- the PushDown sort optimizer was incorrectly pushing down sorts in certain cases
This change fixes a problem we were seeing in our tests downstream in influxdb iox
What changes are included in this PR?
Are these changes tested?
Yes, new unit tests are added
Are there any user-facing changes?
Bug fix