Skip to content

feat(snowflake)!: Transpilation support for TO_DECIMAL, TO_NUMBER,NUMERIC#7315

Merged
georgesittas merged 11 commits intomainfrom
RD-1069319_TO_NUMBER_DECIMAL_NUMERIC
Apr 6, 2026
Merged

feat(snowflake)!: Transpilation support for TO_DECIMAL, TO_NUMBER,NUMERIC#7315
georgesittas merged 11 commits intomainfrom
RD-1069319_TO_NUMBER_DECIMAL_NUMERIC

Conversation

@fivetran-ashashankar
Copy link
Copy Markdown
Collaborator

No description provided.

@fivetran-ashashankar fivetran-ashashankar changed the title feat(snowflake)!: Transpilation support for TO_DECIMAL, TO_NUMBER, TO… feat(snowflake)!: Transpilation support for TO_DECIMAL, TO_NUMBER,NUMERIC Mar 17, 2026
join_cols = [col for col in cond.find_all(exp.Column) if col.args.get("join_mark")]

left_join_table = set(col.table for col in join_cols)
if not left_join_table:
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make style formatter modified the transforms.py

@@ -4181,6 +4181,84 @@ def strtok_sql(self, expression: exp.Strtok) -> str:

return self.function_fallback_sql(expression)

Copy link
Copy Markdown
Collaborator Author

@fivetran-ashashankar fivetran-ashashankar Mar 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Snowflake: TO_NUMBER(expr) defaults to NUMBER(38, 0) -> truncates decimals -> BIGINT
Oracle/others: TO_NUMBER(expr) defaults to NUMBER -> keeps decimals -> DOUBLE
Working on handling this difference. should I use is_snowflake here.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 17, 2026

SQLGlot Integration Test Results

Comparing:

  • this branch (sqlglot:RD-1069319_TO_NUMBER_DECIMAL_NUMERIC, sqlglot version: RD-1069319_TO_NUMBER_DECIMAL_NUMERIC)
  • baseline (main, sqlglot version: 0.0.1.dev1)

By Dialect

dialect main sqlglot:RD-1069319_TO_NUMBER_DECIMAL_NUMERIC transitions links
bigquery -> bigquery 23872/23877 passed (100.0%) 21252/21252 passed (100.0%) No change full result / delta
bigquery -> duckdb 2106/2624 passed (80.3%) 0/0 passed (0.0%) No change full result / delta
snowflake -> duckdb 1508/2674 passed (56.4%) 1511/2674 passed (56.5%) 4 fail -> pass
1 pass -> fail
full result / delta
snowflake -> snowflake 65910/65910 passed (100.0%) 65852/65910 passed (99.9%) 58 pass -> fail full result / delta
databricks -> databricks 1364/1364 passed (100.0%) 1364/1364 passed (100.0%) No change full result / delta
postgres -> postgres 6040/6040 passed (100.0%) 6040/6040 passed (100.0%) No change full result / delta
redshift -> redshift 7059/7059 passed (100.0%) 7059/7059 passed (100.0%) No change full result / delta

Overall

main: 109548 total, 107859 passed (pass rate: 98.5%), sqlglot version: 0.0.1.dev1

sqlglot:RD-1069319_TO_NUMBER_DECIMAL_NUMERIC: 108302 total, 107081 passed (pass rate: 98.9%), sqlglot version: RD-1069319_TO_NUMBER_DECIMAL_NUMERIC

Transitions:
4 fail -> pass
59 pass -> fail

✅ 1 test(s) passed

Copy link
Copy Markdown
Collaborator

@geooo109 geooo109 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happened to the rest of the commetns / cases like #7315 (comment) ? (update(edit: no need to resolve these comments for now))

@geooo109 geooo109 force-pushed the RD-1069319_TO_NUMBER_DECIMAL_NUMERIC branch from 9d9c9f4 to 2ddaef6 Compare March 27, 2026 15:29
@georgesittas
Copy link
Copy Markdown
Collaborator

/integration-tests

@georgesittas
Copy link
Copy Markdown
Collaborator

Let's not merge this until we figure out the test failures.

@treysp
Copy link
Copy Markdown
Collaborator

treysp commented Mar 31, 2026

/integration-tests

@georgesittas georgesittas force-pushed the RD-1069319_TO_NUMBER_DECIMAL_NUMERIC branch from 85d9b59 to 4806358 Compare April 6, 2026 10:45
Signed-off-by: George Sittas <giwrgos.sittas@gmail.com>
@georgesittas georgesittas force-pushed the RD-1069319_TO_NUMBER_DECIMAL_NUMERIC branch from 697cb76 to 7944560 Compare April 6, 2026 10:53
@georgesittas georgesittas merged commit 61bb18c into main Apr 6, 2026
7 checks passed
@georgesittas georgesittas deleted the RD-1069319_TO_NUMBER_DECIMAL_NUMERIC branch April 6, 2026 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants