Skip to content

[CALCITE-7401] Multi-level correlated subqueries cause an out-of-range error in the TopDownGeneralDecorrelator#4777

Merged
silundong merged 1 commit intoapache:mainfrom
silundong:issue-7401
Jan 29, 2026
Merged

[CALCITE-7401] Multi-level correlated subqueries cause an out-of-range error in the TopDownGeneralDecorrelator#4777
silundong merged 1 commit intoapache:mainfrom
silundong:issue-7401

Conversation

@silundong
Copy link
Contributor

CALCITE-7401
The root cause of this issue is that the TopDownGeneralDecorrelator uses a HepPlanner which noDag is FALSE during the preprocessing phase before decorrelation, which causes equivalent nodes to share the same object. In scenarios with nested correlations, equivalent nodes at different nesting levels bind to different outer variables and therefore have different decorrelation information (UnnestedQuery). Since these nodes share the same object, this leads to corrupted records in mapRelToUnnestedQuery.

CoreRules.FILTER_CORRELATE))
.build();
HepPlanner prePlanner = new HepPlanner(preProgram);
HepPlanner prePlanner =
Copy link
Contributor

Choose a reason for hiding this comment

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

this deserves a comment about the DAG stuff; the PR description would be fine here.

@silundong silundong requested a review from mihaibudiu January 29, 2026 01:05
@sonarqubecloud
Copy link

@silundong silundong merged commit 2029412 into apache:main Jan 29, 2026
20 checks passed
@silundong silundong deleted the issue-7401 branch February 9, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants