Skip to content

Catch four dbt-style models Snowflake rejects (D150 round 2) - #91

Closed
kvlonge wants to merge 6 commits into
fix/limit-unionfrom
fix/models-gaps
Closed

kvlonge wants to merge 6 commits into
fix/limit-unionfrom
fix/models-gaps

Conversation

@kvlonge

@kvlonge kvlonge commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Draft. Order per D188: #89 → #90 → corpus/everyday-2 → this PR. Base is fix/limit-union (#90); the diff also includes the merge of corpus/everyday-2 (d4cea4d) until that lands. Once its predecessors are on main, this branch will be updated onto main with a merge, not a rebase.

What it catches (D150 round 2, everyday-models receipts)

Model Snowflake SQLQuack now
Named WINDOW w AS (…) clause, used as OVER w 1003 syntax error at w SQ0001 parse error in faithful modes. WINDOW still works as an alias.
JOIN LATERAL FLATTEN(…) f ON … (including ON TRUE) 2, unsupported feature (lateral table function with a join predicate) new SQ0209 lateral_function_join_condition, at check. A LATERAL FLATTEN join without ON, and lateral subqueries with ON, are not flagged.
Selecting the pivoted channel after PIVOT 904 invalid identifier already SQ0208 (#89)
Ambiguous unqualified column (sum(amount) over two inputs that both have AMOUNT) 2028 check --schema reports SQ0004 at check time, from lineage's E221. Without a schema, nothing changes.

Evidence

  • Zero-fire: SQ0206–SQ0209 fire on none of the 24,472 parsed receipts and none of the 4,243 translation-case statements. No receipted statement changes parse verdict.
  • Corpus expectations re-derived. Two move to check SQ0004 under a schema: the everyday query SELECT customer_id FROM orders o JOIN customers c … and the jaffle-style model.
  • Left open: CHANGES … AT(OFFSET) failed only because change tracking was off. That is weak evidence and not a parser gap. It is the only line left in the models test's expected_rejections_not_caught.

Checks

  • Local: fmt, clippy and fensu are clean. The full suite passes except the 3 Python-replay test_convert tests, which fail in this worktree only because it has no .venv. They will be confirmed in the gate environment before landing.
  • The playground engine was rebuilt and playground.test.mjs passes 8/8.
  • Touches crates/sqlquack-syntax (WINDOW clause in parser entry/analyze), so it is on the D118 re-read list.

corpora/everyday-models holds staging models, CTE chains, incremental
filters, QUALIFY deduplication, FLATTEN, materialization DML, date spines
over GENERATOR, window frames, PIVOT and UNPIVOT, marts, snapshots and
generic test SQL, over its own schema. The corpus test checks each one's
outcome under both policies, and the rates: 175 of 300 strict, 247 of 300
repository.
…eipts

23 of the 24 uncertain models now carry Snowflake's verdict; one was not
captured and stays uncertain. Five that Snowflake rejects drop out of the
rates, now 175 of 295 strict and 247 of 295 repository, and the test lists
them as rejections SQLQuack's parse and checks do not catch.
From the everyday-models receipts (corpus/everyday-2 d4cea4d):
- A named WINDOW clause is a parse error in Snowflake's faithful modes
  (Snowflake 1003 at the window's name); WINDOW may still be an alias.
- New SQ0209 lateral_function_join_condition: a LATERAL table function such
  as FLATTEN joined with an ON condition, even ON TRUE (Snowflake 2,
  unsupported feature). Joins without ON, and lateral subqueries with ON,
  are not flagged.
- check --schema now reports an ambiguous unqualified column (lineage's
  E221, Snowflake 2028) as SQ0004 at check time, not only at translation.
- The pivoted-away channel column is already SQ0208.

No receipted statement changes parse verdict, and SQ0206-SQ0209 fire on
none of the 24,472 parsed receipts or 4,243 translation-case statements.
Corpus expectations are re-derived; the models test's not-caught list keeps
only CHANGES without change tracking, which is not a parser gap.

kvlonge commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

Closing: SQLQuack lands through local-gate trains, not PR merges (D94), so open PRs only add clutter (D628/D630). The branch is kept. Any work here that isn't on main yet is tracked by the train owner and lands through a train.

@kvlonge kvlonge closed this Nov 8, 2026
@kvlonge
kvlonge deleted the fix/models-gaps branch November 9, 2026 21:31
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