Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sqlglot/dialects/snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@ class Snowflake(Dialect):
exp.AISummarizeAgg,
exp.Chr,
exp.Collate,
exp.HexDecodeString,
exp.RegexpExtract,
exp.RegexpReplace,
exp.Repeat,
Expand All @@ -557,6 +558,7 @@ class Snowflake(Dialect):
exp.MD5Digest,
exp.SHA1Digest,
exp.SHA2Digest,
exp.Unhex,
},
exp.DataType.Type.BIGINT: {
*Dialect.TYPE_TO_EXPRESSIONS[exp.DataType.Type.BIGINT],
Expand Down
4 changes: 4 additions & 0 deletions sqlglot/expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6469,6 +6469,10 @@ class Hex(Func):
pass


class HexDecodeString(Func):
pass


class LowerHex(Hex):
pass

Expand Down
1 change: 1 addition & 0 deletions tests/dialects/test_snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def test_snowflake(self):
"SELECT BASE64_DECODE_BINARY('SGVsbG8=', 'ABCDEFGHwxyz0123456789+/')"
)

self.validate_identity("SELECT HEX_DECODE_STRING('48656C6C6F')")
self.validate_identity("SELECT CHR(8364)")
self.validate_identity("SELECT {*} FROM my_table")
self.validate_identity("SELECT {my_table.*} FROM my_table")
Expand Down
8 changes: 8 additions & 0 deletions tests/fixtures/optimizer/annotate_functions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1575,6 +1575,14 @@ INT;
BASE64_DECODE_BINARY('SGVsbG8=');
BINARY;

# dialect: snowflake
HEX_DECODE_BINARY('48656C6C6F');
BINARY;

# dialect: snowflake
HEX_DECODE_STRING('48656C6C6F');
VARCHAR;

# dialect: snowflake
CHARINDEX('world', 'hello world');
INT;
Expand Down