Skip to content

feat(syntax): give nine Snowflake property-list CREATE kinds structured trees - #208

Merged
kvlonge merged 12 commits into
mainfrom
feat/syntax-ddl-trees
Nov 12, 2026
Merged

kvlonge merged 12 commits into
mainfrom
feat/syntax-ddl-trees

Conversation

@kvlonge

@kvlonge kvlonge commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Why

Nine Snowflake CREATE kinds that are a name and a property list were only validated as opaque text, so their forms could not be verified. Recorded batches also showed join, job service and COPY FILES statements read wrongly.

Changes

  • WAREHOUSE, COMPUTE POOL, EXTERNAL VOLUME, CONTACT, IMAGE, ARTIFACT and GIT REPOSITORY, RESTRICTED SESSION SCOPE and MODEL MONITOR parse into property trees. A parenthesized list stays flat.
  • FOR APPLICATION is read only after a compute pool's name. The tag list ends compute pool and artifact repository CREATEs. CREATE MODEL monitor and monitor.m1 still name a model.
  • A bare FIRST or LAST after a joined table is its alias; FIRST ( x ) after an aliased one is refused.
  • EXECUTE JOB SERVICE takes options before FROM, each at most once.
  • COPY FILES accepts a stage written as a string literal.
  • alias_explicit_as now means AS was written: false for a bare t2 FIRST, true for MERGE USING ( … ) AS s1.
  • Evidence pinned to 150c169f; coverage files regenerated, disagreements only shrink.

Verification

Against main on evidence 150c169f:

  • False accepts: 798 → 766.
  • False rejects: 405 → 380.
  • Other receipts: 350 → 349.
  • Satisfied obligations: 81,914 → 82,598.
  • Verified forms: 2,410 → 2,418 of 3,351.

Validated is not parsed: opaque statements satisfy no obligation.

AS flag: converting the 2,539 corpus statements with FROM or USING is byte-identical before and after, FIRST/LAST alias probes give the same DuckDB rows, and MERGE does not convert. join.join.syntax and MERGE are approved on the corrected trees.

Eighteen security-admin forms are re-approved after the list fix: of 850 cases, 767 trees are unchanged, 82 differ only by the flat list, 2 refusals only by message.

Awaiting new recorded cases: join.join (directed FIRST/LAST with ON), both MODEL MONITOR forms (*_COLUMNS arrays), CREATE OR ALTER WAREHOUSE (_x86 constraints).

Each fix has a regression test. make check-ci passed.

…ed trees

WAREHOUSE, COMPUTE POOL, EXTERNAL VOLUME, CONTACT, IMAGE, ARTIFACT and
GIT REPOSITORY, RESTRICTED SESSION SCOPE and MODEL MONITOR are a name
and a property list, so they now parse as property-list objects instead
of opaque text. COMPUTE POOL takes FOR APPLICATION <name>. MODEL and
VOLUME still start kinds of their own, so CREATE MODEL and CREATE VOLUME
are not read as a partial MODEL MONITOR or EXTERNAL VOLUME.
…r tag list, and name RSS

Snowflake refuses any property after the tag list of a compute pool or
artifact repository, while alerts and groups accept one, so only those two
kinds end at their tags. RSS is the short kind of a restricted session
scope and now parses like it.
…( x ) after an aliased table, and take job service options before FROM

Snowflake reads a bare FIRST or LAST after a joined table as its alias,
and refuses FIRST ( x ) or LAST ( x ) with no ON or USING after a table
that already has an alias. EXECUTE JOB SERVICE takes its options before
FROM as well as after the specification.
…shapes, unrecorded

These cases are recorded by a later evidence pin.

The derived FIRST and LAST cases of the JOIN syntax form have no ON or
USING, so Snowflake reads FIRST ( v1 ) there as a table alias. Replace
them with cases that carry USING, and observe the alias reading in four
more. Observe five shapes the grammar does not settle: options before
FROM SPECIFICATION, a subquery MERGE source, a positional CALL argument,
chained joins, and DIMENSIONS before METRICS. Run the seven stage-path
cases that need a current database in a run database.
…a run database

A session without a current database answers it with errno 90105.
Snowflake reads COPY FILES INTO '@"s1 Q"' and FROM '@"s1 Q"' as stages
whose names need quoting, and fails them only on the missing object. The
check now takes a string that starts with @ in either position.
The structured trees for nine property-list kinds, the TAG-last refusal,
the join alias and job-service fixes and the COPY FILES string stages
clear 32 syntax errors the parser accepted and 25 statements it refused;
the list only shrinks. Obligations gained: 673. The join form's read-order
obligations move to the recorded cases with a read-order clause.
Each item of a parenthesized property value list ended only at a closing
parenthesis, so USERS = ( 'u1' , 'u2' ) became a list inside a list. An
item now ends at its comma.
… monitor as a model, and refuse a job service option given on both sides of FROM

FOR APPLICATION was read as a property of every property-list kind; it is
now read only right after a compute pool's name. In CREATE MODEL, a
MONITOR followed by a dot, FROM, WITH VERSION or the statement end is the
model's name or schema rather than the MODEL MONITOR kind, so CREATE MODEL
monitor FROM MODEL m2 and CREATE MODEL monitor.m1 FROM MODEL m2 parse
again. An EXECUTE JOB SERVICE option given before FROM is counted when the
same option follows the specification.
A keyword used as a bare table alias, such as t2 FIRST, was marked as
written with AS, and MERGE never marked an AS it read before a target,
subquery or table alias. The flag now says exactly whether AS appears.
… reviewed forms

The pinned evidence adds the latest batch of receipts and the cases they
settle. Six external-table obligations listed as unobservable because
their cases had not been submitted now have receipts, so their entries
go. Satisfied obligations rise from 82,587 to 82,598 and parsed cases
from 27,072 to 27,082; the receipt-disagreement list is unchanged.

Eight forms are approved after a full read of their trees against the
documentation, obligations and receipts: join-2, join.join.syntax,
MERGE, the JavaScript CALL WITH form, EXECUTE JOB SERVICE, and CREATE
CONTACT, GIT REPOSITORY and IMAGE REPOSITORY. Eighteen security-admin
forms whose fingerprints changed only through the flat parenthesized
list are re-approved: of their 850 cases, 767 trees are unchanged, 82
differ only by the flattened list, and 2 refusals changed their message.
Verified forms rise from 2,410 to 2,418.
@kvlonge
kvlonge added this pull request to the merge queue Nov 12, 2026
Merged via the queue into main with commit 143328c Nov 12, 2026
17 of 19 checks passed
@kvlonge
kvlonge deleted the feat/syntax-ddl-trees branch November 12, 2026 20: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