prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  ClickHouse WITH statement
  According to ClickHouse [docs](https://clickhouse.com/docs/en/sql-reference/statements/select/with/), `WITH` statement looks like `WITH <expression> AS <identifier>`. `sqlglot` expects that identifier precedes expression. So if I'll try to parse SQL like:
  ```sql
  WITH '2019-08-01 15:23:00' as ts_upper_bound
  SELECT *
  FROM hits
  WHERE
      EventDate = toDate(ts_upper_bound) AND
      EventTime <= ts_upper_bound
  ```
  I have exception:
  ```python
  sqlglot.errors.ParseError: Expected CTE to have alias. Line 2, Col: 6.
  ```
  One more problem is SQL generation. If I try to generate something like:
  ```sql
  WITH trim('   A   ') AS val SELECT val
  ```
  I expect to write something like:
  ```python
  select("val").with_("val", as_="trim('   a   ')").sql(dialect=Dialects.CLICKHOUSE)
  ```
  but receive this SQL, which is invalid in ClickHouse:
  ```sql
  WITH val AS (TRIM('   a   ')) SELECT val
  ```
  If I switch arguments of `with_` method, I'll almost achieve expected:
  ```python
  select("val").with_(parse_one("trim('   a   ')"), as_="val", dialect=Dialects.CLICKHOUSE).sql(dialect=Dialects.CLICKHOUSE)
  ```
  But resulting SQL is also invalid due to parentheses around `val`:
  ```sql
  WITH TRIM('   a   ') AS (val) SELECT val
  ```
  I guess ClickHouse dialect should have specified behaviour for `expressions.CTE` parsing/generation.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `sqlglot/dialects/clickhouse.py`
  Content:
  ```
  1 from __future__ import annotations
  2 
  3 import typing as t
  4 
  5 from sqlglot import exp, generator, parser, tokens
  6 from sqlglot.dialects.dialect import Dialect, inline_array_sql, var_map_sql
  7 from sqlglot.parser import parse_var_map
  8 from sqlglot.tokens import TokenType
  9 
  10 
  11 def _lower_func(sql):
  12     index = sql.index("(")
  13     return sql[:index].lower() + sql[index:]
  14 
  15 
  16 class ClickHouse(Dialect):
  17     normalize_functions = None
  18     null_ordering = "nulls_are_last"
  19 
  20     class Tokenizer(tokens.Tokenizer):
  21         COMMENTS = ["--", "#", "#!", ("/*", "*/")]
  22         IDENTIFIERS = ['"', "`"]
  23 
  24         KEYWORDS = {
  25             **tokens.Tokenizer.KEYWORDS,
  26             "ASOF": TokenType.ASOF,
  27             "GLOBAL": TokenType.GLOBAL,
  28             "DATETIME64": TokenType.DATETIME,
  29             "FINAL": TokenType.FINAL,
  30             "FLOAT32": TokenType.FLOAT,
  31             "FLOAT64": TokenType.DOUBLE,
  32             "INT16": TokenType.SMALLINT,
  33             "INT32": TokenType.INT,
  34             "INT64": TokenType.BIGINT,
  35             "INT8": TokenType.TINYINT,
  36             "TUPLE": TokenType.STRUCT,
  37         }
  38 
  39     class Parser(parser.Parser):
  40         FUNCTIONS = {
  41             **parser.Parser.FUNCTIONS,  # type: ignore
  42             "MAP": parse_var_map,
  43             "QUANTILE": lambda params, args: exp.Quantile(this=args, quantile=params),
  44             "QUANTILES": lambda params, args: exp.Quantiles(parameters=params, expressions=args),
  45             "QUANTILEIF": lambda params, args: exp.QuantileIf(parameters=params, expressions=args),
  46         }
  47 
  48         RANGE_PARSERS = {
  49             **parser.Parser.RANGE_PARSERS,
  50             TokenType.GLOBAL: lambda self, this: self._match(TokenType.IN)
  51             and self._parse_in(this, is_global=True),
  52         }
  53 
  54         JOIN_KINDS = {*parser.Parser.JOIN_KINDS, TokenType.ANY, TokenType.ASOF}  # type: ignore
  55 
  56         TABLE_ALIAS_TOKENS = {*parser.Parser.TABLE_ALIAS_TOKENS} - {TokenType.ANY}  # type: ignore
  57 
  58         def _parse_in(
  59             self, this: t.Optional[exp.Expression], is_global: bool = False
  60         ) -> exp.Expression:
  61             this = super()._parse_in(this)
  62             this.set("is_global", is_global)
  63             return this
  64 
  65         def _parse_table(
  66             self, schema: bool = False, alias_tokens: t.Optional[t.Collection[TokenType]] = None
  67         ) -> t.Optional[exp.Expression]:
  68             this = super()._parse_table(schema=schema, alias_tokens=alias_tokens)
  69 
  70             if self._match(TokenType.FINAL):
  71                 this = self.expression(exp.Final, this=this)
  72 
  73             return this
  74 
  75         def _parse_position(self) -> exp.Expression:
  76             this = super()._parse_position()
  77             # clickhouse position args are swapped
  78             substr = this.this
  79             this.args["this"] = this.args.get("substr")
  80             this.args["substr"] = substr
  81             return this
  82 
  83     class Generator(generator.Generator):
  84         STRUCT_DELIMITER = ("(", ")")
  85 
  86         TYPE_MAPPING = {
  87             **generator.Generator.TYPE_MAPPING,  # type: ignore
  88             exp.DataType.Type.NULLABLE: "Nullable",
  89             exp.DataType.Type.DATETIME: "DateTime64",
  90             exp.DataType.Type.MAP: "Map",
  91             exp.DataType.Type.ARRAY: "Array",
  92             exp.DataType.Type.STRUCT: "Tuple",
  93             exp.DataType.Type.TINYINT: "Int8",
  94             exp.DataType.Type.SMALLINT: "Int16",
  95             exp.DataType.Type.INT: "Int32",
  96             exp.DataType.Type.BIGINT: "Int64",
  97             exp.DataType.Type.FLOAT: "Float32",
  98             exp.DataType.Type.DOUBLE: "Float64",
  99         }
  100 
  101         TRANSFORMS = {
  102             **generator.Generator.TRANSFORMS,  # type: ignore
  103             exp.Array: inline_array_sql,
  104             exp.StrPosition: lambda self, e: f"position({self.format_args(e.this, e.args.get('substr'), e.args.get('position'))})",
  105             exp.Final: lambda self, e: f"{self.sql(e, 'this')} FINAL",
  106             exp.Map: lambda self, e: _lower_func(var_map_sql(self, e)),
  107             exp.VarMap: lambda self, e: _lower_func(var_map_sql(self, e)),
  108             exp.Quantile: lambda self, e: f"quantile{self._param_args_sql(e, 'quantile', 'this')}",
  109             exp.Quantiles: lambda self, e: f"quantiles{self._param_args_sql(e, 'parameters', 'expressions')}",
  110             exp.QuantileIf: lambda self, e: f"quantileIf{self._param_args_sql(e, 'parameters', 'expressions')}",
  111         }
  112 
  113         EXPLICIT_UNION = True
  114 
  115         def _param_args_sql(
  116             self, expression: exp.Expression, params_name: str, args_name: str
  117         ) -> str:
  118             params = self.format_args(self.expressions(expression, params_name))
  119             args = self.format_args(self.expressions(expression, args_name))
  120             return f"({params})({args})"
  121
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/sqlglot/dialects/clickhouse.py b/sqlglot/dialects/clickhouse.py
  --- a/sqlglot/dialects/clickhouse.py
  +++ b/sqlglot/dialects/clickhouse.py
  @@ -4,6 +4,7 @@
   
   from sqlglot import exp, generator, parser, tokens
   from sqlglot.dialects.dialect import Dialect, inline_array_sql, var_map_sql
  +from sqlglot.errors import ParseError
   from sqlglot.parser import parse_var_map
   from sqlglot.tokens import TokenType
   
  @@ -80,6 +81,22 @@
               this.args["substr"] = substr
               return this
   
  +        # https://clickhouse.com/docs/en/sql-reference/statements/select/with/
  +        def _parse_cte(self) -> exp.Expression:
  +            index = self._index
  +            try:
  +                # WITH <identifier> AS <subquery expression>
  +                return super()._parse_cte()
  +            except ParseError:
  +                # WITH <expression> AS <identifier>
  +                self._retreat(index)
  +                statement = self._parse_statement()
  +
  +                if statement and isinstance(statement.this, exp.Alias):
  +                    self.raise_error("Expected CTE to have alias")
  +
  +                return self.expression(exp.CTE, this=statement, alias=statement and statement.this)
  +
       class Generator(generator.Generator):
           STRUCT_DELIMITER = ("(", ")")
   
  @@ -118,3 +135,9 @@
               params = self.format_args(self.expressions(expression, params_name))
               args = self.format_args(self.expressions(expression, args_name))
               return f"({params})({args})"
  +
  +        def cte_sql(self, expression: exp.CTE) -> str:
  +            if isinstance(expression.this, exp.Alias):
  +                return self.sql(expression, "this")
  +
  +            return super().cte_sql(expression)
  
verification_info: {"golden_diff": "diff --git a/sqlglot/dialects/clickhouse.py b/sqlglot/dialects/clickhouse.py\n--- a/sqlglot/dialects/clickhouse.py\n+++ b/sqlglot/dialects/clickhouse.py\n@@ -4,6 +4,7 @@\n \n from sqlglot import exp, generator, parser, tokens\n from sqlglot.dialects.dialect import Dialect, inline_array_sql, var_map_sql\n+from sqlglot.errors import ParseError\n from sqlglot.parser import parse_var_map\n from sqlglot.tokens import TokenType\n \n@@ -80,6 +81,22 @@\n             this.args[\"substr\"] = substr\n             return this\n \n+        # https://clickhouse.com/docs/en/sql-reference/statements/select/with/\n+        def _parse_cte(self) -> exp.Expression:\n+            index = self._index\n+            try:\n+                # WITH <identifier> AS <subquery expression>\n+                return super()._parse_cte()\n+            except ParseError:\n+                # WITH <expression> AS <identifier>\n+                self._retreat(index)\n+                statement = self._parse_statement()\n+\n+                if statement and isinstance(statement.this, exp.Alias):\n+                    self.raise_error(\"Expected CTE to have alias\")\n+\n+                return self.expression(exp.CTE, this=statement, alias=statement and statement.this)\n+\n     class Generator(generator.Generator):\n         STRUCT_DELIMITER = (\"(\", \")\")\n \n@@ -118,3 +135,9 @@\n             params = self.format_args(self.expressions(expression, params_name))\n             args = self.format_args(self.expressions(expression, args_name))\n             return f\"({params})({args})\"\n+\n+        def cte_sql(self, expression: exp.CTE) -> str:\n+            if isinstance(expression.this, exp.Alias):\n+                return self.sql(expression, \"this\")\n+\n+            return super().cte_sql(expression)\n", "issue": "ClickHouse WITH statement\nAccording to ClickHouse [docs](https://clickhouse.com/docs/en/sql-reference/statements/select/with/), `WITH` statement looks like `WITH <expression> AS <identifier>`. `sqlglot` expects that identifier precedes expression. So if I'll try to parse SQL like:\r\n```sql\r\nWITH '2019-08-01 15:23:00' as ts_upper_bound\r\nSELECT *\r\nFROM hits\r\nWHERE\r\n    EventDate = toDate(ts_upper_bound) AND\r\n    EventTime <= ts_upper_bound\r\n```\r\nI have exception:\r\n```python\r\nsqlglot.errors.ParseError: Expected CTE to have alias. Line 2, Col: 6.\r\n```\r\nOne more problem is SQL generation. If I try to generate something like:\r\n```sql\r\nWITH trim('   A   ') AS val SELECT val\r\n```\r\nI expect to write something like:\r\n```python\r\nselect(\"val\").with_(\"val\", as_=\"trim('   a   ')\").sql(dialect=Dialects.CLICKHOUSE)\r\n```\r\nbut receive this SQL, which is invalid in ClickHouse:\r\n```sql\r\nWITH val AS (TRIM('   a   ')) SELECT val\r\n```\r\nIf I switch arguments of `with_` method, I'll almost achieve expected:\r\n```python\r\nselect(\"val\").with_(parse_one(\"trim('   a   ')\"), as_=\"val\", dialect=Dialects.CLICKHOUSE).sql(dialect=Dialects.CLICKHOUSE)\r\n```\r\nBut resulting SQL is also invalid due to parentheses around `val`:\r\n```sql\r\nWITH TRIM('   a   ') AS (val) SELECT val\r\n```\r\nI guess ClickHouse dialect should have specified behaviour for `expressions.CTE` parsing/generation.\n", "before_files": [{"content": "from __future__ import annotations\n\nimport typing as t\n\nfrom sqlglot import exp, generator, parser, tokens\nfrom sqlglot.dialects.dialect import Dialect, inline_array_sql, var_map_sql\nfrom sqlglot.parser import parse_var_map\nfrom sqlglot.tokens import TokenType\n\n\ndef _lower_func(sql):\n    index = sql.index(\"(\")\n    return sql[:index].lower() + sql[index:]\n\n\nclass ClickHouse(Dialect):\n    normalize_functions = None\n    null_ordering = \"nulls_are_last\"\n\n    class Tokenizer(tokens.Tokenizer):\n        COMMENTS = [\"--\", \"#\", \"#!\", (\"/*\", \"*/\")]\n        IDENTIFIERS = ['\"', \"`\"]\n\n        KEYWORDS = {\n            **tokens.Tokenizer.KEYWORDS,\n            \"ASOF\": TokenType.ASOF,\n            \"GLOBAL\": TokenType.GLOBAL,\n            \"DATETIME64\": TokenType.DATETIME,\n            \"FINAL\": TokenType.FINAL,\n            \"FLOAT32\": TokenType.FLOAT,\n            \"FLOAT64\": TokenType.DOUBLE,\n            \"INT16\": TokenType.SMALLINT,\n            \"INT32\": TokenType.INT,\n            \"INT64\": TokenType.BIGINT,\n            \"INT8\": TokenType.TINYINT,\n            \"TUPLE\": TokenType.STRUCT,\n        }\n\n    class Parser(parser.Parser):\n        FUNCTIONS = {\n            **parser.Parser.FUNCTIONS,  # type: ignore\n            \"MAP\": parse_var_map,\n            \"QUANTILE\": lambda params, args: exp.Quantile(this=args, quantile=params),\n            \"QUANTILES\": lambda params, args: exp.Quantiles(parameters=params, expressions=args),\n            \"QUANTILEIF\": lambda params, args: exp.QuantileIf(parameters=params, expressions=args),\n        }\n\n        RANGE_PARSERS = {\n            **parser.Parser.RANGE_PARSERS,\n            TokenType.GLOBAL: lambda self, this: self._match(TokenType.IN)\n            and self._parse_in(this, is_global=True),\n        }\n\n        JOIN_KINDS = {*parser.Parser.JOIN_KINDS, TokenType.ANY, TokenType.ASOF}  # type: ignore\n\n        TABLE_ALIAS_TOKENS = {*parser.Parser.TABLE_ALIAS_TOKENS} - {TokenType.ANY}  # type: ignore\n\n        def _parse_in(\n            self, this: t.Optional[exp.Expression], is_global: bool = False\n        ) -> exp.Expression:\n            this = super()._parse_in(this)\n            this.set(\"is_global\", is_global)\n            return this\n\n        def _parse_table(\n            self, schema: bool = False, alias_tokens: t.Optional[t.Collection[TokenType]] = None\n        ) -> t.Optional[exp.Expression]:\n            this = super()._parse_table(schema=schema, alias_tokens=alias_tokens)\n\n            if self._match(TokenType.FINAL):\n                this = self.expression(exp.Final, this=this)\n\n            return this\n\n        def _parse_position(self) -> exp.Expression:\n            this = super()._parse_position()\n            # clickhouse position args are swapped\n            substr = this.this\n            this.args[\"this\"] = this.args.get(\"substr\")\n            this.args[\"substr\"] = substr\n            return this\n\n    class Generator(generator.Generator):\n        STRUCT_DELIMITER = (\"(\", \")\")\n\n        TYPE_MAPPING = {\n            **generator.Generator.TYPE_MAPPING,  # type: ignore\n            exp.DataType.Type.NULLABLE: \"Nullable\",\n            exp.DataType.Type.DATETIME: \"DateTime64\",\n            exp.DataType.Type.MAP: \"Map\",\n            exp.DataType.Type.ARRAY: \"Array\",\n            exp.DataType.Type.STRUCT: \"Tuple\",\n            exp.DataType.Type.TINYINT: \"Int8\",\n            exp.DataType.Type.SMALLINT: \"Int16\",\n            exp.DataType.Type.INT: \"Int32\",\n            exp.DataType.Type.BIGINT: \"Int64\",\n            exp.DataType.Type.FLOAT: \"Float32\",\n            exp.DataType.Type.DOUBLE: \"Float64\",\n        }\n\n        TRANSFORMS = {\n            **generator.Generator.TRANSFORMS,  # type: ignore\n            exp.Array: inline_array_sql,\n            exp.StrPosition: lambda self, e: f\"position({self.format_args(e.this, e.args.get('substr'), e.args.get('position'))})\",\n            exp.Final: lambda self, e: f\"{self.sql(e, 'this')} FINAL\",\n            exp.Map: lambda self, e: _lower_func(var_map_sql(self, e)),\n            exp.VarMap: lambda self, e: _lower_func(var_map_sql(self, e)),\n            exp.Quantile: lambda self, e: f\"quantile{self._param_args_sql(e, 'quantile', 'this')}\",\n            exp.Quantiles: lambda self, e: f\"quantiles{self._param_args_sql(e, 'parameters', 'expressions')}\",\n            exp.QuantileIf: lambda self, e: f\"quantileIf{self._param_args_sql(e, 'parameters', 'expressions')}\",\n        }\n\n        EXPLICIT_UNION = True\n\n        def _param_args_sql(\n            self, expression: exp.Expression, params_name: str, args_name: str\n        ) -> str:\n            params = self.format_args(self.expressions(expression, params_name))\n            args = self.format_args(self.expressions(expression, args_name))\n            return f\"({params})({args})\"\n", "path": "sqlglot/dialects/clickhouse.py"}], "after_files": [{"content": "from __future__ import annotations\n\nimport typing as t\n\nfrom sqlglot import exp, generator, parser, tokens\nfrom sqlglot.dialects.dialect import Dialect, inline_array_sql, var_map_sql\nfrom sqlglot.errors import ParseError\nfrom sqlglot.parser import parse_var_map\nfrom sqlglot.tokens import TokenType\n\n\ndef _lower_func(sql):\n    index = sql.index(\"(\")\n    return sql[:index].lower() + sql[index:]\n\n\nclass ClickHouse(Dialect):\n    normalize_functions = None\n    null_ordering = \"nulls_are_last\"\n\n    class Tokenizer(tokens.Tokenizer):\n        COMMENTS = [\"--\", \"#\", \"#!\", (\"/*\", \"*/\")]\n        IDENTIFIERS = ['\"', \"`\"]\n\n        KEYWORDS = {\n            **tokens.Tokenizer.KEYWORDS,\n            \"ASOF\": TokenType.ASOF,\n            \"GLOBAL\": TokenType.GLOBAL,\n            \"DATETIME64\": TokenType.DATETIME,\n            \"FINAL\": TokenType.FINAL,\n            \"FLOAT32\": TokenType.FLOAT,\n            \"FLOAT64\": TokenType.DOUBLE,\n            \"INT16\": TokenType.SMALLINT,\n            \"INT32\": TokenType.INT,\n            \"INT64\": TokenType.BIGINT,\n            \"INT8\": TokenType.TINYINT,\n            \"TUPLE\": TokenType.STRUCT,\n        }\n\n    class Parser(parser.Parser):\n        FUNCTIONS = {\n            **parser.Parser.FUNCTIONS,  # type: ignore\n            \"MAP\": parse_var_map,\n            \"QUANTILE\": lambda params, args: exp.Quantile(this=args, quantile=params),\n            \"QUANTILES\": lambda params, args: exp.Quantiles(parameters=params, expressions=args),\n            \"QUANTILEIF\": lambda params, args: exp.QuantileIf(parameters=params, expressions=args),\n        }\n\n        RANGE_PARSERS = {\n            **parser.Parser.RANGE_PARSERS,\n            TokenType.GLOBAL: lambda self, this: self._match(TokenType.IN)\n            and self._parse_in(this, is_global=True),\n        }\n\n        JOIN_KINDS = {*parser.Parser.JOIN_KINDS, TokenType.ANY, TokenType.ASOF}  # type: ignore\n\n        TABLE_ALIAS_TOKENS = {*parser.Parser.TABLE_ALIAS_TOKENS} - {TokenType.ANY}  # type: ignore\n\n        def _parse_in(\n            self, this: t.Optional[exp.Expression], is_global: bool = False\n        ) -> exp.Expression:\n            this = super()._parse_in(this)\n            this.set(\"is_global\", is_global)\n            return this\n\n        def _parse_table(\n            self, schema: bool = False, alias_tokens: t.Optional[t.Collection[TokenType]] = None\n        ) -> t.Optional[exp.Expression]:\n            this = super()._parse_table(schema=schema, alias_tokens=alias_tokens)\n\n            if self._match(TokenType.FINAL):\n                this = self.expression(exp.Final, this=this)\n\n            return this\n\n        def _parse_position(self) -> exp.Expression:\n            this = super()._parse_position()\n            # clickhouse position args are swapped\n            substr = this.this\n            this.args[\"this\"] = this.args.get(\"substr\")\n            this.args[\"substr\"] = substr\n            return this\n\n        # https://clickhouse.com/docs/en/sql-reference/statements/select/with/\n        def _parse_cte(self) -> exp.Expression:\n            index = self._index\n            try:\n                # WITH <identifier> AS <subquery expression>\n                return super()._parse_cte()\n            except ParseError:\n                # WITH <expression> AS <identifier>\n                self._retreat(index)\n                statement = self._parse_statement()\n\n                if statement and isinstance(statement.this, exp.Alias):\n                    self.raise_error(\"Expected CTE to have alias\")\n\n                return self.expression(exp.CTE, this=statement, alias=statement and statement.this)\n\n    class Generator(generator.Generator):\n        STRUCT_DELIMITER = (\"(\", \")\")\n\n        TYPE_MAPPING = {\n            **generator.Generator.TYPE_MAPPING,  # type: ignore\n            exp.DataType.Type.NULLABLE: \"Nullable\",\n            exp.DataType.Type.DATETIME: \"DateTime64\",\n            exp.DataType.Type.MAP: \"Map\",\n            exp.DataType.Type.ARRAY: \"Array\",\n            exp.DataType.Type.STRUCT: \"Tuple\",\n            exp.DataType.Type.TINYINT: \"Int8\",\n            exp.DataType.Type.SMALLINT: \"Int16\",\n            exp.DataType.Type.INT: \"Int32\",\n            exp.DataType.Type.BIGINT: \"Int64\",\n            exp.DataType.Type.FLOAT: \"Float32\",\n            exp.DataType.Type.DOUBLE: \"Float64\",\n        }\n\n        TRANSFORMS = {\n            **generator.Generator.TRANSFORMS,  # type: ignore\n            exp.Array: inline_array_sql,\n            exp.StrPosition: lambda self, e: f\"position({self.format_args(e.this, e.args.get('substr'), e.args.get('position'))})\",\n            exp.Final: lambda self, e: f\"{self.sql(e, 'this')} FINAL\",\n            exp.Map: lambda self, e: _lower_func(var_map_sql(self, e)),\n            exp.VarMap: lambda self, e: _lower_func(var_map_sql(self, e)),\n            exp.Quantile: lambda self, e: f\"quantile{self._param_args_sql(e, 'quantile', 'this')}\",\n            exp.Quantiles: lambda self, e: f\"quantiles{self._param_args_sql(e, 'parameters', 'expressions')}\",\n            exp.QuantileIf: lambda self, e: f\"quantileIf{self._param_args_sql(e, 'parameters', 'expressions')}\",\n        }\n\n        EXPLICIT_UNION = True\n\n        def _param_args_sql(\n            self, expression: exp.Expression, params_name: str, args_name: str\n        ) -> str:\n            params = self.format_args(self.expressions(expression, params_name))\n            args = self.format_args(self.expressions(expression, args_name))\n            return f\"({params})({args})\"\n\n        def cte_sql(self, expression: exp.CTE) -> str:\n            if isinstance(expression.this, exp.Alias):\n                return self.sql(expression, \"this\")\n\n            return super().cte_sql(expression)\n", "path": "sqlglot/dialects/clickhouse.py"}]}