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

Issue:
[BUG]In PostgreSQL, int8 represents the 64-bit integer type, not tinyint
**Fully reproducible code snippet**
```python3
import sqlglot

if __name__ == '__main__':
    sql = """create table a_table
        (
            column_id      int8 not null constraint a_table_pk primary key,
            column_2       date,
            column_3       varchar(2000),
            column_4       int2,
            column_5       int4
        );
    """
    expressions = sqlglot.parse(sql, dialect="postgres")
    expression = expressions[0]
    print(expression.sql())
```

output

```txt
CREATE TABLE a_table (column_id **TINYINT** NOT NULL CONSTRAINT a_table_pk PRIMARY KEY, column_2 DATE, column_3 VARCHAR(2000), column_4 SMALLINT, column_5 INT)
```
"int8" being mistranslated as "tinyint"

**Official Documentation**

postgresql 10 official document: [https://www.postgresql.org/docs/10/datatype.html#DATATYPE-TABLE](https://www.postgresql.org/docs/10/datatype.html#DATATYPE-TABLE)



Discussion:

Resolving patch:
diff --git a/sqlglot/dialects/postgres.py b/sqlglot/dialects/postgres.py
--- a/sqlglot/dialects/postgres.py
+++ b/sqlglot/dialects/postgres.py
@@ -266,24 +266,25 @@ class Tokenizer(tokens.Tokenizer):
             "BIGSERIAL": TokenType.BIGSERIAL,
             "CHARACTER VARYING": TokenType.VARCHAR,
             "CONSTRAINT TRIGGER": TokenType.COMMAND,
+            "CSTRING": TokenType.PSEUDO_TYPE,
             "DECLARE": TokenType.COMMAND,
             "DO": TokenType.COMMAND,
             "EXEC": TokenType.COMMAND,
             "HSTORE": TokenType.HSTORE,
+            "INT8": TokenType.BIGINT,
             "JSONB": TokenType.JSONB,
             "MONEY": TokenType.MONEY,
+            "NAME": TokenType.NAME,
+            "OID": TokenType.OBJECT_IDENTIFIER,
+            "ONLY": TokenType.ONLY,
+            "OPERATOR": TokenType.OPERATOR,
             "REFRESH": TokenType.COMMAND,
             "REINDEX": TokenType.COMMAND,
             "RESET": TokenType.COMMAND,
             "REVOKE": TokenType.COMMAND,
             "SERIAL": TokenType.SERIAL,
             "SMALLSERIAL": TokenType.SMALLSERIAL,
-            "NAME": TokenType.NAME,
             "TEMP": TokenType.TEMPORARY,
-            "CSTRING": TokenType.PSEUDO_TYPE,
-            "OID": TokenType.OBJECT_IDENTIFIER,
-            "ONLY": TokenType.ONLY,
-            "OPERATOR": TokenType.OPERATOR,
             "REGCLASS": TokenType.OBJECT_IDENTIFIER,
             "REGCOLLATION": TokenType.OBJECT_IDENTIFIER,
             "REGCONFIG": TokenType.OBJECT_IDENTIFIER,


Test patch:
diff --git a/tests/dialects/test_postgres.py b/tests/dialects/test_postgres.py
--- a/tests/dialects/test_postgres.py
+++ b/tests/dialects/test_postgres.py
@@ -320,6 +320,10 @@ def test_postgres(self):
             "SELECT SUBSTRING('afafa' for 1)",
             "SELECT SUBSTRING('afafa' FROM 1 FOR 1)",
         )
