Skip to content

Commit 8b48f7b

Browse files
feat(optimizer): Annotate type for snowflake SIGN and ABS functions (#6025)
* feat(optimizer): Annotate type for snowflake SIGN and ABS functions * fix: keeping ABS generic
1 parent 718d6bb commit 8b48f7b

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

tests/dialects/test_snowflake.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ def test_snowflake(self):
4747
self.validate_identity("SELECT RPAD(tbl.bin_col, 10)")
4848
self.validate_identity("SELECT SOUNDEX(column_name)")
4949
self.validate_identity("SELECT SOUNDEX_P123(column_name)")
50+
self.validate_identity("SELECT ABS(x)")
51+
self.validate_identity("SELECT SIGN(x)")
5052
self.validate_identity("SELECT JAROWINKLER_SIMILARITY('hello', 'world')")
5153
self.validate_identity("SELECT TRANSLATE(column_name, 'abc', '123')")
5254
self.validate_identity("SELECT UNICODE(column_name)")

tests/fixtures/optimizer/annotate_functions.sql

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1535,6 +1535,14 @@ STRUCT<str_col STRING>;
15351535
-- Snowflake
15361536
--------------------------------------
15371537

1538+
# dialect: snowflake
1539+
ABS(tbl.bigint_col);
1540+
BIGINT;
1541+
1542+
# dialect: snowflake
1543+
ABS(tbl.double_col);
1544+
DOUBLE;
1545+
15381546
# dialect: snowflake
15391547
AI_AGG('foo', 'bar');
15401548
VARCHAR;
@@ -2159,6 +2167,10 @@ VARCHAR;
21592167
SIN(tbl.double_col);
21602168
DOUBLE;
21612169

2170+
# dialect: snowflake
2171+
SIGN(tbl.double_col);
2172+
INT;
2173+
21622174
# dialect: snowflake
21632175
SOUNDEX(tbl.str_col);
21642176
VARCHAR;

0 commit comments

Comments
 (0)