[CALCITE-7440] Preserve correlated scope mapping in RelToSqlConverter#4828
Open
bvolpato wants to merge 2 commits intoapache:mainfrom
Open
[CALCITE-7440] Preserve correlated scope mapping in RelToSqlConverter#4828bvolpato wants to merge 2 commits intoapache:mainfrom
bvolpato wants to merge 2 commits intoapache:mainfrom
Conversation
556d0d8 to
7d4937e
Compare
6309f8d to
5447f29
Compare
660aa39 to
4449f5a
Compare
4449f5a to
f11eed6
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



Summary
RelToSqlConverter failed during PostgreSQL round-trip validation when semi-join rewrites introduced a correlated filter with an unresolved correlation id.
Reproduction query
Error before this PR
Fix
Register missing RexCorrelVariable ids while visiting filter conditions, without overriding existing correlation mappings.
Test
RelToSqlConverterTest.testPostgresqlRoundTripCorrelatedProjectWithSemiJoinRules./gradlew :core:test --tests org.apache.calcite.rel.rel2sql.RelToSqlConverterTestDisclaimer
The changes were done with the assistance of Codex (gpt-5.3-codex) in response to an actual bug when using Calcite in production. The changes were manually verified prior to sending this to review.