+        self.validate_identity(
+            "CAST(x AS INT8)",
+            "CAST(x AS BIGINT)",
+        )
 
         self.validate_all(
             "CREATE TABLE t (c INT)",
Repository: tobymao/sqlglot

Issue:
bug(mssql): incorrect syntax for creating quoted temporary table
```python
[ins] In [1]: import sqlglot as sg

[ins] In [2]: sg.__version__
Out[2]: '23.12.3.dev11'

[ins] In [3]: exp = sg.parse_one(
         ...:     "CREATE TEMPORARY TABLE 'temptest' (name VARCHAR);", dialect="duckdb"
         ...: )

[ins] In [4]: exp
Out[4]: 
Create(
  this=Schema(
    this=Table(
      this=Identifier(this=temptest, quoted=True)),
    expressions=[
      ColumnDef(
        this=Identifier(this=name, quoted=False),
        kind=DataType(this=Type.VARCHAR, nested=False))]),
  kind=TABLE,
  properties=Properties(
    expressions=[
      TemporaryProperty()]))

[ins] In [5]: exp.sql(dialect="tsql")
Out[5]: 'CREATE TABLE #[temptest] (name VARCHAR)'
```

`#[temptest]` is invalid syntax.  I am not sure of how to use the `#` temp indicator with a quoted identifier -- it IS possible to create a temporary table that requires quoting but the only way I have figured out how to do it is by specifying the catalog and database explicitly, e.g. 

```sql
CREATE TABLE tempdb.dbo.[quoted@identifer] ([name] VARCHAR(max))
```

**Official Documentation**
https://learn.microsoft.com/en-us/sql/t-sql/statements/create-table-transact-sql?view=sql-server-ver16#syntax-options
https://learn.microsoft.com/en-us/sql/relational-databases/databases/database-identifiers?view=sql-server-ver16#classes-of-identifiers

xref: https://github.com/ibis-project/ibis/issues/9095



Discussion:
This seems like a T-SQL syntax edge case, i.e. what you said here:

>  I am not sure of how to use the # temp indicator with a quoted identifier

I also couldn't find any way to make this work. I'll fix it up, thanks for the report.

Resolving patch:
diff --git a/sqlglot/dialects/tsql.py b/sqlglot/dialects/tsql.py
--- a/sqlglot/dialects/tsql.py
+++ b/sqlglot/dialects/tsql.py
@@ -913,7 +913,7 @@ def createable_sql(self, expression: exp.Create, locations: t.DefaultDict) -> st
                 isinstance(prop, exp.TemporaryProperty)
                 for prop in (properties.expressions if properties else [])
             ):
-                sql = f"#{sql}"
+                sql = f"[#{sql[1:]}" if sql.startswith("[") else f"#{sql}"
 
             return sql
 


Test patch:
diff --git a/tests/dialects/test_tsql.py b/tests/dialects/test_tsql.py
--- a/tests/dialects/test_tsql.py
+++ b/tests/dialects/test_tsql.py
@@ -780,6 +780,14 @@ def test_ddl(self):
             "CREATE PROCEDURE foo AS BEGIN DELETE FROM bla WHERE foo < CURRENT_TIMESTAMP - 7 END",
             "CREATE PROCEDURE foo AS BEGIN DELETE FROM bla WHERE foo < GETDATE() - 7 END",
         )
+
+        self.validate_all(
+            "CREATE TABLE [#temptest] (name VARCHAR)",
+            read={
+                "duckdb": "CREATE TEMPORARY TABLE 'temptest' (name VARCHAR)",
+                "tsql": "CREATE TABLE [#temptest] (name VARCHAR)",
+            },
+        )
         self.validate_all(
             "CREATE TABLE tbl (id INTEGER IDENTITY PRIMARY KEY)",
             read={
Repository: tobymao/sqlglot

Issue:
support "replace into"
When SQL contains "replace into", parsing SQL will report an error
`
sql_query = 'replace into table1 select id from table2 where cnt > 100'
`


Discussion:
Hi, thanks for reporting this, will take a look. This is MySQL, right? 

For future reference, please specify the dialect you're trying to parse this in as well as any documentation showcasing the syntax.

Resolving patch:
diff --git a/sqlglot/dialects/mysql.py b/sqlglot/dialects/mysql.py
--- a/sqlglot/dialects/mysql.py
+++ b/sqlglot/dialects/mysql.py
@@ -251,7 +251,7 @@ class Tokenizer(tokens.Tokenizer):
             "@@": TokenType.SESSION_PARAMETER,
         }
 
-        COMMANDS = tokens.Tokenizer.COMMANDS - {TokenType.SHOW}
+        COMMANDS = {*tokens.Tokenizer.COMMANDS, TokenType.REPLACE} - {TokenType.SHOW}
 
     class Parser(parser.Parser):
         FUNC_TOKENS = {
diff --git a/sqlglot/dialects/tsql.py b/sqlglot/dialects/tsql.py
--- a/sqlglot/dialects/tsql.py
+++ b/sqlglot/dialects/tsql.py
@@ -474,6 +474,8 @@ class Tokenizer(tokens.Tokenizer):
             "OPTION": TokenType.OPTION,
         }
 
+        COMMANDS = {*tokens.Tokenizer.COMMANDS, TokenType.END}
+
     class Parser(parser.Parser):
         SET_REQUIRES_ASSIGNMENT_DELIMITER = False
         LOG_DEFAULTS_TO_LN = True
@@ -524,11 +526,6 @@ class Parser(parser.Parser):
             *parser.Parser.TYPE_TOKENS,
         }
 
