Skip to content

Commit 3bcf989

Browse files
authored
feat(snowflake): Transpile DataType.BIGDECIMAL to DOUBLE (#5092)
1 parent 066a44c commit 3bcf989

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

sqlglot/dialects/snowflake.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,6 +1132,7 @@ class Generator(generator.Generator):
11321132
**generator.Generator.TYPE_MAPPING,
11331133
exp.DataType.Type.NESTED: "OBJECT",
11341134
exp.DataType.Type.STRUCT: "OBJECT",
1135+
exp.DataType.Type.BIGDECIMAL: "DOUBLE",
11351136
}
11361137

11371138
TOKEN_MAPPING = {

tests/dialects/test_snowflake.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,6 +1061,16 @@ def test_snowflake(self):
10611061
dialect="snowflake",
10621062
)
10631063

1064+
self.validate_all(
1065+
"SELECT CAST(1 AS DOUBLE), CAST(1 AS DOUBLE)",
1066+
read={
1067+
"bigquery": "SELECT CAST(1 AS BIGDECIMAL), CAST(1 AS BIGNUMERIC)",
1068+
},
1069+
write={
1070+
"snowflake": "SELECT CAST(1 AS DOUBLE), CAST(1 AS DOUBLE)",
1071+
},
1072+
)
1073+
10641074
def test_null_treatment(self):
10651075
self.validate_all(
10661076
r"SELECT FIRST_VALUE(TABLE1.COLUMN1) OVER (PARTITION BY RANDOM_COLUMN1, RANDOM_COLUMN2 ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS MY_ALIAS FROM TABLE1",

0 commit comments

Comments
 (0)