Commit 1a55f07
authored
feat(duckdb): transpile snowflake's JAROWINKLER_SIMILARITY properly (#7501)
* fix(snowflake): transpile JAROWINKLER_SIMILARITY to DuckDB with correct scale
Snowflake's JAROWINKLER_SIMILARITY returns values on a 0-100 integer scale,
while DuckDB's JARO_WINKLER_SIMILARITY returns values on a 0.0-1.0 float scale.
Changes:
- Added integer_scale flag to JarowinklerSimilarity expression
- Snowflake parser sets integer_scale=True when parsing JAROWINKLER_SIMILARITY
- DuckDB generator multiplies by 100 and casts to INTEGER when flag is set
- Preserves DuckDB roundtrip (no scale conversion when flag is not set)
This ensures semantic equivalence when transpiling from Snowflake to DuckDB.
* chore: update integration tests submodule1 parent 9422619 commit 1a55f07
5 files changed
Lines changed: 24 additions & 5 deletions
File tree
- sqlglot
- expressions
- generators
- parsers
- tests/dialects
Submodule sqlglot-integration-tests updated from e27bb20 to a69a8ba
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
112 | 117 | | |
113 | 118 | | |
114 | 119 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | 27 | | |
29 | 28 | | |
30 | 29 | | |
| |||
1609 | 1608 | | |
1610 | 1609 | | |
1611 | 1610 | | |
1612 | | - | |
1613 | 1611 | | |
1614 | 1612 | | |
1615 | 1613 | | |
| |||
2285 | 2283 | | |
2286 | 2284 | | |
2287 | 2285 | | |
| 2286 | + | |
| 2287 | + | |
| 2288 | + | |
| 2289 | + | |
| 2290 | + | |
| 2291 | + | |
| 2292 | + | |
| 2293 | + | |
| 2294 | + | |
| 2295 | + | |
| 2296 | + | |
| 2297 | + | |
| 2298 | + | |
| 2299 | + | |
| 2300 | + | |
2288 | 2301 | | |
2289 | 2302 | | |
2290 | 2303 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
539 | 539 | | |
540 | 540 | | |
541 | 541 | | |
| 542 | + | |
542 | 543 | | |
543 | 544 | | |
544 | 545 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
224 | | - | |
| 224 | + | |
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
| |||
0 commit comments