feat: Move subquery check from analyzer to PullUpCorrelatedExpr (Fix TPC-DS q41) #13091
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 #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
fromanalyzer 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.