[SPARK-56814][SQL][TESTS] Add lateral join tests for outer attribute visibility after NATURAL/USING JOIN#55794
Closed
mihailotim-db wants to merge 1 commit into
Conversation
…ter NATURAL/USING JOIN Co-authored-by: Isaac
Contributor
|
thanks, merging to master/4.x/4.2! |
cloud-fan
pushed a commit
that referenced
this pull request
May 11, 2026
…visibility after NATURAL/USING JOIN ## What changes were proposed in this pull request? Add SQL query test cases to join-lateral.sql covering lateral join outer attribute visibility after NATURAL JOIN and USING JOIN. Specifically: 1. Lateral after NATURAL JOIN -- unqualified key: verifies the merged join key resolves correctly in the lateral subquery. 2. Lateral after NATURAL JOIN -- qualified keys: verifies t1.k and t2.k resolve to the original pre-merge columns. 3. Lateral after USING JOIN -- qualified keys: same as above but with explicit USING (k) syntax. 4. Lateral cannot see column hidden by subquery alias: verifies that a column not in the subquery's output (v1 behind SELECT k FROM ... ORDER BY v1) is not visible to the lateral subquery. 5. Lateral cannot see column not in GROUP BY output: verifies that a column dropped by GROUP BY projection (v1 in SELECT k FROM ... GROUP BY k) is not visible to the lateral subquery. ## Why are the changes needed? The existing join-lateral.sql tests cover NATURAL JOIN and USING JOIN with the lateral subquery itself (lines 28-29), but do not test lateral joins chained after a NATURAL/USING JOIN -- i.e., whether the merged/qualified/hidden columns from the left side are correctly visible or hidden across the lateral boundary. These tests close that gap. ## Does this PR introduce any user-facing change? No. ## How was this patch tested? Added test cases ## Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Code (claude-opus-4-6) Closes #55794 from mihailotim-db/mihailo-timotic_data/lateral-join-outer-attr-visibility. Authored-by: Mihailo Timotic <mihailo.timotic@databricks.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com> (cherry picked from commit 52daa61) Signed-off-by: Wenchen Fan <wenchen@databricks.com>
cloud-fan
pushed a commit
that referenced
this pull request
May 11, 2026
…visibility after NATURAL/USING JOIN ## What changes were proposed in this pull request? Add SQL query test cases to join-lateral.sql covering lateral join outer attribute visibility after NATURAL JOIN and USING JOIN. Specifically: 1. Lateral after NATURAL JOIN -- unqualified key: verifies the merged join key resolves correctly in the lateral subquery. 2. Lateral after NATURAL JOIN -- qualified keys: verifies t1.k and t2.k resolve to the original pre-merge columns. 3. Lateral after USING JOIN -- qualified keys: same as above but with explicit USING (k) syntax. 4. Lateral cannot see column hidden by subquery alias: verifies that a column not in the subquery's output (v1 behind SELECT k FROM ... ORDER BY v1) is not visible to the lateral subquery. 5. Lateral cannot see column not in GROUP BY output: verifies that a column dropped by GROUP BY projection (v1 in SELECT k FROM ... GROUP BY k) is not visible to the lateral subquery. ## Why are the changes needed? The existing join-lateral.sql tests cover NATURAL JOIN and USING JOIN with the lateral subquery itself (lines 28-29), but do not test lateral joins chained after a NATURAL/USING JOIN -- i.e., whether the merged/qualified/hidden columns from the left side are correctly visible or hidden across the lateral boundary. These tests close that gap. ## Does this PR introduce any user-facing change? No. ## How was this patch tested? Added test cases ## Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Code (claude-opus-4-6) Closes #55794 from mihailotim-db/mihailo-timotic_data/lateral-join-outer-attr-visibility. Authored-by: Mihailo Timotic <mihailo.timotic@databricks.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com> (cherry picked from commit 52daa61) Signed-off-by: Wenchen Fan <wenchen@databricks.com>
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.
What changes were proposed in this pull request?
Add SQL query test cases to join-lateral.sql covering lateral join outer attribute visibility after NATURAL JOIN and USING JOIN. Specifically:
is not visible to the lateral subquery.
visible to the lateral subquery.
Why are the changes needed?
The existing join-lateral.sql tests cover NATURAL JOIN and USING JOIN with the lateral subquery itself (lines 28-29), but do not test lateral joins chained after a NATURAL/USING JOIN -- i.e., whether the merged/qualified/hidden columns from the left side are correctly visible or hidden across the lateral boundary. These tests close that gap.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Added test cases
Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (claude-opus-4-6)