Skip to content

Commit

Permalink
Fix: generate single argument ArrayConcat without trailing comma fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
georgesittas committed Oct 17, 2024
1 parent c43cae9 commit 51f4d26
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sqlglot/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -4253,7 +4253,7 @@ def arrayconcat_sql(self, expression: exp.ArrayConcat, name: str = "ARRAY_CONCAT
else:
rhs = self.expressions(expression)

return self.func(name, expression.this, rhs)
return self.func(name, expression.this, rhs or None)

def converttimezone_sql(self, expression: exp.ConvertTimezone) -> str:
if self.SUPPORTS_CONVERT_TIMEZONE:
Expand Down
1 change: 1 addition & 0 deletions tests/dialects/test_bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def test_bigquery(self):
select_with_quoted_udf = self.validate_identity("SELECT `p.d.UdF`(data) FROM `p.d.t`")
self.assertEqual(select_with_quoted_udf.selects[0].name, "p.d.UdF")

self.validate_identity("SELECT ARRAY_CONCAT([1])")
self.validate_identity("SELECT * FROM READ_CSV('bla.csv')")
self.validate_identity("CAST(x AS STRUCT<list ARRAY<INT64>>)")
self.validate_identity("assert.true(1 = 1)")
Expand Down

0 comments on commit 51f4d26

Please sign in to comment.