Skip to content

[SPARK-51885][SQL] Change AnalysisContext.outerPlan from Option[LogicalPlan] to Seq[LogicalPlan] #51274

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AveryQi115
Copy link
Contributor

What changes were proposed in this pull request?

This pr only contains non-functional change.

  • Change AnalysisContext.outerPlan definition from Option[LogicalPlan] to Seq[LogicalPlan]
  • Change usage of AnalysisContext.outerPlan in ResolveSubquery and resolveOuterRef to get the headOption of the Sequence.

Why are the changes needed?

This is the necessary definition change for supporting resolving nested correlated subqueries.

The outerPlan currently stores the direct outer plan only so it can be defined as Option[LogicalPlan].

For supporting resolving nested correlated subqueries, it should store all the outer plans as a sequence of outerPlans, and the resolver/ColumnResolutionHelper should search the attribute from the inner most scope to the outer most scope.

Does this PR introduce any user-facing change?

No, this pr only contains non-functional change.

How was this patch tested?

No additional tests needed as this pr only contains non-functional change.

Was this patch authored or co-authored using generative AI tooling?

No

@github-actions github-actions bot added the SQL label Jun 24, 2025
@AveryQi115
Copy link
Contributor Author

request @vladimirg-db for review, thanks

Copy link
Contributor

@allisonwang-db allisonwang-db left a comment

Choose a reason for hiding this comment

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

Nice! Nested subqueries are finally getting supported!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants