fix: continue an ARRAY JOIN's operand list across FROM commas - #80
Open
takaebato wants to merge 2 commits into
Open
fix: continue an ARRAY JOIN's operand list across FROM commas#80takaebato wants to merge 2 commits into
takaebato wants to merge 2 commits into
Conversation
ClickHouse's comma after an ARRAY JOIN continues its operand list — a table can't follow — but sqlparser parses each further operand as an independent FROM item, so ARRAY JOIN arr1 AS a, arr2 AS b surfaced arr2 as a phantom table read (the single-operand special case landed with the sqlparser 0.62 bump; the comma form stayed behind). bind_from now tracks whether the previous item's join chain ended in an ARRAY JOIN and binds a following bare-table item as an operand (a column read of the left relation with its alias exposed); a join-carrying or non-table item resets to the ordinary cross join. The alias outputs trace to the operands at function granularity — the zip pairing stays a per-function refinement, like UNNEST's. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
✅ PR title follows the Conventional Commits spec. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #80 +/- ##
==========================================
- Coverage 95.74% 95.73% -0.01%
==========================================
Files 28 28
Lines 6675 6689 +14
Branches 6675 6689 +14
==========================================
+ Hits 6391 6404 +13
Misses 191 191
- Partials 93 94 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Placement review of the operand-list continuation: a continued operand can be an array-producing expression (its argument columns read), and a join-carrying item deliberately stops the continuation — in the doubtful ARRAY JOIN a, b JOIN u shape, b stays a table rather than risk demoting a real table to a column. Multi-table bases resolve operands open-world (Ambiguous, catalog-narrowable) and derived items reset the state; probed healthy. Co-Authored-By: Claude Fable 5 <noreply@anthropic.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.
Summary
ClickHouse's comma after an
ARRAY JOINcontinues its operand list (ARRAY JOIN arr1 AS a, arr2 AS bunnests two arrays; a table can't follow there), but sqlparser parses each further operand as an independent FROM item — so the second operand surfaced as a phantom table readarr2and its alias resolved as an ambiguous column. The single-operand special case (the operand is an array column of the left relation, not a scanned table) landed with the sqlparser 0.62 bump; the comma form stayed behind.bind_fromnow tracks whether the previous FROM item's join chain ends in anARRAY JOINand binds a following bare-table item as another operand: a column read of the left relation, its alias exposed as the unnested element. A join-carrying or non-table item resets to the ordinary comma cross join, which is untouched — deliberately conservative: in the doubtfulARRAY JOIN a, b JOIN u ON …shape,bstays a table rather than risk demoting a real table to a column. A continued operand can also be an array-producing expression (arrayConcat(x, y) AS m— its argument columns read), and over a multi-table base the operand resolves open-world (Ambiguous, catalog-narrowable) like any unqualified column. No dialect gate — the construct itself pins the dialect family. The alias outputs trace to the operands at function granularity (each output to every operand); the exact zip pairing stays a per-function refinement, the same coarseness asUNNEST.Tests
Column-level pins for the two- and three-operand forms (operands read as columns, no phantom table) and a table-level pin that the operand list stays out of table reads while an ordinary comma join keeps both tables. Full workspace: 931 tests, clippy and rustdoc clean.
🤖 Generated with Claude Code