-        STATEMENT_PARSERS = {
-            **parser.Parser.STATEMENT_PARSERS,
-            TokenType.END: lambda self: self._parse_command(),
-        }
-
         def _parse_options(self) -> t.Optional[t.List[exp.Expression]]:
             if not self._match(TokenType.OPTION):
                 return None
diff --git a/sqlglot/parser.py b/sqlglot/parser.py
--- a/sqlglot/parser.py
+++ b/sqlglot/parser.py
@@ -1471,7 +1471,7 @@ def _parse_statement(self) -> t.Optional[exp.Expression]:
         if self._match_set(self.STATEMENT_PARSERS):
             return self.STATEMENT_PARSERS[self._prev.token_type](self)
 
-        if self._match_set(Tokenizer.COMMANDS):
+        if self._match_set(self.dialect.tokenizer.COMMANDS):
             return self._parse_command()
 
         expression = self._parse_expression()


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
@@ -148,6 +148,9 @@ def test_identity(self):
         self.validate_identity(
             "SELECT * FROM t1, t2, t3 FOR SHARE OF t1 NOWAIT FOR UPDATE OF t2, t3 SKIP LOCKED"
         )
+        self.validate_identity(
+            "REPLACE INTO table SELECT id FROM table2 WHERE cnt > 100", check_command_warning=True
+        )
         self.validate_identity(
             """SELECT * FROM foo WHERE 3 MEMBER OF(info->'$.value')""",
             """SELECT * FROM foo WHERE 3 MEMBER OF(JSON_EXTRACT(info, '$.value'))""",
Repository: tobymao/sqlglot

Issue:
APPROX_PERCENTILE is translated from Trino to APPROX_QUANTILE in Snowflake, which does not exist in Snowflake
**Fully reproducible code snippet**
```
>>> sql = "SELECT APPROX_PERCENTILE(a,1, 0.5, 0.001) from t"
>>> select = sqlglot.parse_one(sql, "trino")
>>> select.sql("snowflake")
'SELECT APPROX_QUANTILE(a, 0.5, 0.001, 1) FROM t'
```
It should be translated to `APPROX_PERCENTILE`

**Official Documentation**
https://docs.snowflake.com/en/sql-reference/functions/approx_percentile



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
@@ -345,6 +345,7 @@ class Parser(parser.Parser):
 
         FUNCTIONS = {
             **parser.Parser.FUNCTIONS,
+            "APPROX_PERCENTILE": exp.ApproxQuantile.from_arg_list,
             "ARRAYAGG": exp.ArrayAgg.from_arg_list,
             "ARRAY_CONSTRUCT": exp.Array.from_arg_list,
             "ARRAY_CONTAINS": lambda args: exp.ArrayContains(
@@ -1051,3 +1052,11 @@ def copyparameter_sql(self, expression: exp.CopyParameter) -> str:
                 return f"{option} = ({values})"
 
             return super().copyparameter_sql(expression)
+
+        def approxquantile_sql(self, expression: exp.ApproxQuantile) -> str:
+            if expression.args.get("weight") or expression.args.get("accuracy"):
+                self.unsupported(
+                    "APPROX_PERCENTILE with weight and/or accuracy arguments are not supported in Snowflake"
+                )
+
+            return self.func("APPROX_PERCENTILE", expression.this, expression.args.get("quantile"))


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
@@ -832,6 +832,18 @@ def test_snowflake(self):
                 "snowflake": "SELECT LISTAGG(col1, ', ') WITHIN GROUP (ORDER BY col2) FROM t",
             },
         )
+        self.validate_all(
+            "SELECT APPROX_PERCENTILE(a, 0.5) FROM t",
+            read={
+                "trino": "SELECT APPROX_PERCENTILE(a, 1, 0.5, 0.001) FROM t",
+                "presto": "SELECT APPROX_PERCENTILE(a, 1, 0.5, 0.001) FROM t",
+            },
+            write={
+                "trino": "SELECT APPROX_PERCENTILE(a, 0.5) FROM t",
+                "presto": "SELECT APPROX_PERCENTILE(a, 0.5) FROM t",
+                "snowflake": "SELECT APPROX_PERCENTILE(a, 0.5) FROM t",
+            },
+        )
 
     def test_null_treatment(self):
         self.validate_all(
Repository: tobymao/sqlglot

Issue:
Allow comma-separated values for `CREATE SEQUENCE` properties (Snowflake)
Allow comma-separated values for `CREATE SEQUENCE` properties in Snowflake queries.

This query can be parsed successfully (results is an instance of `exp.Create`):
```
    query = "CREATE SEQUENCE seq1 WITH START=1 INCREMENT=1 ORDER"
    result = parse_one(query, dialect="snowflake")
    print(type(result))

    --> <class 'sqlglot.expressions.Create'>
```

... whereas the following query cannot be fully parsed and is returned as a generic `exp.Command` as fallback:
```
    query = "CREATE SEQUENCE seq1 WITH START=1, INCREMENT=1 ORDER"
    result = parse_one(query, dialect="snowflake")
    print(type(result))

    --> <class 'sqlglot.expressions.Command'>
```

(note - the only subtle difference is the comma `,` between the `START` and `INCREMENT` properties)

Note that the second query syntax may not be covered in the Snowflake docs, but it is indeed a valid syntax that can be executed against Snowflake (and some Snowflake client apps/SDKs are generating queries that are using this syntax, unfortunately).


Discussion:

Resolving patch:
diff --git a/sqlglot/parser.py b/sqlglot/parser.py
--- a/sqlglot/parser.py
+++ b/sqlglot/parser.py
@@ -1678,6 +1678,7 @@ def _parse_sequence_properties(self) -> t.Optional[exp.SequenceProperties]:
         index = self._index
 
         while self._curr:
+            self._match(TokenType.COMMA)
             if self._match_text_seq("INCREMENT"):
                 self._match_text_seq("BY")
                 self._match_text_seq("=")


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
@@ -1223,6 +1223,14 @@ def test_ddl(self):
             "CREATE OR REPLACE FUNCTION my_udtf(foo BOOLEAN) RETURNS TABLE(col1 ARRAY(INT)) AS $$ WITH t AS (SELECT CAST([1, 2, 3] AS ARRAY(INT)) AS c) SELECT c FROM t $$",
             "CREATE OR REPLACE FUNCTION my_udtf(foo BOOLEAN) RETURNS TABLE (col1 ARRAY(INT)) AS ' WITH t AS (SELECT CAST([1, 2, 3] AS ARRAY(INT)) AS c) SELECT c FROM t '",
         )
+        self.validate_identity(
+            "CREATE SEQUENCE seq1 WITH START=1, INCREMENT=1 ORDER",
+            "CREATE SEQUENCE seq1 START=1 INCREMENT BY 1 ORDER",
+        )
+        self.validate_identity(
+            "CREATE SEQUENCE seq1 WITH START=1 INCREMENT=1 ORDER",
+            "CREATE SEQUENCE seq1 START=1 INCREMENT=1 ORDER",
+        )
 
         self.validate_all(
             "CREATE TABLE orders_clone CLONE orders",
Repository: tobymao/sqlglot

Issue:
[bug] pgsql to mysql special character || Semantic mismatch
**Before you file an issue**
- Make sure you specify the "read" dialect eg. `parse_one(sql, read="spark")`
- Make sure you specify the "write" dialect eg. `ast.sql(dialect="duckdb")`
- Check if the issue still exists on main

**Fully reproducible code snippet**
Please include a fully reproducible code snippet or the input sql, dialect, and expected output.

**Official Documentation**
Please include links to official SQL documentation related to your issue.



Discussion:
pgsql:
select '11' || '22'   
return: 1122
mysql:
select '11' || '22'
resurn:1

Resolving patch:
diff --git a/sqlglot/dialects/mysql.py b/sqlglot/dialects/mysql.py
--- a/sqlglot/dialects/mysql.py
+++ b/sqlglot/dialects/mysql.py
@@ -805,6 +805,9 @@ class Generator(generator.Generator):
             exp.DataType.Type.TIMESTAMPLTZ,
         }
 
+        def dpipe_sql(self, expression: exp.DPipe) -> str:
+            return self.func("CONCAT", *expression.flatten())
+
         def extract_sql(self, expression: exp.Extract) -> str:
             unit = expression.name
             if unit and unit.lower() == "epoch":


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
@@ -610,6 +610,16 @@ def test_mysql_time(self):
         )
 
     def test_mysql(self):
