Skip to content

Commit 25330d5

Browse files
committed
Fix SQLGlot BigQuery array syntax for subquery expressions
1 parent cff43d7 commit 25330d5

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

  • packages/bigframes/third_party/bigframes_vendored/sqlglot/dialects

packages/bigframes/third_party/bigframes_vendored/sqlglot/dialects/dialect.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1236,7 +1236,14 @@ def inline_array_sql(self: Generator, expression: exp.Expression) -> str:
12361236

12371237
def inline_array_unless_query(self: Generator, expression: exp.Expression) -> str:
12381238
elem = seq_get(expression.expressions, 0)
1239-
if isinstance(elem, exp.Expression) and elem.find(exp.Query):
1239+
if (
1240+
len(expression.expressions) == 1
1241+
and isinstance(elem, exp.Expression)
1242+
and (
1243+
isinstance(elem, exp.Query)
1244+
or (isinstance(elem, exp.Subquery) and isinstance(elem.this, exp.Query))
1245+
)
1246+
):
12401247
return self.func("ARRAY", elem)
12411248
return inline_array_sql(self, expression)
12421249

0 commit comments

Comments
 (0)