Skip to content
Open
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
1 change: 1 addition & 0 deletions sqlglot/dialects/snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@ class Snowflake(Dialect):
},
exp.DataType.Type.ARRAY: {
exp.Split,
exp.RegexpExtractAll,
},
exp.DataType.Type.OBJECT: {
exp.ParseUrl,
Expand Down
40 changes: 40 additions & 0 deletions tests/fixtures/optimizer/annotate_functions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1895,6 +1895,26 @@ DECIMAL(38, 0);
REGEXP_COUNT('hello world', 'l', 1, 'i');
DECIMAL(38, 0);

# dialect: snowflake
REGEXP_EXTRACT_ALL('hello world', 'world');
ARRAY;

# dialect: snowflake
REGEXP_EXTRACT_ALL('hello world', 'world', 1);
ARRAY;

# dialect: snowflake
REGEXP_EXTRACT_ALL('hello world', 'world', 1, 1);
ARRAY;

# dialect: snowflake
REGEXP_EXTRACT_ALL('hello world', 'world', 1, 1, 'i');
ARRAY;

# dialect: snowflake
REGEXP_EXTRACT_ALL('hello world', 'world', 1, 1, 'i', 0);
ARRAY;

# dialect: snowflake
REGEXP_REPLACE('hello world', 'world', 'universe');
VARCHAR;
Expand Down Expand Up @@ -1927,6 +1947,26 @@ VARCHAR;
REGEXP_SUBSTR('hello world', 'world', 1, 1, 'e', NULL);
VARCHAR;

# dialect: snowflake
REGEXP_SUBSTR_ALL('hello world', 'world');
ARRAY;

# dialect: snowflake
REGEXP_SUBSTR_ALL('hello world', 'world', 1);
ARRAY;

# dialect: snowflake
REGEXP_SUBSTR_ALL('hello world', 'world', 1, 1);
ARRAY;

# dialect: snowflake
REGEXP_SUBSTR_ALL('hello world', 'world', 1, 1, 'i');
ARRAY;

# dialect: snowflake
REGEXP_SUBSTR_ALL('hello world', 'world', 1, 1, 'i', 0);
ARRAY;

# dialect: snowflake
REPEAT('hello', 3);
VARCHAR;
Expand Down