Skip to content

feat(convert): run JOIN without ON as a cross join and name more unaliased columns - #187

Merged
kvlonge merged 1 commit into
mainfrom
feat/convert-join-without-on-and-column-names
Nov 12, 2026
Merged

kvlonge merged 1 commit into
mainfrom
feat/convert-join-without-on-and-column-names

Conversation

@kvlonge

@kvlonge kvlonge commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Why

JOIN without ON, of any kind recorded, runs as a cross join. Unaliased SUBSTR, FLOOR, CEIL, NULLIF, TO_DATE and MONTH calls, empty text, $n and a one-key VARIANT path get the column names Snowflake records.

Changes

  • JOIN, INNER, LEFT and FULL JOIN without ON convert to CROSS JOIN under rule.join_cross. Outer joins without ON also give no rows when a side is empty. A later RIGHT or FULL JOIN with ON applies to the whole join so far, as recorded. RIGHT JOIN without ON, and one before a FULL JOIN with USING, are unrecorded and stay refused.
  • Unaliased names now cover SUBSTR, FLOOR, CEIL, NULLIF, TO_DATE and MONTH in any case, '', $n and v:key.
    • v:key is named from the source after the column, as its node range stops there. Only an unquoted, unqualified column with one plain key is named; other paths still refuse with SQ0009.
  • Evidence is pinned to 3ee67fc2 (adds 3a784d72, e677a9d7, 0f25ce3a and eacc4706).
  • Re-recorded: corpora, results, SQL sizes, syntax baseline and marks.

Playground corpora, converted SQL before and after: 41 of 2,962 statements go from refused to converted; none else changes.

Shape Inputs Name
SELECT '' 9 ''
SUBSTR, FLOOR, CEIL, NULLIF, MONTH 25 e.g. NULLIF(STATUS, 'SHIPPED')
TO_DATE 4 TO_DATE(ORDERED_AT)
SELECT payload:page FROM events 1 PAYLOAD:PAGE
SELECT $1 FROM orders 1 $1
... FROM orders o JOIN customers c 1 CROSS JOIN "CUSTOMERS" AS "C"

Verification

  • Replay: 12,256 cases, 0 failed, 0 unproven, 0 pending. Against main, 0 regressions and 20 new cases, all matching.
  • Syntax baseline: the parser is unchanged; receipts it contradicts arrive with the new evidence and are parser follow-ups.
  • New CLI tests run the cross joins on DuckDB (6, 2 and 0 rows), check the receipt names, run chained outer joins (3 rows, not nested 4), and check the RIGHT, USING and path refusals.
  • make check-ci passes.

@kvlonge
kvlonge force-pushed the feat/convert-join-without-on-and-column-names branch from 6309291 to 3a7e2ca Compare November 11, 2026 23:59
@kvlonge
kvlonge added this pull request to the merge queue Nov 12, 2026
@kvlonge
kvlonge removed this pull request from the merge queue due to a manual request Nov 12, 2026
…iased columns

JOIN, INNER JOIN, LEFT JOIN and FULL JOIN without ON convert to CROSS
JOIN, as Snowflake runs them: no rows when either side is empty. A
later RIGHT or FULL JOIN with ON applies to the whole join so far, as
recorded. RIGHT JOIN without ON, and one before a FULL JOIN with
USING, are unrecorded and stay refused.

Unaliased SUBSTR, FLOOR, CEIL, NULLIF, TO_DATE and MONTH calls, empty
text, $n positions and a one-key VARIANT path take the names Snowflake
records for them.

Pins evidence 3ee67fc2 and re-records the translation results, SQL
sizes, the syntax baseline and marks, and the corpora.
@kvlonge
kvlonge force-pushed the feat/convert-join-without-on-and-column-names branch from 3a7e2ca to 132facf Compare November 12, 2026 01:13
@kvlonge
kvlonge added this pull request to the merge queue Nov 12, 2026
Merged via the queue into main with commit 8f02569 Nov 12, 2026
13 checks passed
@kvlonge
kvlonge deleted the feat/convert-join-without-on-and-column-names branch November 12, 2026 02:18
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.

1 participant