Repository: tobymao/sqlglot

Issue:
cast to map with clickhouse dialect ignores case
Yet another clickhouse case sensitivity bug :)


ClickHouse CLI:

```
albatross :) select cast(map('a', 1, 'b', 2) as Map(String, Int8));

SELECT CAST(map('a', 1, 'b', 2), 'Map(String, Int8)')

Query id: bab188fb-69f7-4c0f-9bde-ac524a08f6e8

┌─CAST(map('a', 1, 'b', 2), 'Map(String, Int8)')─┐
│ {'a':1,'b':2}                                  │
└────────────────────────────────────────────────┘

1 row in set. Elapsed: 0.001 sec.
```

sqlglot:

```
In [7]: sg.parse_one("cast(map('a', 1, 'b', 2) as Map(String, Int8))", read="clickhouse").sql(dialect="clickhouse")
Out[7]: "CAST(map('a', 1, 'b', 2) AS MAP(TEXT, TINYINT))"
```

Perhaps there's a way to disable all case transformations for the clickhouse dialect.

Discussion:

Patch:
diff --git a/sqlglot/dialects/clickhouse.py b/sqlglot/dialects/clickhouse.py
index 6a141a1a..f25f6dac 100644
--- a/sqlglot/dialects/clickhouse.py
+++ b/sqlglot/dialects/clickhouse.py
@@ -52,6 +52,9 @@ class ClickHouse(Dialect):
             **Generator.TYPE_MAPPING,
             exp.DataType.Type.NULLABLE: "Nullable",
             exp.DataType.Type.DATETIME: "DateTime64",
+            exp.DataType.Type.MAP: "Map",
+            exp.DataType.Type.ARRAY: "Array",
+            exp.DataType.Type.STRUCT: "Tuple",
         }
 
         TRANSFORMS = {


Test patch:
diff --git a/tests/dialects/test_dialect.py b/tests/dialects/test_dialect.py
index b103ecda..d31d0f6c 100644
--- a/tests/dialects/test_dialect.py
+++ b/tests/dialects/test_dialect.py
@@ -81,6 +81,24 @@ class TestDialect(Validator):
                 "starrocks": "CAST(a AS STRING)",
             },
         )
+        self.validate_all(
+            "CAST(MAP('a', '1') AS MAP(TEXT, TEXT))",
+            write={
+                "clickhouse": "CAST(map('a', '1') AS Map(TEXT, TEXT))",
+            },
+        )
+        self.validate_all(
+            "CAST(ARRAY(1, 2) AS ARRAY<TINYINT>)",
+            write={
+                "clickhouse": "CAST([1, 2] AS Array(TINYINT))",
+            },
+        )
+        self.validate_all(
+            "CAST((1, 2) AS STRUCT<a: TINYINT, b: TINYINT>)",
+            write={
+                "clickhouse": "CAST((1, 2) AS Tuple(a TINYINT, b TINYINT))",
+            },
+        )
         self.validate_all(
             "CAST(a AS DATETIME)",
             write={