|
27 | 27 | from sqlglot.tokens import Token, TokenType |
28 | 28 | from sqlglot.generator import unsupported_args |
29 | 29 |
|
30 | | -if t.TYPE_CHECKING: |
31 | | - from sqlglot._typing import E |
32 | | - |
33 | 30 | DATEΤΙΜΕ_DELTA = t.Union[exp.DateAdd, exp.DateDiff, exp.DateSub, exp.TimestampSub, exp.TimestampAdd] |
34 | 31 |
|
35 | 32 |
|
@@ -501,7 +498,10 @@ class Parser(parser.Parser): |
501 | 498 |
|
502 | 499 | FUNCTION_PARSERS.pop("MATCH") |
503 | 500 |
|
504 | | - PROPERTY_PARSERS = parser.Parser.PROPERTY_PARSERS.copy() |
| 501 | + PROPERTY_PARSERS = { |
| 502 | + **parser.Parser.PROPERTY_PARSERS, |
| 503 | + "ENGINE": lambda self: self._parse_engine_property(), |
| 504 | + } |
505 | 505 | PROPERTY_PARSERS.pop("DYNAMIC") |
506 | 506 |
|
507 | 507 | NO_PAREN_FUNCTION_PARSERS = parser.Parser.NO_PAREN_FUNCTION_PARSERS.copy() |
@@ -571,11 +571,12 @@ class Parser(parser.Parser): |
571 | 571 | TokenType.L_BRACE: lambda self: self._parse_query_parameter(), |
572 | 572 | } |
573 | 573 |
|
574 | | - def _parse_property_assignment(self, exp_class: t.Type[E], **kwargs: t.Any) -> E: |
575 | | - this = super()._parse_property_assignment(exp_class, **kwargs) |
576 | | - if isinstance(this, exp.EngineProperty) and isinstance(this.this, exp.Null): |
577 | | - this.this.replace(exp.Anonymous(this="Null")) |
578 | | - return this |
| 574 | + def _parse_engine_property(self) -> exp.EngineProperty: |
| 575 | + self._match(TokenType.EQ) |
| 576 | + return self.expression( |
| 577 | + exp.EngineProperty, |
| 578 | + this=self._parse_field(any_token=True, anonymous_func=True), |
| 579 | + ) |
579 | 580 |
|
580 | 581 | # https://clickhouse.com/docs/en/sql-reference/statements/create/function |
581 | 582 | def _parse_user_defined_function_expression(self) -> t.Optional[exp.Expression]: |
|
0 commit comments