Skip to content
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

Fix optimizer regression with simplifying expressions in subquery filters #3764

Merged
merged 5 commits into from
Oct 10, 2022

Conversation

andygrove
Copy link
Member

@andygrove andygrove commented Oct 7, 2022

Which issue does this PR close?

Closes #3760

Rationale for this change

Fixes regression introduced in #3636 where we stopped running SimplifyExpressions a second time after converting subqueries to joins, meaning that we stopped simplifying expressions in subquery filters.

What changes are included in this PR?

Are there any user-facing changes?

@github-actions github-actions bot added the optimizer Optimizer rules label Oct 7, 2022
@github-actions github-actions bot added the core Core DataFusion crate label Oct 7, 2022
@andygrove andygrove marked this pull request as ready for review October 7, 2022 22:52
@andygrove andygrove changed the title WIP: Fix optimizer regression with simplifying expressions in subquery filters Fix optimizer regression with simplifying expressions in subquery filters Oct 7, 2022
@@ -144,6 +144,10 @@ impl Optimizer {
Arc::new(DecorrelateWhereIn::new()),
Arc::new(ScalarSubqueryToJoin::new()),
Arc::new(SubqueryFilterToJoin::new()),
// simplify expressions does not simplify expressions in subqueries, so we
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's a solution to resolve this.
But We also has a way to resolve this issue by supporting the subquery in the rewriter of simplify expression.
Why not support the subquery in the rewriter of simplify expression?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR just reverts the regression and adds a regression test, but I agree, would be better to handle it in simplify_expressions. I filed #3770 for this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree #3770 is a better long term solution

@liukun4515
Copy link
Contributor

LGTM thanks

@andygrove
Copy link
Member Author

Thanks for the review @liukun4515

@andygrove andygrove merged commit 8022827 into apache:master Oct 10, 2022
@andygrove andygrove deleted the fix-opt-regression branch October 10, 2022 19:58
@ursabot
Copy link

ursabot commented Oct 10, 2022

Benchmark runs are scheduled for baseline = e395e30 and contender = 8022827. 8022827 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ec2-t3-xlarge-us-east-2] ec2-t3-xlarge-us-east-2
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on test-mac-arm] test-mac-arm
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ursa-i9-9960x] ursa-i9-9960x
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ursa-thinkcentre-m75q] ursa-thinkcentre-m75q
Buildkite builds:
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core DataFusion crate optimizer Optimizer rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regression in simplifying expressions in subqueries
4 participants