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

feat: Move subquery check from analyzer to PullUpCorrelatedExpr (Fix TPC-DS q41) #13091

Merged
merged 1 commit into from
Oct 25, 2024

Conversation

eejbyfeldt
Copy link
Contributor

Which issue does this PR close?

Closes #13074.

Rationale for this change

The goal here is to support TPC-DS q41 which has an expression that can
not be pull up until it has been simplified by SimplifyExpressions. This
means that currently we reject the query already in the analyzer. But
after this change we are able to plan that query.

What changes are included in this PR?

This patch moves subquery check can_pull_over_aggregation from
analyzer into the PullUpCorrelatedExpr. Instead of failing the query we
will now instead do not decorrelate such queries and then fail during
physical plan creation.

Are these changes tested?

Yes, existing tests.

Are there any user-facing changes?

Yes, errors for certains subqueries might change from failed analyzer to failed to create physical plan.

@github-actions github-actions bot added optimizer Optimizer rules core Core DataFusion crate sqllogictest SQL Logic Tests (.slt) labels Oct 24, 2024
This patch moves subquery check `can_pull_over_aggregation` from
analyzer into the PullUpCorrelatedExpr. Instead of failing the query we
will no instead not decorrelate such queries and then fail during
physical plan creation.

The goal here is to support TPC-DS q41 which has an expression that can
not be pull up until it has been simplified by SimplifyExpressions. This
means that currently we reject the query already in the analyzer. But
after this change we are able to plan that query.
@eejbyfeldt eejbyfeldt force-pushed the i-13074-support-tpc-ds-q41 branch from 4a345f3 to 980c5a1 Compare October 24, 2024 17:33
@eejbyfeldt eejbyfeldt marked this pull request as ready for review October 24, 2024 18:26
Copy link
Contributor

@Dandandan Dandandan left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@alamb
Copy link
Contributor

alamb commented Oct 25, 2024

🚀

@alamb alamb merged commit 813220d into apache:main Oct 25, 2024
24 checks passed
@alamb
Copy link
Contributor

alamb commented Oct 25, 2024

Thank you @eejbyfeldt and @Dandandan

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 sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support planning of TPC-DS query 41
3 participants