+        self.validate_all(
+            "SELECT CONCAT('11', '22')",
+            read={
+                "postgres": "SELECT '11' || '22'",
+            },
+            write={
+                "mysql": "SELECT CONCAT('11', '22')",
+                "postgres": "SELECT CONCAT('11', '22')",
+            },
+        )
         self.validate_all(
             "SELECT department, GROUP_CONCAT(name) AS employee_names FROM data GROUP BY department",
             read={
Repository: tobymao/sqlglot

Issue:
Rollup is a reserved word but can be unquoted as a table name in Snowflake
**Fully reproducible code snippet**
This works:
```python
q = """with "rollup" as (
    select 1
)
select * from "rollup"
"""

pq = parse_one(q, read="snowflake")
```

This fails:
```python
q = """with rollup as (
    select 1
)
select * from rollup
"""

pq = parse_one(q, read="snowflake")
```

```
ERROR:
sqlglot.errors.ParseError: Expected CTE to have alias. Line 1, Col: 11.
  with rollup as (
    select 1
)
select * from rollup
```

"rollup" is a reserved word but can also be used without the double quotes in Snowflake (maybe others?). I took a stab at adding it to `ID_VAR_TOKENS` but that ended up causing a variety of failures so I stopped for a bit.

Works in Snowflake:
<img width="566" alt="image" src="https://github.com/tobymao/sqlglot/assets/1406/de67efe1-ae9a-4c15-8978-0b8566229461">



Discussion:

Resolving patch:
diff --git a/sqlglot/parser.py b/sqlglot/parser.py
--- a/sqlglot/parser.py
+++ b/sqlglot/parser.py
@@ -406,6 +406,7 @@ class Parser(metaclass=_Parser):
         TokenType.REFRESH,
         TokenType.REPLACE,
         TokenType.RIGHT,
+        TokenType.ROLLUP,
         TokenType.ROW,
         TokenType.ROWS,
         TokenType.SEMI,
@@ -3581,7 +3582,11 @@ def _parse_group(self, skip_group_by_token: bool = False) -> t.Optional[exp.Grou
             elements["all"] = False
 
         while True:
-            expressions = self._parse_csv(self._parse_conjunction)
+            expressions = self._parse_csv(
+                lambda: None
+                if self._match(TokenType.ROLLUP, advance=False)
+                else self._parse_conjunction()
+            )
             if expressions:
                 elements["expressions"].extend(expressions)
 


Test patch:
diff --git a/tests/fixtures/identity.sql b/tests/fixtures/identity.sql
--- a/tests/fixtures/identity.sql
+++ b/tests/fixtures/identity.sql
@@ -869,4 +869,5 @@ TRUNCATE(a, b)
 SELECT enum
 SELECT unlogged
 SELECT name
-SELECT copy
\ No newline at end of file
+SELECT copy
+SELECT rollup
\ No newline at end of file
Repository: tobymao/sqlglot

Issue:
Support for X-prefixed Hex Strings in Databricks
```python
import sqlglot

print(
    sqlglot.parse_one(
        "SELECT X'1A2F'",
        dialect="databricks",
    ).sql("databricks")
)

```
Docs: https://docs.databricks.com/en/sql/language-manual/data-types/binary-type.html 



Discussion:
Interestingly, this is supported in spark dialect
print(sqlglot.parse_one("select X'1A2B'", dialect="spark").sql("databricks"))

This gives 'Select 6699' which is not great. should be same as input

Resolving patch:
diff --git a/sqlglot/dialects/databricks.py b/sqlglot/dialects/databricks.py
--- a/sqlglot/dialects/databricks.py
+++ b/sqlglot/dialects/databricks.py
@@ -88,6 +88,3 @@ def generatedasidentitycolumnconstraint_sql(
         ) -> str:
             expression.set("this", True)  # trigger ALWAYS in super class
             return super().generatedasidentitycolumnconstraint_sql(expression)
-
-    class Tokenizer(Spark.Tokenizer):
-        HEX_STRINGS = []
diff --git a/sqlglot/dialects/spark2.py b/sqlglot/dialects/spark2.py
--- a/sqlglot/dialects/spark2.py
+++ b/sqlglot/dialects/spark2.py
@@ -284,4 +284,4 @@ def columndef_sql(self, expression: exp.ColumnDef, sep: str = " ") -> str:
             )
 
     class Tokenizer(Hive.Tokenizer):
-        HEX_STRINGS = [("X'", "'")]
+        HEX_STRINGS = [("X'", "'"), ("x'", "'")]


Test patch:
diff --git a/tests/dialects/test_databricks.py b/tests/dialects/test_databricks.py
--- a/tests/dialects/test_databricks.py
+++ b/tests/dialects/test_databricks.py
@@ -67,6 +67,20 @@ def test_databricks(self):
             },
         )
 
