Skip to content

Commit c484ca3

Browse files
authored
Fix(bigquery)!: recognize ARRAY_CONCAT_AGG as an aggregate function (#5141)
1 parent 6e57619 commit c484ca3

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

sqlglot/expressions.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5539,6 +5539,10 @@ class ArrayConcat(Func):
55395539
is_var_len_args = True
55405540

55415541

5542+
class ArrayConcatAgg(AggFunc):
5543+
pass
5544+
5545+
55425546
class ArrayConstructCompact(Func):
55435547
arg_types = {"expressions": True}
55445548
is_var_len_args = True

tests/dialects/test_bigquery.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ def test_bigquery(self):
5555
select_with_quoted_udf = self.validate_identity("SELECT `p.d.UdF`(data) FROM `p.d.t`")
5656
self.assertEqual(select_with_quoted_udf.selects[0].name, "p.d.UdF")
5757

58+
self.validate_identity("ARRAY_CONCAT_AGG(x ORDER BY ARRAY_LENGTH(x) LIMIT 2)")
59+
self.validate_identity("ARRAY_CONCAT_AGG(x LIMIT 2)")
60+
self.validate_identity("ARRAY_CONCAT_AGG(x ORDER BY ARRAY_LENGTH(x))")
61+
self.validate_identity("ARRAY_CONCAT_AGG(x)")
5862
self.validate_identity("PARSE_TIMESTAMP('%Y-%m-%dT%H:%M:%E*S%z', x)")
5963
self.validate_identity("SELECT ARRAY_CONCAT([1])")
6064
self.validate_identity("SELECT * FROM READ_CSV('bla.csv')")

0 commit comments

Comments
 (0)