Repository navigation
Parser gaps-f: Snowflake CALL, DATA METRIC FUNCTION, POLICY_CONTEXT and recorded expression fixes - #61
Merged
Conversation
…IP, exact check pending) A qualified call takes a bare query argument, as data metric functions do (SNOWFLAKE.CORE.NULL_COUNT(SELECT c FROM t)); a call may leave out the schema (db..f(x)); the ! method syntax needs a name or MODEL( <names> ) receiver and a method; stage references refuse @'x', @"x y" and @<reserved word>; INTERVAL types keep a precision of 1 to 9 (0 to 9 for seconds after TO) and need a field; DECLARE takes nested procedures; an unquoted reserved word is no later name part; BEGIN WORK/TRANSACTION NAME keeps the name.
…nd empty lambdas A trailing ESCAPE with nothing after it is an alias, :<keyword> is a bind variable and :"x" is refused, a bare @ before , or ) is a stage argument, and ( ) -> x is refused. Two corpus inputs the stage-name refusal now rejects are listed as expected rejections.
->> chains statements as an Operator node and is no longer a JSON operator in Snowflake expressions. ANY/ALL take a value list, STRING( ) takes empty parentheses, and only SELECT is refused as a later dotted name part, the one word recorded. Corpus inputs refused by recorded rules (a bare INTERVAL type, ->> inside expressions, a string stage name) are listed as expected rejections.
… flow only under faithful calls ** <array> in a call's arguments is a Variadic node, like PostgreSQL's VARIADIC, and IPADDRESS '<text>' is a typed literal. The flow operator and the refusal of ->> as a JSON operator apply only with Snowflake's faithful-call rules, so the polyglot comparison keeps its JSON reading and needs no expected rejections for it.
…th colon INTERVAL m1 YEAR and v1 :'v1' are recorded syntax errors. Both refusals apply only with Snowflake's faithful-call rules.
… whatever it expects The snapshot took Snowflake's verdict from a case's checked phase, which is none for every observe case, so a receipted observe case the parser stopped accepting never reached the diff (#55's three regressions, audit 38bed22). Each case result now carries what Snowflake's parser did, by every syntax receipt of its SQL, setup and session whatever the case id: parsed when all stopped after parsing with an errno other than 1003, refused when all are a positioned 1003 or a 921, and nothing for a positionless 1003 or receipts that disagree. The diff fails on a parsed case the parser now rejects, as before, and also on a refused case it now accepts.
CAST ( NULL AS INTERVAL SECOND ( 9 ) , ( 3 ) ) is a recorded syntax error that the interval precision change had let through as CAST's comma format. The refusal applies only with Snowflake's faithful-call rules.
…s Snowflake does - In faithful Snowflake mode a plain CALL parses as a Call node, as WITH ... CALL already did, so malformed argument lists are refused instead of kept as a command. - EXECUTE USING POLICY_CONTEXT ( <name> => <value>, ... ) AS <query> parses as an ExecuteUsingPolicyContext node. - A string is refused as a window frame bound value.
…BLE and ALTER VIEW A DataMetricFunctionAction holds the items, each a function name, its ON arguments and its clauses (SENSITIVITY, ANOMALY_DETECTION, EXPECTATION changes, WITHIN GROUP ... GROUP LIMIT, EXECUTE AS ROLE, FILTER, SUSPEND and RESUME). The ON list takes columns, then optionally TABLE ( <name> ( <column>, ... ) ) or a lambda; the column list may be empty, as Snowflake's receipts show.
…TS!METHOD( ) The structured CALL refused the 26 receipted class method calls that leave the schema out; the coverage diff's parsed-now-refused line caught them.
… rules to faithful Snowflake parsing The exact check compares the polyglot modes with sqlglot, which refuses ARRAY(VARCHAR NOT NULL); these Snowflake-only rules now apply where the CALL and frame-bound rules do.
polyglot has no NOT NULL element type, so the type-name check unwraps the wrapper before converting; it compares base names (ARRAY, MAP) only.
…lake_commands.rs commands.rs passed fensu's 2,000-line limit after merging main; these Snowflake EXECUTE forms sit with the other Snowflake commands.
Contributor
Author
|
Gate (D94) and landing record.
|
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.
Parser batch gaps-f (lane B: scripting, expressions, functions; plus ALTER TABLE/VIEW DATA METRIC FUNCTION, agreed with C).
db..fn( )andCALL db..x!method( );!method receivers; stage-reference refusals; INTERVAL precision and field rules;->>flow operator; ANY/ALL value lists;** <array>variadic;IPADDRESS '…'typed literal; ESCAPE as an alias;:<keyword>binds; NOT NULL on a structured ARRAY element and MAP value; a string refused as a window frame bound.EXECUTE USING POLICY_CONTEXT ( … ) AS <query>(new ExecuteUsingPolicyContext node);{ ADD | DROP | MODIFY } DATA METRIC FUNCTIONin ALTER TABLE and ALTER VIEW (new DataMetricFunctionAction);BEGIN WORK/TRANSACTION NAMEkeeps the name (auditor withhold); DECLARE nested procedures.Coverage diff against main 77e10ee (catalogue c9ce0ff + evidence 1c56796): 0 forms lost, 0 obligations lost, +1,151 obligations, parsed-now-refused 0, syntax-error-now-accepted 0. A first measurement found 26 parsed-now-refused rows (
CALL SNOWFLAKE..ANOMALY_INSIGHTS!…), fixed in 7b2075b. Forms gained: 0 on that catalogue, because most forms still wait on observe triage and reviews; the 3-hour cap was reached before the 67-form floor.