Skip to content

[CALCITE-4592] RelToSqlConverter#visit(Join e) does not populate correlation context - #5317

Open
xuzifu666 wants to merge 1 commit into
apache:mainfrom
xuzifu666:calcite-4592
Open

xuzifu666 wants to merge 1 commit into
apache:mainfrom
xuzifu666:calcite-4592

Conversation

@xuzifu666

Copy link
Copy Markdown
Member

jira: https://issues.apache.org/jira/browse/CALCITE-4592

This issue should had been fixed, so I only add test case to cover it.

.ok(expected);
}

/** Test case for

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this is not the example given in the Jira issue, so it's a bit tricky to figure out that the issue is indeed fixed.
Did you check that the current test case fails on 1.26 for example?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thank you for the reminder.
I verified the failure on 1.26 directly, would error out with NPE:

Exception in thread "main" java.lang.NullPointerException: Cannot invoke
"org.apache.calcite.rel.rel2sql.SqlImplementor$Context.field(int)"
because "correlAliasContext" is null
  at org.apache.calcite.rel.rel2sql.SqlImplementor$Context.toSql(SqlImplementor.java:705)
  at org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(RelToSqlConverter.java:338)  

In addition, tests from Jira cannot be used directly: the test builds the plan programmatically rather than using the JIRA's SQL verbatim, because the standard sql-to-rel conversion never produces the plan shape that triggers this bug.

@xuzifu666
xuzifu666 requested a review from mihaibudiu October 18, 2026 11:06
@sonarqubecloud

Copy link
Copy Markdown

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.

2 participants