internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: tobymao/sqlglot

Issue:
Parser error for Snowflake SQL when "window" is used as an alias
Hi All,

Trying to parse our Snowflake queries to perform some validations. Parser fails when the keyword "window" is used as an alias for a table. The SQL executes fine on Snowflake though. 

Code:

```
parsed_sql = parse_one(
    """
     SELECT
        dd.delivery_id
    FROM prod.public.orders o
    LEFT JOIN orders.public.order_assignment window on o.order_id = window.order_id
    WHERE active_dt BETWEEN '2023-06-28' and '2023-09-27'
  """,
    read="snowflake"
)
print(parsed_sql)
```

Error:

```
sqlglot.errors.ParseError: Invalid expression / Unexpected token. Line 5, Col: 57.
  d.delivery_id
    FROM prod.public.orders o
    LEFT JOIN orders.public.order_assignment window on o.order_id = window.order_id
    WHERE active_dt BETWEEN '2023-06-28' and '2023-09-27'
```

`sqlglot version - 18.8.0`


Discussion:

Resolving patch:
diff --git a/sqlglot/dialects/snowflake.py b/sqlglot/dialects/snowflake.py
--- a/sqlglot/dialects/snowflake.py
+++ b/sqlglot/dialects/snowflake.py
@@ -239,6 +239,8 @@ class Snowflake(Dialect):
     class Parser(parser.Parser):
         IDENTIFY_PIVOT_STRINGS = True
 
