feat(duckdb): Add UUID v5 unsupported error for Snowflake UUID_STRING transpilation#7518
feat(duckdb): Add UUID v5 unsupported error for Snowflake UUID_STRING transpilation#7518fivetran-ashashankar wants to merge 9 commits intomainfrom
Conversation
SQLGlot Integration Test ResultsComparing:
By Dialect
Overallmain: 113234 total, 112044 passed (pass rate: 98.9%), sqlglot version: sqlglot:RD-1147774-transpile_UUID_STRING: 110921 total, 110023 passed (pass rate: 99.2%), sqlglot version: Transitions: Dialect pair changes: 0 previous results not found, 1 current results not found |
|
@fivetran-ashashankar have you looked into the two Snowflake -> DuckDB failures reported here? |
|
I think we can probably transpile |
|
georgesittas
left a comment
There was a problem hiding this comment.
Much cleaner.
@fivetran-ashashankar let's rebase here and it should be good to afterwards.
Review comments implement uuid_string 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Review comments implement uuid_string The CAST to VARCHAR is unnecessary as LOWER() and string concatenation already return VARCHAR type in DuckDB. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
5988b60 to
7ea8dbf
Compare
- Set UUID_IS_STRING_TYPE = True in Snowflake dialect - Add UUID_STRING parser that sets is_string=True flag - Explicitly set UUID_IS_STRING_TYPE = False in Hive, Presto, and DuckDB dialects
| SUPPORTS_FIXED_SIZE_ARRAYS = True | ||
| STRICT_JSON_PATH_SYNTAX = False | ||
| NUMBERS_CAN_BE_UNDERSCORE_SEPARATED = True | ||
| UUID_IS_STRING_TYPE = False |
There was a problem hiding this comment.
This is redundant, right? The default is False, so DuckDB and other dialects will inherit it, unless set to True.
There was a problem hiding this comment.
Yes, I was trying to debug to see what is causing the test failure.
| ARRAY_AGG_INCLUDES_NULLS = None | ||
| REGEXP_EXTRACT_DEFAULT_GROUP = 1 | ||
| ALTER_TABLE_SUPPORTS_CASCADE = True | ||
| UUID_IS_STRING_TYPE = False |
There was a problem hiding this comment.
This isn't right. We need to set this to True. Did you test against Hive, Spark, Databricks?
Hive:
0: jdbc:hive2://localhost:10000> select uuid(), typeof(uuid());
INFO : Compiling command(queryId=hive_20260423131737_e6c31a91-6039-440c-a7d4-dde96388d441): select uuid(), typeof(uuid())
INFO : Semantic Analysis Completed (retrial = false)
INFO : Created Hive schema: Schema(fieldSchemas:[FieldSchema(name:_c0, type:string, comment:null), FieldSchema(name:_c1, type:string, comment:null)], properties:null)
INFO : Completed compiling command(queryId=hive_20260423131737_e6c31a91-6039-440c-a7d4-dde96388d441); Time taken: 1.256 seconds
INFO : Concurrency mode is disabled, not creating a lock manager
INFO : Executing command(queryId=hive_20260423131737_e6c31a91-6039-440c-a7d4-dde96388d441): select uuid(), typeof(uuid())
INFO : Completed executing command(queryId=hive_20260423131737_e6c31a91-6039-440c-a7d4-dde96388d441); Time taken: 0.001 seconds
+---------------------------------------+---------+
| _c0 | _c1 |
+---------------------------------------+---------+
| cb49b6c9-f166-45b4-9913-f9efe285666f | string |
+---------------------------------------+---------+
1 row selected (1.372 seconds)
Spark:
(sqlglot) ➜ sqlglot git:(main) runspk "SELECT typeof(UUID())"
WARNING: Using incubator modules: jdk.incubator.vector
Using Spark's default log4j profile: org/apache/spark/log4j2-defaults.properties
Setting default log level to "WARN".
To adjust logging level use sc.setLogLevel(newLevel). For SparkR, use setLogLevel(newLevel).
26/04/23 16:18:47 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
26/04/23 16:18:49 WARN ObjectStore: Version information not found in metastore. hive.metastore.schema.verification is not enabled so recording the schema version 2.3.0
26/04/23 16:18:49 WARN ObjectStore: setMetaStoreSchemaVersion called but recording version is disabled: version = 2.3.0, comment = Set by MetaStore georgesittas@192.168.1.234
Spark Web UI available at http://localhost:4040
Spark master: local[*], Application Id: local-1776950328490
string
Time taken: 0.888 seconds, Fetched 1 row(s)
| LOG_BASE_FIRST: bool | None = None | ||
| SUPPORTS_VALUES_DEFAULT = False | ||
| LEAST_GREATEST_IGNORES_NULLS = False | ||
| UUID_IS_STRING_TYPE = False |
There was a problem hiding this comment.
This is correct but redundant.
| ), | ||
| "SYSTIMESTAMP": exp.CurrentTimestamp.from_arg_list, | ||
| "UNICODE": lambda args: exp.Unicode(this=seq_get(args, 0), empty_is_zero=True), | ||
| "UUID_STRING": lambda args: exp.Uuid(this=seq_get(args, 0), name=seq_get(args, 1)), |
There was a problem hiding this comment.
Why is this necessary?
Summary
Added support for Snowflake UUID_STRING function transpilation to DuckDB:
Changes
Test Results
✓ All 1227 unit tests pass
✓ Integration tests pass
Related: RD-1147774