Repository navigation
feat: name unaliased ROUND and current-time items as Snowflake receipts show - #122
Merged
Merged
Conversation
Two playground shapes over input(n NUMBER(10,2)): ROUND with one and two arguments in mixed case and spacing, and CURRENT_DATE(), CURRENT_DATE, CURRENT_TIMESTAMP() (values diverge under current_time; the names and types are the receipt).
SUM, MAX and AVG over DISTINCT in one query, and COALESCE, CAST of text to INTEGER and lower(g ) in another, since one select list cannot hold both without GROUP BY; each item as written, with a no-rows twin for each.
Recorded from test/unaliased-round-current 5778f8d (3 cases, utc-v1, no failures). Snowflake upper-cases the item text and keeps its spacing: ROUND(N, 1), ROUND(N), ROUND( N, 0 ), CURRENT_DATE(), CURRENT_DATE, CURRENT_TIMESTAMP().
… expressions Recorded from test/unaliased-round-current c0514f7 (4 cases, utc-v1, no failures): SUM(DISTINCT N), MAX(DISTINCT N), AVG(DISTINCT N), COALESCE(N, 0, 1), COALESCE(1, 2), CAST(G AS INTEGER), LOWER(G ).
…ts show ROUND of a column with an optional integer scale, CURRENT_DATE, CURRENT_DATE() and CURRENT_TIMESTAMP() now take Snowflake's recorded names. CURRENT_DATE and CURRENT_TIMESTAMP convert to DuckDB calls, so a select item aliased as the keyword no longer captures them. The recorded DISTINCT aggregate and row-expression names are pinned too.
Snowflake types AVG(DISTINCT n) of NUMBER(10,2) as NUMBER(25,5), three more decimal places rather than six, and no recording shows how it rounds. The current-time names case becomes typing evidence, since its values read the clock.
…T aggregate statements
Contributor
Author
|
Gate at 3472c26 (merge base 37e3767, plus the evidence on evidence/unaliased-names 977b744):
It will merge main and re-gate in its landing slot, after #121. |
With main merged, the conversion constants file reached 2,005 lines, over the 2,000-line limit. The names sit in output_names.rs as match literals, as calls.rs writes them.
Contributor
Author
|
Landing gate at cce77ac (main 596399e merged in):
Since the approved 3472c26:
|
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.
Why
The playground's first queries still refused with SQ0009:
ROUND(total, 2)andCURRENT_DATE()without an alias. Main also had a binder bug:SELECT CURRENT_DATE() AS current_dateconverted to SQL DuckDB rejects, because DuckDB reads the alias as its own keyword. New receipts (cases/relational/unaliased_round_current.toml) record Snowflake's names for these items, plus DISTINCT aggregates, COALESCE, CAST and a spaced call.Changes
ROUND(col)orROUND(col, n)takes its upper-cased text as its name, inner spaces kept, as recorded.CURRENT_DATE,CURRENT_DATE()andCURRENT_TIMESTAMP()are named by their upper-cased text. BareCURRENT_TIMESTAMPandCURRENT_DATE( )still refuse.current_date()andget_current_timestamp(), so an alias spelled as the keyword binds on DuckDB.Verification
lower(g ). Another test runs the keyword-alias statement, and another checks that AVG(DISTINCT) of a NUMBER refuses.make check-ci,make test-rust,make verify-recorded: 11,786 cases, 0 failed. The translation baseline was re-recorded for the 7 new statements; nothing regressed.