+        self.validate_all(
+            "SELECT X'1A2B'",
+            read={
+                "spark2": "SELECT X'1A2B'",
+                "spark": "SELECT X'1A2B'",
+                "databricks": "SELECT x'1A2B'",
+            },
+            write={
+                "spark2": "SELECT X'1A2B'",
+                "spark": "SELECT X'1A2B'",
+                "databricks": "SELECT X'1A2B'",
+            },
+        )
+
         with self.assertRaises(ParseError):
             transpile(
                 "CREATE FUNCTION add_one(x INT) RETURNS INT LANGUAGE PYTHON AS $foo$def add_one(x):\n  return x+1$$",
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
@@ -334,7 +334,7 @@ def test_hexadecimal_literal(self):
         write_CC = {
             "bigquery": "SELECT 0xCC",
             "clickhouse": "SELECT 0xCC",
-            "databricks": "SELECT 204",
+            "databricks": "SELECT X'CC'",
             "drill": "SELECT 204",
             "duckdb": "SELECT 204",
             "hive": "SELECT 204",
@@ -355,7 +355,7 @@ def test_hexadecimal_literal(self):
         write_CC_with_leading_zeros = {
             "bigquery": "SELECT 0x0000CC",
             "clickhouse": "SELECT 0x0000CC",
-            "databricks": "SELECT 204",
+            "databricks": "SELECT X'0000CC'",
             "drill": "SELECT 204",
             "duckdb": "SELECT 204",
             "hive": "SELECT 204",
Repository: tobymao/sqlglot

Issue:
The three functions WEEKOFYEAR, DAYOFMONTH, and DAYOFWEEK were incorrectly converted in Hive.
### Code to reproduce an issue

```py
import sqlglot
sqlglot.parse_one("SELECT WEEKOFYEAR('2024-05-22'), DAYOFMONTH('2024-05-22'), DAYOFWEEK('2024-05-22')", read='hive').sql(dialect='hive')
```

### as-is: The return value in the current issue situation
```
"SELECT WEEK_OF_YEAR('2024-05-22'), DAY_OF_MONTH('2024-05-22'), DAY_OF_WEEK('2024-05-22')"
```

### to-be: The correct return value
```
"SELECT WEEKOFYEAR('2024-05-22'), DAYOFMONTH('2024-05-22'), DAYOFWEEK('2024-05-22')"
```

I have a patch to fix the issue and will submit a PR soon.



Discussion:

Resolving patch:
diff --git a/sqlglot/dialects/hive.py b/sqlglot/dialects/hive.py
--- a/sqlglot/dialects/hive.py
+++ b/sqlglot/dialects/hive.py
@@ -573,6 +573,9 @@ class Generator(generator.Generator):
             exp.OnProperty: lambda *_: "",
             exp.PrimaryKeyColumnConstraint: lambda *_: "PRIMARY KEY",
             exp.ParseJSON: lambda self, e: self.sql(e.this),
+            exp.WeekOfYear: rename_func("WEEKOFYEAR"),
+            exp.DayOfMonth: rename_func("DAYOFMONTH"),
+            exp.DayOfWeek: rename_func("DAYOFWEEK"),
         }
 
         PROPERTIES_LOCATION = {


Test patch:
diff --git a/tests/dialects/test_hive.py b/tests/dialects/test_hive.py
--- a/tests/dialects/test_hive.py
+++ b/tests/dialects/test_hive.py
@@ -406,7 +406,9 @@ def test_hive(self):
         self.validate_identity("(VALUES (1 AS a, 2 AS b, 3))")
         self.validate_identity("SELECT * FROM my_table TIMESTAMP AS OF DATE_ADD(CURRENT_DATE, -1)")
         self.validate_identity("SELECT * FROM my_table VERSION AS OF DATE_ADD(CURRENT_DATE, -1)")
-
+        self.validate_identity(
+            "SELECT WEEKOFYEAR('2024-05-22'), DAYOFMONTH('2024-05-22'), DAYOFWEEK('2024-05-22')"
+        )
         self.validate_identity(
             "SELECT ROW() OVER (DISTRIBUTE BY x SORT BY y)",
             "SELECT ROW() OVER (PARTITION BY x ORDER BY y)",