Closed
Description
Fully reproducible code snippet
In [12]: import sqlglot as sg, sqlglot.expressions as sge
In [13]: sg.__version__
Out[13]: '22.3.1'
In [14]: sge.ArrayJoin(this=sg.column("arg"), expression=sg.column("sep")).sql("bigquery")
Out[14]: 'ARRAY_JOIN(arg, sep)'
Interestingly, when I parse the result I get an ArrayJoin
instance and calling .sql
on the result of parse_one
generates the correct code, but constructing the object directly generates incorrect code:
In [20]: sg.parse_one("select array_to_string(arg, sep)", read="bigquery")
Out[20]:
Select(
expressions=[
ArrayJoin(
this=Column(
this=Identifier(this=arg, quoted=False)),
expression=Column(
this=Identifier(this=sep, quoted=False)))])
In [21]: sg.parse_one("select array_to_string(arg, sep)", read="bigquery").sql("bigquery")
Out[21]: 'SELECT array_to_string(arg, sep)'
Official Documentation
E.g., BigQuery has no function called array_join
: https://cloud.google.com/bigquery/docs/reference/standard-sql/array_functions
Metadata
Metadata
Assignees
Labels
No labels