Skip to content

Commit ef130f1

Browse files
feat(snowflake)!: Annotated type for ARRAY_CONSTRUCT_COMPACT #6496
1 parent 5a49c3f commit ef130f1

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

sqlglot/expressions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6030,7 +6030,7 @@ class ArrayConcatAgg(AggFunc):
60306030

60316031

60326032
class ArrayConstructCompact(Func):
6033-
arg_types = {"expressions": True}
6033+
arg_types = {"expressions": False}
60346034
is_var_len_args = True
60356035

60366036

sqlglot/typing/snowflake.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ def _annotate_math_with_float_decfloat(
190190
exp.ApproxTopK,
191191
exp.ApproxTopKEstimate,
192192
exp.ArrayAgg,
193+
exp.ArrayConstructCompact,
193194
exp.ArrayUniqueAgg,
194195
exp.ArrayUnionAgg,
195196
exp.RegexpExtractAll,

tests/fixtures/optimizer/annotate_functions.sql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1704,6 +1704,14 @@ DATE;
17041704
ADD_MONTHS(tbl.timestamp_col, -1);
17051705
TIMESTAMP;
17061706

1707+
# dialect: snowflake
1708+
ARRAY_CONSTRUCT_COMPACT();
1709+
ARRAY;
1710+
1711+
# dialect: snowflake
1712+
ARRAY_CONSTRUCT_COMPACT(1, null, 2);
1713+
ARRAY;
1714+
17071715
# dialect: snowflake
17081716
ASIN(tbl.double_col);
17091717
DOUBLE;

0 commit comments

Comments
 (0)