Repository navigation
fix(syntax): parse Snowflake ALTER FUNCTION, PROCEDURE, SCHEMA, STAGE, SERVICE and 26 more kinds - #40
Merged
Merged
Conversation
…RIABLE as a typed statement These statements parse to AlterObject instead of the opaque Command fallback: - ALERT: RESUME/SUSPEND, SET, UNSET, FROM TEMPLATE ... SET, MODIFY CONDITION EXISTS ( <query> ) and MODIFY ACTION <statement> - ONLINE FEATURE TABLE: SUSPEND/RESUME, REFRESH, RENAME TO, SET, and UNSET TAG <name> [ , ... ] - VARIABLE: RENAME TO, SET/DROP DEFAULT, SET/UNSET COMMENT ALTER ONLINE followed by anything other than FEATURE TABLE, and ALTER FEATURE followed by anything other than POLICY, are now syntax errors in Snowflake, as recorded.
… and service objects ALTER FUNCTION (UDF, external, service and data metric functions) and ALTER PROCEDURE keep their argument types, a TABLE( ... ) argument as a tuple. ALTER AGENT, COMPUTE POOL, CONTACT, DBT PROJECT, DCM PROJECT, EVENT ROUTING TABLE, EXTERNAL AGENT, EXTERNAL TABLE, FILE FORMAT, GATEWAY, GIT REPOSITORY, LISTING, MODEL, MODEL MONITOR, NOTEBOOK, SCHEMA, SERVICE and STAGE parse into AlterObject. Following the recorded receipts: property names are open, a SET of TAG or CONTACT pairs sets nothing else, a stage path ends at whitespace, an incomplete kind such as ALTER COMPUTE is a syntax error, and only external tables add partitions.
…ll parsers Each group of actions (model versions, listing versions, service sources, event routing rules and the remaining clauses) has its own parser that takes and returns the action words, and kind and action are matched together rather than compared.
…ts and materialized views ALTER ARTIFACT REPOSITORY, DATASET, EXTERNAL VOLUME, MATERIALIZED VIEW, PIPE, RESTRICTED SESSION SCOPE (and RSS), STREAM and TYPE parse into AlterObject through the resource kinds. Following the recorded receipts: a restricted session scope adds and removes its body without AS (ADD AS is errno 1003), a dataset version comes from a query, and ARTIFACT, MATERIALIZED, RESTRICTED SESSION and VOLUME alone are no kind.
Contributor
Author
|
Merge gate (D94):
|
kvlonge
added a commit
that referenced
this pull request
Nov 4, 2026
Conflicts were helper visibility (main's pub(super) kept) and the ddl module list (both modules kept).
kvlonge
added a commit
that referenced
this pull request
Nov 4, 2026
Basis: main 00e831a (PR #38, #39, #40), catalogue 5f35885, evidence 469edde, parser tree 08415e1. - 68 rebinds (ddl 1, expressions 6, functions 59, query 2): #39 put [[reading]] grammars into the definition hash; each fingerprint equals one an earlier full-read review approved. - 149 newly approved forms (ddl 71, functions 56, scripting 14, expressions 5, query 2, transaction_session 1), read against their pinned pages and raw parser trees. - Not approved: 37 forms with catalogue findings and 1 withhold (sf.ddl.drop-sequence: RESTRICT is dropped from the tree). Checker at 00e831a: valid, 3476 forms; 1239 of 3348 verified.
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.
Parses Snowflake
ALTERof 31 more object kinds into the typedAlterObjectstatement that #37 added. Until now they went through the opaque Command fallback.ALTER FUNCTION(UDF, external, service and data metric functions) andALTER PROCEDURE. Both keep their argument types in a newAlterObject.arguments; aTABLE( ... )argument is kept as a tuple.parser/_helpers/ddl/snowflake_alter.rs. The other kinds are in a newsnowflake_alter_resources.rs, which has one table of actions per kind and one shared SET/UNSET property parser.parse_alteris unchanged.SET v1 = 'm'parses), but a SET of TAG or CONTACT pairs sets nothing else.@"s1 Q"is not one path.ALTER COMPUTE,ALTER VOLUMEorALTER EVENT TABLEis a syntax error.ALTER TABLE … ADD PARTITIONis refused for Snowflake).tests/parser/test_snowflake_alter.rs.Receipt harness: every form in the batch agrees with its receipts. That's 168 forms and 2,766 scored cases (ALERT/OFT/VARIABLE 19/226, FUNCTION 28/448, the 21 kinds of the first resource batch 92/1,666, and the 8 kinds of the second 29/426), and #37's 50 forms and 699 cases still agree. The only mismatches are unscored observe rows: missing-name cases with errno 1003 and no position (reviewed as semantic), and MATERIALIZED VIEW
SET CONTACT, which Snowflake refuses.Coverage diff:
family <f> --jsonfor all ten families. It compares the gate-profile checker of main 4a8656b with this branch's (6ca671e), over catalogue f139639 plus evidence a299d23:D122a floor: +67 forms against a floor of 67 (2% of 3,348), so this PR gates on form count. By kind, the gain is FUNCTION 14, VARIABLE 5, ALERT 3, COMPUTE POOL 3, DBT PROJECT 3, MODEL 3, ONLINE FEATURE TABLE 3, PROCEDURE 3, SCHEMA 3, SERVICE 3, and 1–2 each for the other kinds. Most of the remaining forms in these kinds already agree with every receipt, but still wait on observe rows or on receipts that lane A is capturing (packets d40/d40b).
Merge order: after #38 and #39.