Skip to content

feat: subqueries in Project#23039

Open
zyuiop wants to merge 2 commits into
apache:mainfrom
zyuiop:fix/project-subqueries
Open

feat: subqueries in Project#23039
zyuiop wants to merge 2 commits into
apache:mainfrom
zyuiop:fix/project-subqueries

Conversation

@zyuiop

@zyuiop zyuiop commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

What changes are included in this PR?

This contains two changes (which we can possibly split, I'll let reviewers judge).

  • decorrelate_predicate_subquery: if the plan is a Projection, we transform the sub-query into a Mark Join
  • refactor build_join_schema to use LogicalPlan as input: this is required because optimize_projections remove all fields from the TableScan in the mark join, which in turns makes it impossible for mark_field to determine the table reference to use for the mark field

Are these changes tested?

Yes

Are there any user-facing changes?

Yes, build_join_schema's signature has changed.

api change

zyuiop added 2 commits June 19, 2026 13:00
this fixes an issue where mark joins "lose" the qualifier after optimize_projections in EXISTS subqueries. Indeed, in EXISTS subqueries, we don't need any projected field, so optimize_projections remove them all, which makes it impossible for build_join_schema to know what qualifier to use for the mark field
@github-actions github-actions Bot added logical-expr Logical plan and expressions optimizer Optimizer rules labels Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

logical-expr Logical plan and expressions optimizer Optimizer rules

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Physical plan does not support logical expression Exists

1 participant