diff options
Diffstat (limited to 'sqlglot/dialects/mysql.py')
-rw-r--r-- | sqlglot/dialects/mysql.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sqlglot/dialects/mysql.py b/sqlglot/dialects/mysql.py index 75660f8..554241d 100644 --- a/sqlglot/dialects/mysql.py +++ b/sqlglot/dialects/mysql.py @@ -102,6 +102,7 @@ class MySQL(Dialect): TIME_FORMAT = "'%Y-%m-%d %T'" DPIPE_IS_STRING_CONCAT = False SUPPORTS_USER_DEFINED_TYPES = False + SUPPORTS_SEMI_ANTI_JOIN = False # https://prestodb.io/docs/current/functions/datetime.html#mysql-date-functions TIME_MAPPING = { @@ -519,7 +520,7 @@ class MySQL(Dialect): return self.expression(exp.SetItem, this=charset, collate=collate, kind="NAMES") - def _parse_type(self) -> t.Optional[exp.Expression]: + def _parse_type(self, parse_interval: bool = True) -> t.Optional[exp.Expression]: # mysql binary is special and can work anywhere, even in order by operations # it operates like a no paren func if self._match(TokenType.BINARY, advance=False): @@ -528,7 +529,7 @@ class MySQL(Dialect): if isinstance(data_type, exp.DataType): return self.expression(exp.Cast, this=self._parse_column(), to=data_type) - return super()._parse_type() + return super()._parse_type(parse_interval=parse_interval) class Generator(generator.Generator): LOCKING_READS_SUPPORTED = True @@ -560,7 +561,9 @@ class MySQL(Dialect): exp.NullSafeEQ: lambda self, e: self.binary(e, "<=>"), exp.NullSafeNEQ: lambda self, e: self.not_sql(self.binary(e, "<=>")), exp.Pivot: no_pivot_sql, - exp.Select: transforms.preprocess([transforms.eliminate_distinct_on]), + exp.Select: transforms.preprocess( + [transforms.eliminate_distinct_on, transforms.eliminate_semi_and_anti_joins] + ), exp.StrPosition: strposition_to_locate_sql, exp.StrToDate: _str_to_date_sql, exp.StrToTime: _str_to_date_sql, |