Repository: tobymao/sqlglot

Issue:
Incorrect handling for PARSE_JSON in Databricks in Generator
Hi, 

the `PARSE_JSON` method in Databricks is currently not handled correctly in the Generator, it is imply omitted in the output: 

```
>>> import sqlglot
>>> sql = "SELECT PARSE_JSON('{}') AS message"
>>> parsed = sqlglot.parse_one(sql, dialect="databricks")
>>> parsed.sql(dialect="databricks")
"SELECT '{}' AS message"
```

It may just be an issue of setting `PARSE_JSON_NAME` to `"PARSE_JSON"` for the Databricks Dialect's Generator class (it is inherited as `None` from `Hive.Generator`). 

This issue still exists as of version 26.11.1.

Discussion:

Solution patch:
diff --git a/sqlglot/dialects/databricks.py b/sqlglot/dialects/databricks.py
index 12e9fb3a27..181cfb6cbf 100644
--- a/sqlglot/dialects/databricks.py
+++ b/sqlglot/dialects/databricks.py
@@ -61,6 +61,7 @@ class Generator(Spark.Generator):
         COPY_PARAMS_EQ_REQUIRED = True
         JSON_PATH_SINGLE_QUOTE_ESCAPE = False
         QUOTE_JSON_PATH = False
+        PARSE_JSON_NAME = "PARSE_JSON"
 
         TRANSFORMS = {
             **Spark.Generator.TRANSFORMS,
diff --git a/sqlglot/dialects/hive.py b/sqlglot/dialects/hive.py
index 048907ac42..f7cea08a7b 100644
--- a/sqlglot/dialects/hive.py
+++ b/sqlglot/dialects/hive.py
@@ -469,7 +469,7 @@ class Generator(generator.Generator):
         JSON_PATH_SINGLE_QUOTE_ESCAPE = True
         SUPPORTS_TO_NUMBER = False
         WITH_PROPERTIES_PREFIX = "TBLPROPERTIES"
-        PARSE_JSON_NAME = None
+        PARSE_JSON_NAME: t.Optional[str] = None
         PAD_FILL_PATTERN_IS_REQUIRED = True
         SUPPORTS_MEDIAN = False
         ARRAY_SIZE_NAME = "SIZE"


Test patch:
diff --git a/tests/dialects/test_databricks.py b/tests/dialects/test_databricks.py
index 7a667270ae..e6d1e7a697 100644
--- a/tests/dialects/test_databricks.py
+++ b/tests/dialects/test_databricks.py
@@ -50,6 +50,7 @@ def test_databricks(self):
         self.validate_identity(
             "COPY INTO target FROM `s3://link` FILEFORMAT = AVRO VALIDATE = ALL FILES = ('file1', 'file2') FORMAT_OPTIONS ('opt1'='true', 'opt2'='test') COPY_OPTIONS ('mergeSchema'='true')"
         )
+        self.validate_identity("SELECT PARSE_JSON('{}')")
         self.validate_identity(
             "SELECT DATE_FORMAT(CAST(FROM_UTC_TIMESTAMP(foo, 'America/Los_Angeles') AS TIMESTAMP), 'yyyy-MM-dd HH:mm:ss') AS foo FROM t",
             "SELECT DATE_FORMAT(CAST(FROM_UTC_TIMESTAMP(CAST(foo AS TIMESTAMP), 'America/Los_Angeles') AS TIMESTAMP), 'yyyy-MM-dd HH:mm:ss') AS foo FROM t",
diff --git a/tests/dialects/test_snowflake.py b/tests/dialects/test_snowflake.py
index 0620799607..a21e0316bd 100644
--- a/tests/dialects/test_snowflake.py
+++ b/tests/dialects/test_snowflake.py
@@ -394,7 +394,7 @@ def test_snowflake(self):
             """SELECT PARSE_JSON('{"fruit":"banana"}'):fruit""",
             write={
                 "bigquery": """SELECT JSON_EXTRACT(PARSE_JSON('{"fruit":"banana"}'), '$.fruit')""",
-                "databricks": """SELECT '{"fruit":"banana"}':fruit""",
+                "databricks": """SELECT PARSE_JSON('{"fruit":"banana"}'):fruit""",
                 "duckdb": """SELECT JSON('{"fruit":"banana"}') -> '$.fruit'""",
                 "mysql": """SELECT JSON_EXTRACT('{"fruit":"banana"}', '$.fruit')""",
                 "presto": """SELECT JSON_EXTRACT(JSON_PARSE('{"fruit":"banana"}'), '$.fruit')""",