+        TABLE_ALIAS_TOKENS = parser.Parser.TABLE_ALIAS_TOKENS | {TokenType.WINDOW}
+
         FUNCTIONS = {
             **parser.Parser.FUNCTIONS,
             "ARRAYAGG": exp.ArrayAgg.from_arg_list,


Test patch:
diff --git a/tests/dialects/test_snowflake.py b/tests/dialects/test_snowflake.py
--- a/tests/dialects/test_snowflake.py
+++ b/tests/dialects/test_snowflake.py
@@ -50,6 +50,10 @@ def test_snowflake(self):
         self.validate_identity(
             "SELECT state, city, SUM(retail_price * quantity) AS gross_revenue FROM sales GROUP BY ALL"
         )
+        self.validate_identity(
+            "SELECT * FROM foo window",
+            "SELECT * FROM foo AS window",
+        )
         self.validate_identity(
             r"SELECT RLIKE(a, $$regular expression with \ characters: \d{2}-\d{3}-\d{4}$$, 'i') FROM log_source",
             r"SELECT REGEXP_LIKE(a, 'regular expression with \\ characters: \\d{2}-\\d{3}-\\d{4}', 'i') FROM log_source",
Repository: tobymao/sqlglot

Issue:
Support '' to escape single quote character in a string in Redshift dialect
**Fully reproducible code snippet**

```python
import sqlglot

sql_code = """
CREATE TABLE IF NOT EXISTS myschema.mytable (
    mycolumn bigint,
)
DISTKEY (mycolumn)
SORTKEY (mycolumn)
 ;
COMMENT ON COLUMN myschema.mytable.mycolumn IS 'my example = \\'working\\'';
COMMENT ON COLUMN myschema.mytable.mycolumn IS 'my example = ''not working''';
"""
expressions = sqlglot.parse(sql_code, read="redshift")
```

Error: 

```console
Traceback (most recent call last):
    ...
    raise error
sqlglot.errors.ParseError: Invalid expression / Unexpected token. Line 9, Col: 75.
  column IS 'my example = \'working\'';
COMMENT ON COLUMN myschema.mytable.mycolumn IS 'my example = ''not working''';
```

**Official Documentation**

I couldn't find the right documentation on AWS that explains this, but I ran the query on Redshift and it works perfectly.



Discussion:

Resolving patch:
diff --git a/sqlglot/dialects/redshift.py b/sqlglot/dialects/redshift.py
--- a/sqlglot/dialects/redshift.py
+++ b/sqlglot/dialects/redshift.py
@@ -83,7 +83,7 @@ def _parse_convert(self, strict: bool) -> t.Optional[exp.Expression]:
     class Tokenizer(Postgres.Tokenizer):
         BIT_STRINGS = []
         HEX_STRINGS = []
-        STRING_ESCAPES = ["\\"]
+        STRING_ESCAPES = ["\\", "'"]
 
         KEYWORDS = {
             **Postgres.Tokenizer.KEYWORDS,


Test patch:
diff --git a/tests/dialects/test_redshift.py b/tests/dialects/test_redshift.py
--- a/tests/dialects/test_redshift.py
+++ b/tests/dialects/test_redshift.py
@@ -6,6 +6,11 @@ class TestRedshift(Validator):
     dialect = "redshift"
 
     def test_redshift(self):
+        self.validate_identity(
+            "SELECT 'a''b'",
+            "SELECT 'a\\'b'",
+        )
+
         self.validate_all(
             "x ~* 'pat'",
             write={
Repository: tobymao/sqlglot

Issue:
Parsing columns with reserved names
I often find cases when databases use reserved words as a column name, for example `left` or `key`. Reserved words are permitted as identifiers if you quote them. The library cannot parse such syntax.

**Fully reproducible code snippet**
```python
    sql = """
        CREATE TABLE `oauth_consumer` (
            `key` varchar(32) NOT NULL,
            UNIQUE KEY `OAUTH_CONSUMER_KEY` (`key`),
        );
    """
    parsed_sql_exprs = sqlglot.parse(sql, read="mysql")
```

**Official Documentation**
[Please include links to official SQL documentation related to your issue.](https://dev.mysql.com/doc/refman/8.0/en/keywords.html)



Discussion:

Resolving patch:
diff --git a/sqlglot/parser.py b/sqlglot/parser.py
--- a/sqlglot/parser.py
+++ b/sqlglot/parser.py
@@ -3892,7 +3892,9 @@ def _parse_constraint(self) -> t.Optional[exp.Expression]:
     def _parse_unnamed_constraint(
         self, constraints: t.Optional[t.Collection[str]] = None
     ) -> t.Optional[exp.Expression]:
-        if not self._match_texts(constraints or self.CONSTRAINT_PARSERS):
+        if self._match(TokenType.IDENTIFIER, advance=False) or not self._match_texts(
+            constraints or self.CONSTRAINT_PARSERS
+        ):
             return None
 
         constraint = self._prev.text.upper()


Test patch:
diff --git a/tests/dialects/test_mysql.py b/tests/dialects/test_mysql.py
--- a/tests/dialects/test_mysql.py
+++ b/tests/dialects/test_mysql.py
@@ -29,6 +29,9 @@ def test_ddl(self):
         self.validate_identity("CREATE TABLE foo (a BIGINT, INDEX USING BTREE (b))")
         self.validate_identity("CREATE TABLE foo (a BIGINT, FULLTEXT INDEX (b))")
         self.validate_identity("CREATE TABLE foo (a BIGINT, SPATIAL INDEX (b))")
+        self.validate_identity(
+            "CREATE TABLE `oauth_consumer` (`key` VARCHAR(32) NOT NULL, UNIQUE `OAUTH_CONSUMER_KEY` (`key`))"
+        )
         self.validate_identity(
             "CREATE TABLE `x` (`username` VARCHAR(200), PRIMARY KEY (`username`(16)))"
         )
Repository: tobymao/sqlglot

Issue:
teradata `locking row access`

**Fully reproducible code snippet**
Please include a fully reproducible code snippet or the input sql, dialect, and expected output.

For the teradata dialect, the `FOR` in `LOCKING ROW FOR ACCESS` is not required. This currently throws a parsing error.

```sql
REPLACE VIEW view_b
(
COL1,
COL2
) AS
LOCKING ROW ACCESS
SELECT
COL1,
COL2
FROM table_b
;
```

**Official Documentation**
Please include links to official SQL documentation related to your issue.

See page 330 of https://downloads.teradata.com/sites/all/files/documentation/linked_docs/2414020A_BTEQ-Reference-13.10.pdf (it's for create view, but replace view works the same)


Discussion:

Resolving patch:
diff --git a/sqlglot/expressions.py b/sqlglot/expressions.py
--- a/sqlglot/expressions.py
+++ b/sqlglot/expressions.py
@@ -2107,7 +2107,7 @@ class LockingProperty(Property):
     arg_types = {
         "this": False,
         "kind": True,
-        "for_or_in": True,
+        "for_or_in": False,
         "lock_type": True,
         "override": False,
     }
diff --git a/sqlglot/generator.py b/sqlglot/generator.py
--- a/sqlglot/generator.py
+++ b/sqlglot/generator.py
@@ -1226,9 +1226,10 @@ def lockingproperty_sql(self, expression: exp.LockingProperty) -> str:
         kind = expression.args.get("kind")
         this = f" {self.sql(expression, 'this')}" if expression.this else ""
         for_or_in = expression.args.get("for_or_in")
+        for_or_in = f" {for_or_in}" if for_or_in else ""
         lock_type = expression.args.get("lock_type")
         override = " OVERRIDE" if expression.args.get("override") else ""
-        return f"LOCKING {kind}{this} {for_or_in} {lock_type}{override}"
+        return f"LOCKING {kind}{this}{for_or_in} {lock_type}{override}"
 
     def withdataproperty_sql(self, expression: exp.WithDataProperty) -> str:
         data_sql = f"WITH {'NO ' if expression.args.get('no') else ''}DATA"


Test patch:
diff --git a/tests/dialects/test_teradata.py b/tests/dialects/test_teradata.py
--- a/tests/dialects/test_teradata.py
+++ b/tests/dialects/test_teradata.py
@@ -48,6 +48,14 @@ def test_statistics(self):
         self.validate_identity("HELP STATISTICS personnel.employee FROM my_qcd")
 
     def test_create(self):
+        self.validate_identity(
+            "REPLACE VIEW view_b (COL1, COL2) AS LOCKING ROW FOR ACCESS SELECT COL1, COL2 FROM table_b",
+            "CREATE OR REPLACE VIEW view_b (COL1, COL2) AS LOCKING ROW FOR ACCESS SELECT COL1, COL2 FROM table_b",
+        )
+        self.validate_identity(
+            "REPLACE VIEW view_b (COL1, COL2) AS LOCKING ROW FOR ACCESS SELECT COL1, COL2 FROM table_b",
+            "CREATE OR REPLACE VIEW view_b (COL1, COL2) AS LOCKING ROW FOR ACCESS SELECT COL1, COL2 FROM table_b",
+        )
         self.validate_identity("CREATE TABLE x (y INT) PRIMARY INDEX (y) PARTITION BY y INDEX (y)")
         self.validate_identity("CREATE TABLE x (y INT) PARTITION BY y INDEX (y)")
         self.validate_identity(
Repository: tobymao/sqlglot

Issue:
`REGEXP_I_LIKE` method doesn't exist in ClickHouse
**Fully reproducible code snippet**

sqlglot converts regexp ilike to `REGEXP_I_LIKE` in ClickHouse which doesn't exist.

```py
import sqlglot

sql = "'thomas' ~* '.*thomas.*'"
print(sqlglot.parse_one(sql, read='postgres').sql(dialect='clickhouse'))
#> REGEXP_I_LIKE('thomas', '.*thomas.*')
```

The the best option of an equivalent I've found is something like `f"match('{haystack}', '{pattern}?i')"` to use the [`match`](https://clickhouse.com/docs/en/sql-reference/functions/string-search-functions#match) function.

<details>
<summary>Confirmation the function doesn't exist</summary>

There's no such `REGEXP_I_LIKE` method in Clickhouse, so no documentation to link to, but here's the output if I run that query against CH:

```
SELECT REGEXP_I_LIKE('thomas', '.*thomas.*')

Query id: f38f80b0-59a7-4146-b33c-e345078480ee


0 rows in set. Elapsed: 0.447 sec. 

Received exception from server (version 23.8.1):
Code: 46. DB::Exception: Received from localhost:9000. DB::Exception: Unknown function REGEXP_I_LIKE. Maybe you meant: ['REGEXP_REPLACE']: While processing REGEXP_I_LIKE('thomas', '.*thomas.*'). (UNKNOWN_FUNCTION)
```

</details>



Discussion:

Resolving patch:
diff --git a/sqlglot/dialects/clickhouse.py b/sqlglot/dialects/clickhouse.py
--- a/sqlglot/dialects/clickhouse.py
+++ b/sqlglot/dialects/clickhouse.py
@@ -418,6 +418,11 @@ class Generator(generator.Generator):
             "NAMED COLLECTION",
         }
 
+        def regexpilike_sql(self, expression: exp.RegexpILike) -> str:
+            # Manually add a flag to make the search case-insensitive
+            regex = self.func("CONCAT", "'(?i)'", expression.expression)
+            return f"match({self.format_args(expression.this, regex)})"
+
         def datatype_sql(self, expression: exp.DataType) -> str:
             # String is the standard ClickHouse type, every other variant is just an alias.
             # Additionally, any supplied length parameter will be ignored.


Test patch:
diff --git a/tests/dialects/test_clickhouse.py b/tests/dialects/test_clickhouse.py
--- a/tests/dialects/test_clickhouse.py
+++ b/tests/dialects/test_clickhouse.py
@@ -85,6 +85,18 @@ def test_clickhouse(self):
             "CREATE MATERIALIZED VIEW test_view (id UInt8) TO db.table1 AS SELECT * FROM test_data"
         )
 
+        self.validate_all(
+            "SELECT match('ThOmAs', CONCAT('(?i)', 'thomas'))",
+            read={
+                "postgres": "SELECT 'ThOmAs' ~* 'thomas'",
+            },
+        )
+        self.validate_all(
+            "SELECT match('ThOmAs', CONCAT('(?i)', x)) FROM t",
+            read={
+                "postgres": "SELECT 'ThOmAs' ~* x FROM t",
+            },
+        )
         self.validate_all(
             "SELECT '\\0'",
             read={
Repository: tobymao/sqlglot

Issue:
Clickhouse `CURRENT_DATE` is not rendered as a function
```py
import sqlglot

print('version:', sqlglot.__version__)

print(sqlglot.transpile('select current_date', read='postgres', write='clickhouse'))
```

Outputs:

```
version: 18.16.1
['SELECT CURRENT_DATE']
```

This is invalid in Clickhouse, see [the docs](https://clickhouse.com/docs/en/sql-reference/functions/date-time-functions#today), `CURRENT_DATE` (alias of `today` and `curdate`) is a function, thus the output in this case should be `SELECT current_date()`.

Case doesn't seem to matter in this this case, although the docs show lowercase.


Discussion:

Resolving patch:
diff --git a/sqlglot/dialects/clickhouse.py b/sqlglot/dialects/clickhouse.py
--- a/sqlglot/dialects/clickhouse.py
+++ b/sqlglot/dialects/clickhouse.py
@@ -375,6 +375,7 @@ class Generator(generator.Generator):
             exp.ApproxDistinct: rename_func("uniq"),
             exp.Array: inline_array_sql,
             exp.CastToStrType: rename_func("CAST"),
+            exp.CurrentDate: lambda self, e: self.func("CURRENT_DATE"),
             exp.DateAdd: lambda self, e: self.func(
                 "DATE_ADD", exp.Literal.string(e.text("unit") or "day"), e.expression, e.this
             ),


Test patch:
diff --git a/tests/dialects/test_clickhouse.py b/tests/dialects/test_clickhouse.py
--- a/tests/dialects/test_clickhouse.py
+++ b/tests/dialects/test_clickhouse.py
@@ -101,6 +101,20 @@ def test_clickhouse(self):
             "CREATE MATERIALIZED VIEW test_view (id UInt8) TO db.table1 AS SELECT * FROM test_data"
         )
 
+        self.validate_all(
+            "SELECT CURRENT_DATE()",
+            read={
+                "clickhouse": "SELECT CURRENT_DATE()",
+                "postgres": "SELECT CURRENT_DATE",
+            },
+        )
+        self.validate_all(
+            "SELECT CURRENT_TIMESTAMP()",
+            read={
+                "clickhouse": "SELECT CURRENT_TIMESTAMP()",
+                "postgres": "SELECT CURRENT_TIMESTAMP",
+            },
+        )
         self.validate_all(
             "SELECT match('ThOmAs', CONCAT('(?i)', 'thomas'))",
             read={
Repository: tobymao/sqlglot

Issue:
Erroneous handling of redshift's JSON_PARSE
**sqlglot version: 18.16.1**

**Fully reproducible code snippet**
```python
import sqlglot
sql = "SELECT JSON_PARSE('[10001,10002,\"abc\"]');"
parsed = sqlglot.parse_one(sql,dialect="redshift")
parsed.sql(dialect="redshift")
#'SELECT PARSE_JSON(\'[10001,10002,"abc"]\')'
```
The generated sql triggers an error when executed in redshift

>Failed to execute query: ERROR: function parse_json("unknown") does not exist
  Hint: No function matches the given name and argument types. You may need to add explicit type casts.

**Official Documentation**
https://docs.aws.amazon.com/redshift/latest/dg/JSON_PARSE.html



Discussion:

Resolving patch:
diff --git a/sqlglot/dialects/redshift.py b/sqlglot/dialects/redshift.py
--- a/sqlglot/dialects/redshift.py
+++ b/sqlglot/dialects/redshift.py
@@ -175,6 +175,7 @@ class Generator(Postgres.Generator):
             exp.GeneratedAsIdentityColumnConstraint: generatedasidentitycolumnconstraint_sql,
             exp.JSONExtract: _json_sql,
             exp.JSONExtractScalar: _json_sql,
+            exp.ParseJSON: rename_func("JSON_PARSE"),
             exp.SafeConcat: concat_to_dpipe_sql,
             exp.Select: transforms.preprocess(
                 [transforms.eliminate_distinct_on, transforms.eliminate_semi_and_anti_joins]


Test patch:
diff --git a/tests/dialects/test_redshift.py b/tests/dialects/test_redshift.py
--- a/tests/dialects/test_redshift.py
+++ b/tests/dialects/test_redshift.py
@@ -310,6 +310,7 @@ def test_identity(self):
         self.validate_identity(
             "SELECT attr AS attr, JSON_TYPEOF(val) AS value_type FROM customer_orders_lineitem AS c, UNPIVOT c.c_orders AS val AT attr WHERE c_custkey = 9451"
         )
+        self.validate_identity("SELECT JSON_PARSE('[]')")
 
     def test_values(self):
         # Test crazy-sized VALUES clause to UNION ALL conversion to ensure we don't get RecursionError
Repository: tobymao/sqlglot

Issue:
'USE' is not a reserved keyword for postgres.
SQLGlot 18.11.2

**Fully reproducible code snippet**
I am trying to parse a SQL in Postgres syntax like this example.
`test_sql = '''SELECT NVL(use.a, 0, 1) FROM t as use;'''`
`test_ast = parse_one(test_sql, read='postgres')`
This would raise a ParseError on 'use'.

**Official Documentation**
Postgres Reserved Keyword [documentation](https://www.postgresql.org/docs/current/sql-keywords-appendix.html).
Oracle Reserved Keyword [documentation](https://docs.oracle.com/cd/A58617_01/server.804/a58234/vol2_wor.htm).

USE is not a reserved keyword in Postgres, as well as Oracle, which means the syntax is valid. I am wondering if you could kindly fix it.

Thanks.


Discussion:
I know this is not a well-written style, but this is what I got from our clients. They have multiple queries written like this. T-T

Resolving patch:
diff --git a/sqlglot/parser.py b/sqlglot/parser.py
--- a/sqlglot/parser.py
+++ b/sqlglot/parser.py
@@ -313,6 +313,7 @@ class Parser(metaclass=_Parser):
         TokenType.UNIQUE,
         TokenType.UNPIVOT,
         TokenType.UPDATE,
+        TokenType.USE,
         TokenType.VOLATILE,
         TokenType.WINDOW,
         *CREATABLES,


Test patch:
diff --git a/tests/fixtures/identity.sql b/tests/fixtures/identity.sql
--- a/tests/fixtures/identity.sql
+++ b/tests/fixtures/identity.sql
@@ -866,3 +866,4 @@ KILL CONNECTION 123
 KILL QUERY '123'
 CHR(97)
 SELECT * FROM UNNEST(x) WITH ORDINALITY UNION ALL SELECT * FROM UNNEST(y) WITH ORDINALITY
+WITH use(use) AS (SELECT 1) SELECT use FROM use
Repository: tobymao/sqlglot

Issue:
approx_top_k is not recognized as an aggregation function in Snowflake
**Fully reproducible code snippet**

```python
from sqlglot import Dialects, exp, parse_one

query = "SELECT approx_top_k(field, 5) FROM  some_table"
parsed_query = parse_one(query, read=Dialects.SNOWFLAKE.value)
agg_funcs = parsed_query.find_all(exp.AggFunc)
has_agg_funcs = any(agg_funcs) # getting False, expected True

```

**Official Documentation**
https://docs.snowflake.com/en/sql-reference/functions/approx_top_k



Discussion:

Resolving patch:
diff --git a/sqlglot/expressions.py b/sqlglot/expressions.py
--- a/sqlglot/expressions.py
+++ b/sqlglot/expressions.py
@@ -4174,6 +4174,10 @@ class Abs(Func):
     pass
 
 
+class ApproxTopK(AggFunc):
+    arg_types = {"this": True, "expression": False, "counters": False}
+
+
 class Flatten(Func):
     pass
 


Test patch:
diff --git a/tests/dialects/test_snowflake.py b/tests/dialects/test_snowflake.py
--- a/tests/dialects/test_snowflake.py
+++ b/tests/dialects/test_snowflake.py
@@ -9,6 +9,10 @@ class TestSnowflake(Validator):
     dialect = "snowflake"
 
     def test_snowflake(self):
+        expr = parse_one("SELECT APPROX_TOP_K(C4, 3, 5) FROM t")
+        expr.selects[0].assert_is(exp.AggFunc)
+        self.assertEqual(expr.sql(dialect="snowflake"), "SELECT APPROX_TOP_K(C4, 3, 5) FROM t")
+
         self.validate_identity("SELECT DAYOFMONTH(CURRENT_TIMESTAMP())")
         self.validate_identity("SELECT DAYOFYEAR(CURRENT_TIMESTAMP())")
         self.validate_identity("LISTAGG(data['some_field'], ',')")
Repository: tobymao/sqlglot

Issue:
BigQuery to DuckDB transpiring creates incorrect query
```
import sqlglot
from sqlglot.errors import ErrorLevel
from sqlglot.dialects.dialect import Dialects

query = """
WITH
  Sequences AS (
    SELECT 1 AS id, [0, 1, 1, 2, 3, 5] AS some_numbers
    UNION ALL
    SELECT 2 AS id, [2, 4, 8, 16, 32] AS some_numbers
    UNION ALL
    SELECT 3 AS id, [5, 10] AS some_numbers
  )
SELECT id AS matching_rows
FROM Sequences
WHERE EXISTS(SELECT * FROM UNNEST(some_numbers) AS x WHERE x > 5);
"""
sqlglot.transpile(query, read=Dialects.BIGQUERY, write=Dialects.DUCKDB, error_level=ErrorLevel.RAISE)
```

This gives:
```
'WITH Sequences AS (SELECT 1 AS id, [0, 1, 1, 2, 3, 5] AS some_numbers UNION ALL SELECT 2 AS id, [2, 4, 8, 16, 32] AS some_numbers UNION ALL SELECT 3 AS id, [5, 10] AS some_numbers) SELECT id AS matching_rows FROM Sequences WHERE EXISTS(SELECT * FROM UNNEST(some_numbers) AS (x) WHERE x > 5)'
```

but the `AS (x)` was supposed to be `AS tbl(x)`





Discussion:

Resolving patch:
diff --git a/sqlglot/generator.py b/sqlglot/generator.py
--- a/sqlglot/generator.py
+++ b/sqlglot/generator.py
@@ -891,6 +891,10 @@ def tablealias_sql(self, expression: exp.TableAlias) -> str:
         alias = self.sql(expression, "this")
         columns = self.expressions(expression, key="columns", flat=True)
         columns = f"({columns})" if columns else ""
+
+        if not alias and not self.UNNEST_COLUMN_ONLY:
+            alias = "_t"
+
         return f"{alias}{columns}"
 
     def bitstring_sql(self, expression: exp.BitString) -> str:


Test patch:
diff --git a/tests/dialects/test_bigquery.py b/tests/dialects/test_bigquery.py
--- a/tests/dialects/test_bigquery.py
+++ b/tests/dialects/test_bigquery.py
@@ -142,6 +142,13 @@ def test_bigquery(self):
         self.validate_all('x <> """"""', write={"bigquery": "x <> ''"})
         self.validate_all("x <> ''''''", write={"bigquery": "x <> ''"})
         self.validate_all("CAST(x AS DATETIME)", read={"": "x::timestamp"})
+        self.validate_all(
+            "SELECT * FROM t WHERE EXISTS(SELECT * FROM unnest(nums) AS x WHERE x > 1)",
+            write={
+                "bigquery": "SELECT * FROM t WHERE EXISTS(SELECT * FROM UNNEST(nums) AS x WHERE x > 1)",
+                "duckdb": "SELECT * FROM t WHERE EXISTS(SELECT * FROM UNNEST(nums) AS _t(x) WHERE x > 1)",
+            },
+        )
         self.validate_all(
             "NULL",
             read={
@@ -476,9 +483,8 @@ def test_bigquery(self):
             },
             write={
                 "bigquery": "SELECT * FROM UNNEST(['7', '14']) AS x",
-                "presto": "SELECT * FROM UNNEST(ARRAY['7', '14']) AS (x)",
-                "hive": "SELECT * FROM UNNEST(ARRAY('7', '14')) AS (x)",
-                "spark": "SELECT * FROM UNNEST(ARRAY('7', '14')) AS (x)",
+                "presto": "SELECT * FROM UNNEST(ARRAY['7', '14']) AS _t(x)",
+                "spark": "SELECT * FROM UNNEST(ARRAY('7', '14')) AS _t(x)",
             },
         )
         self.validate_all(
Repository: tobymao/sqlglot

Issue:
object_construct() is giving error for Snowflake dialect
Invoking object_construct() without any arguments throws the following error:

`ParseError: Required keyword: 'expressions' missing for <class 'sqlglot.expressions.Struct'>.` 

This looks to be a regression from when support for object_construct(*) was added.

Simple sample code to reproduce:
```python
import sqlglot

sql = "SELECT object_construct() FROM users"
statements = sqlglot.transpile(sql, read="snowflake", write="snowflake", pretty=True)
print(statements[0])
```

Expected output:
```
SELECT
  OBJECT_CONSTRUCT()
FROM users
```



Discussion:

Resolving patch:
diff --git a/sqlglot/expressions.py b/sqlglot/expressions.py
--- a/sqlglot/expressions.py
+++ b/sqlglot/expressions.py
@@ -5049,7 +5049,7 @@ class FromBase(Func):
 
 
 class Struct(Func):
-    arg_types = {"expressions": True}
+    arg_types = {"expressions": False}
     is_var_len_args = True
 
 


Test patch:
diff --git a/tests/dialects/test_snowflake.py b/tests/dialects/test_snowflake.py
--- a/tests/dialects/test_snowflake.py
+++ b/tests/dialects/test_snowflake.py
@@ -13,6 +13,7 @@ def test_snowflake(self):
         expr.selects[0].assert_is(exp.AggFunc)
         self.assertEqual(expr.sql(dialect="snowflake"), "SELECT APPROX_TOP_K(C4, 3, 5) FROM t")
 
+        self.validate_identity("SELECT OBJECT_CONSTRUCT()")
         self.validate_identity("SELECT DAYOFMONTH(CURRENT_TIMESTAMP())")
         self.validate_identity("SELECT DAYOFYEAR(CURRENT_TIMESTAMP())")
         self.validate_identity("LISTAGG(data['some_field'], ',')")