sqlglot.dialects.doris
1from __future__ import annotations 2 3import typing as t 4 5from sqlglot import exp 6from sqlglot.dialects.dialect import ( 7 approx_count_distinct_sql, 8 property_sql, 9 rename_func, 10 time_format, 11 unit_to_str, 12) 13from sqlglot.dialects.mysql import MySQL 14from sqlglot.helper import seq_get 15from sqlglot.tokens import TokenType 16 17 18def _lag_lead_sql(self, expression: exp.Lag | exp.Lead) -> str: 19 return self.func( 20 "LAG" if isinstance(expression, exp.Lag) else "LEAD", 21 expression.this, 22 expression.args.get("offset") or exp.Literal.number(1), 23 expression.args.get("default") or exp.null(), 24 ) 25 26 27# Accept both DATE_TRUNC(datetime, unit) and DATE_TRUNC(unit, datetime) 28def _build_date_trunc(args: t.List[exp.Expression]) -> exp.Expression: 29 a0, a1 = seq_get(args, 0), seq_get(args, 1) 30 31 def _is_unit_like(e: exp.Expression | None) -> bool: 32 if not (isinstance(e, exp.Literal) and e.is_string): 33 return False 34 text = e.this 35 return not any(ch.isdigit() for ch in text) 36 37 # Determine which argument is the unit 38 unit, this = (a0, a1) if _is_unit_like(a0) else (a1, a0) 39 40 return exp.TimestampTrunc(this=this, unit=unit) 41 42 43class Doris(MySQL): 44 DATE_FORMAT = "'yyyy-MM-dd'" 45 DATEINT_FORMAT = "'yyyyMMdd'" 46 TIME_FORMAT = "'yyyy-MM-dd HH:mm:ss'" 47 48 class Parser(MySQL.Parser): 49 FUNCTIONS = { 50 **MySQL.Parser.FUNCTIONS, 51 "COLLECT_SET": exp.ArrayUniqueAgg.from_arg_list, 52 "DATE_TRUNC": _build_date_trunc, 53 "MONTHS_ADD": exp.AddMonths.from_arg_list, 54 "REGEXP": exp.RegexpLike.from_arg_list, 55 "TO_DATE": exp.TsOrDsToDate.from_arg_list, 56 } 57 58 FUNCTION_PARSERS = MySQL.Parser.FUNCTION_PARSERS.copy() 59 FUNCTION_PARSERS.pop("GROUP_CONCAT") 60 61 NO_PAREN_FUNCTIONS = MySQL.Parser.NO_PAREN_FUNCTIONS.copy() 62 NO_PAREN_FUNCTIONS.pop(TokenType.CURRENT_DATE) 63 64 PROPERTY_PARSERS = { 65 **MySQL.Parser.PROPERTY_PARSERS, 66 "PROPERTIES": lambda self: self._parse_wrapped_properties(), 67 "UNIQUE": lambda self: self._parse_composite_key_property(exp.UniqueKeyProperty), 68 # Plain KEY without UNIQUE/DUPLICATE/AGGREGATE prefixes should be treated as UniqueKeyProperty with unique=False 69 "KEY": lambda self: self._parse_composite_key_property(exp.UniqueKeyProperty), 70 "PARTITION BY": lambda self: self._parse_partition_by_opt_range(), 71 "BUILD": lambda self: self._parse_build_property(), 72 "REFRESH": lambda self: self._parse_refresh_property(), 73 } 74 75 def _parse_partitioning_granularity_dynamic(self) -> exp.PartitionByRangePropertyDynamic: 76 self._match_text_seq("FROM") 77 start = self._parse_wrapped(self._parse_string) 78 self._match_text_seq("TO") 79 end = self._parse_wrapped(self._parse_string) 80 self._match_text_seq("INTERVAL") 81 number = self._parse_number() 82 unit = self._parse_var(any_token=True) 83 every = self.expression(exp.Interval, this=number, unit=unit) 84 return self.expression( 85 exp.PartitionByRangePropertyDynamic, start=start, end=end, every=every 86 ) 87 88 def _parse_partition_definition(self) -> exp.Partition: 89 self._match_text_seq("PARTITION") 90 91 name = self._parse_id_var() 92 self._match_text_seq("VALUES") 93 94 if self._match_text_seq("LESS", "THAN"): 95 values = self._parse_wrapped_csv(self._parse_expression) 96 if len(values) == 1 and values[0].name.upper() == "MAXVALUE": 97 values = [exp.var("MAXVALUE")] 98 99 part_range = self.expression(exp.PartitionRange, this=name, expressions=values) 100 return self.expression(exp.Partition, expressions=[part_range]) 101 102 self._match(TokenType.L_BRACKET) 103 values = self._parse_csv(lambda: self._parse_wrapped_csv(self._parse_expression)) 104 105 self._match(TokenType.R_BRACKET) 106 self._match(TokenType.R_PAREN) 107 108 part_range = self.expression(exp.PartitionRange, this=name, expressions=values) 109 return self.expression(exp.Partition, expressions=[part_range]) 110 111 def _parse_partition_definition_list(self) -> exp.Partition: 112 # PARTITION <name> VALUES IN (<value_csv>) 113 self._match_text_seq("PARTITION") 114 name = self._parse_id_var() 115 self._match_text_seq("VALUES", "IN") 116 values = self._parse_wrapped_csv(self._parse_expression) 117 part_list = self.expression(exp.PartitionList, this=name, expressions=values) 118 return self.expression(exp.Partition, expressions=[part_list]) 119 120 def _parse_partition_by_opt_range( 121 self, 122 ) -> exp.PartitionedByProperty | exp.PartitionByRangeProperty | exp.PartitionByListProperty: 123 if self._match_text_seq("LIST"): 124 return self.expression( 125 exp.PartitionByListProperty, 126 partition_expressions=self._parse_wrapped_id_vars(), 127 create_expressions=self._parse_wrapped_csv( 128 self._parse_partition_definition_list 129 ), 130 ) 131 132 if not self._match_text_seq("RANGE"): 133 return super()._parse_partitioned_by() 134 135 partition_expressions = self._parse_wrapped_id_vars() 136 self._match_l_paren() 137 138 if self._match_text_seq("FROM", advance=False): 139 create_expressions = self._parse_csv(self._parse_partitioning_granularity_dynamic) 140 elif self._match_text_seq("PARTITION", advance=False): 141 create_expressions = self._parse_csv(self._parse_partition_definition) 142 else: 143 create_expressions = None 144 145 self._match_r_paren() 146 147 return self.expression( 148 exp.PartitionByRangeProperty, 149 partition_expressions=partition_expressions, 150 create_expressions=create_expressions, 151 ) 152 153 def _parse_build_property(self) -> exp.BuildProperty: 154 return self.expression(exp.BuildProperty, this=self._parse_var(upper=True)) 155 156 def _parse_refresh_property(self) -> exp.RefreshTriggerProperty: 157 method = self._parse_var(upper=True) 158 159 self._match(TokenType.ON) 160 161 kind = self._match_texts(("MANUAL", "COMMIT", "SCHEDULE")) and self._prev.text.upper() 162 every = self._match_text_seq("EVERY") and self._parse_number() 163 unit = self._parse_var(any_token=True) if every else None 164 starts = self._match_text_seq("STARTS") and self._parse_string() 165 166 return self.expression( 167 exp.RefreshTriggerProperty, 168 method=method, 169 kind=kind, 170 every=every, 171 unit=unit, 172 starts=starts, 173 ) 174 175 class Generator(MySQL.Generator): 176 LAST_DAY_SUPPORTS_DATE_PART = False 177 VARCHAR_REQUIRES_SIZE = False 178 WITH_PROPERTIES_PREFIX = "PROPERTIES" 179 RENAME_TABLE_WITH_DB = False 180 181 TYPE_MAPPING = { 182 **MySQL.Generator.TYPE_MAPPING, 183 exp.DataType.Type.TEXT: "STRING", 184 exp.DataType.Type.TIMESTAMP: "DATETIME", 185 exp.DataType.Type.TIMESTAMPTZ: "DATETIME", 186 } 187 188 PROPERTIES_LOCATION = { 189 **MySQL.Generator.PROPERTIES_LOCATION, 190 exp.UniqueKeyProperty: exp.Properties.Location.POST_SCHEMA, 191 exp.PartitionByRangeProperty: exp.Properties.Location.POST_SCHEMA, 192 exp.PartitionByListProperty: exp.Properties.Location.POST_SCHEMA, 193 exp.PartitionedByProperty: exp.Properties.Location.POST_SCHEMA, 194 exp.BuildProperty: exp.Properties.Location.POST_SCHEMA, 195 exp.RefreshTriggerProperty: exp.Properties.Location.POST_SCHEMA, 196 } 197 198 CAST_MAPPING = {} 199 TIMESTAMP_FUNC_TYPES = set() 200 201 TRANSFORMS = { 202 **MySQL.Generator.TRANSFORMS, 203 exp.AddMonths: rename_func("MONTHS_ADD"), 204 exp.ApproxDistinct: approx_count_distinct_sql, 205 exp.ArgMax: rename_func("MAX_BY"), 206 exp.ArgMin: rename_func("MIN_BY"), 207 exp.ArrayAgg: rename_func("COLLECT_LIST"), 208 exp.ArrayToString: rename_func("ARRAY_JOIN"), 209 exp.ArrayUniqueAgg: rename_func("COLLECT_SET"), 210 exp.CurrentDate: lambda self, _: self.func("CURRENT_DATE"), 211 exp.CurrentTimestamp: lambda self, _: self.func("NOW"), 212 exp.DateTrunc: lambda self, e: self.func("DATE_TRUNC", e.this, unit_to_str(e)), 213 exp.GroupConcat: lambda self, e: self.func( 214 "GROUP_CONCAT", e.this, e.args.get("separator") or exp.Literal.string(",") 215 ), 216 exp.JSONExtractScalar: lambda self, e: self.func("JSON_EXTRACT", e.this, e.expression), 217 exp.Lag: _lag_lead_sql, 218 exp.Lead: _lag_lead_sql, 219 exp.Map: rename_func("ARRAY_MAP"), 220 exp.Property: property_sql, 221 exp.RegexpLike: rename_func("REGEXP"), 222 exp.RegexpSplit: rename_func("SPLIT_BY_STRING"), 223 exp.SchemaCommentProperty: lambda self, e: self.naked_property(e), 224 exp.Split: rename_func("SPLIT_BY_STRING"), 225 exp.StringToArray: rename_func("SPLIT_BY_STRING"), 226 exp.StrToUnix: lambda self, e: self.func("UNIX_TIMESTAMP", e.this, self.format_time(e)), 227 exp.TimeStrToDate: rename_func("TO_DATE"), 228 exp.TsOrDsAdd: lambda self, e: self.func("DATE_ADD", e.this, e.expression), 229 exp.TsOrDsToDate: lambda self, e: self.func("TO_DATE", e.this), 230 exp.TimeToUnix: rename_func("UNIX_TIMESTAMP"), 231 exp.TimestampTrunc: lambda self, e: self.func("DATE_TRUNC", e.this, unit_to_str(e)), 232 exp.UnixToStr: lambda self, e: self.func( 233 "FROM_UNIXTIME", e.this, time_format("doris")(self, e) 234 ), 235 exp.UnixToTime: rename_func("FROM_UNIXTIME"), 236 } 237 238 # https://github.com/apache/doris/blob/e4f41dbf1ec03f5937fdeba2ee1454a20254015b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisLexer.g4#L93 239 RESERVED_KEYWORDS = { 240 "account_lock", 241 "account_unlock", 242 "add", 243 "adddate", 244 "admin", 245 "after", 246 "agg_state", 247 "aggregate", 248 "alias", 249 "all", 250 "alter", 251 "analyze", 252 "analyzed", 253 "and", 254 "anti", 255 "append", 256 "array", 257 "array_range", 258 "as", 259 "asc", 260 "at", 261 "authors", 262 "auto", 263 "auto_increment", 264 "backend", 265 "backends", 266 "backup", 267 "begin", 268 "belong", 269 "between", 270 "bigint", 271 "bin", 272 "binary", 273 "binlog", 274 "bitand", 275 "bitmap", 276 "bitmap_union", 277 "bitor", 278 "bitxor", 279 "blob", 280 "boolean", 281 "brief", 282 "broker", 283 "buckets", 284 "build", 285 "builtin", 286 "bulk", 287 "by", 288 "cached", 289 "call", 290 "cancel", 291 "case", 292 "cast", 293 "catalog", 294 "catalogs", 295 "chain", 296 "char", 297 "character", 298 "charset", 299 "check", 300 "clean", 301 "cluster", 302 "clusters", 303 "collate", 304 "collation", 305 "collect", 306 "column", 307 "columns", 308 "comment", 309 "commit", 310 "committed", 311 "compact", 312 "complete", 313 "config", 314 "connection", 315 "connection_id", 316 "consistent", 317 "constraint", 318 "constraints", 319 "convert", 320 "copy", 321 "count", 322 "create", 323 "creation", 324 "cron", 325 "cross", 326 "cube", 327 "current", 328 "current_catalog", 329 "current_date", 330 "current_time", 331 "current_timestamp", 332 "current_user", 333 "data", 334 "database", 335 "databases", 336 "date", 337 "date_add", 338 "date_ceil", 339 "date_diff", 340 "date_floor", 341 "date_sub", 342 "dateadd", 343 "datediff", 344 "datetime", 345 "datetimev2", 346 "datev2", 347 "datetimev1", 348 "datev1", 349 "day", 350 "days_add", 351 "days_sub", 352 "decimal", 353 "decimalv2", 354 "decimalv3", 355 "decommission", 356 "default", 357 "deferred", 358 "delete", 359 "demand", 360 "desc", 361 "describe", 362 "diagnose", 363 "disk", 364 "distinct", 365 "distinctpc", 366 "distinctpcsa", 367 "distributed", 368 "distribution", 369 "div", 370 "do", 371 "doris_internal_table_id", 372 "double", 373 "drop", 374 "dropp", 375 "dual", 376 "duplicate", 377 "dynamic", 378 "else", 379 "enable", 380 "encryptkey", 381 "encryptkeys", 382 "end", 383 "ends", 384 "engine", 385 "engines", 386 "enter", 387 "errors", 388 "events", 389 "every", 390 "except", 391 "exclude", 392 "execute", 393 "exists", 394 "expired", 395 "explain", 396 "export", 397 "extended", 398 "external", 399 "extract", 400 "failed_login_attempts", 401 "false", 402 "fast", 403 "feature", 404 "fields", 405 "file", 406 "filter", 407 "first", 408 "float", 409 "follower", 410 "following", 411 "for", 412 "foreign", 413 "force", 414 "format", 415 "free", 416 "from", 417 "frontend", 418 "frontends", 419 "full", 420 "function", 421 "functions", 422 "generic", 423 "global", 424 "grant", 425 "grants", 426 "graph", 427 "group", 428 "grouping", 429 "groups", 430 "hash", 431 "having", 432 "hdfs", 433 "help", 434 "histogram", 435 "hll", 436 "hll_union", 437 "hostname", 438 "hour", 439 "hub", 440 "identified", 441 "if", 442 "ignore", 443 "immediate", 444 "in", 445 "incremental", 446 "index", 447 "indexes", 448 "infile", 449 "inner", 450 "insert", 451 "install", 452 "int", 453 "integer", 454 "intermediate", 455 "intersect", 456 "interval", 457 "into", 458 "inverted", 459 "ipv4", 460 "ipv6", 461 "is", 462 "is_not_null_pred", 463 "is_null_pred", 464 "isnull", 465 "isolation", 466 "job", 467 "jobs", 468 "join", 469 "json", 470 "jsonb", 471 "key", 472 "keys", 473 "kill", 474 "label", 475 "largeint", 476 "last", 477 "lateral", 478 "ldap", 479 "ldap_admin_password", 480 "left", 481 "less", 482 "level", 483 "like", 484 "limit", 485 "lines", 486 "link", 487 "list", 488 "load", 489 "local", 490 "localtime", 491 "localtimestamp", 492 "location", 493 "lock", 494 "logical", 495 "low_priority", 496 "manual", 497 "map", 498 "match", 499 "match_all", 500 "match_any", 501 "match_phrase", 502 "match_phrase_edge", 503 "match_phrase_prefix", 504 "match_regexp", 505 "materialized", 506 "max", 507 "maxvalue", 508 "memo", 509 "merge", 510 "migrate", 511 "migrations", 512 "min", 513 "minus", 514 "minute", 515 "modify", 516 "month", 517 "mtmv", 518 "name", 519 "names", 520 "natural", 521 "negative", 522 "never", 523 "next", 524 "ngram_bf", 525 "no", 526 "non_nullable", 527 "not", 528 "null", 529 "nulls", 530 "observer", 531 "of", 532 "offset", 533 "on", 534 "only", 535 "open", 536 "optimized", 537 "or", 538 "order", 539 "outer", 540 "outfile", 541 "over", 542 "overwrite", 543 "parameter", 544 "parsed", 545 "partition", 546 "partitions", 547 "password", 548 "password_expire", 549 "password_history", 550 "password_lock_time", 551 "password_reuse", 552 "path", 553 "pause", 554 "percent", 555 "period", 556 "permissive", 557 "physical", 558 "plan", 559 "process", 560 "plugin", 561 "plugins", 562 "policy", 563 "preceding", 564 "prepare", 565 "primary", 566 "proc", 567 "procedure", 568 "processlist", 569 "profile", 570 "properties", 571 "property", 572 "quantile_state", 573 "quantile_union", 574 "query", 575 "quota", 576 "random", 577 "range", 578 "read", 579 "real", 580 "rebalance", 581 "recover", 582 "recycle", 583 "refresh", 584 "references", 585 "regexp", 586 "release", 587 "rename", 588 "repair", 589 "repeatable", 590 "replace", 591 "replace_if_not_null", 592 "replica", 593 "repositories", 594 "repository", 595 "resource", 596 "resources", 597 "restore", 598 "restrictive", 599 "resume", 600 "returns", 601 "revoke", 602 "rewritten", 603 "right", 604 "rlike", 605 "role", 606 "roles", 607 "rollback", 608 "rollup", 609 "routine", 610 "row", 611 "rows", 612 "s3", 613 "sample", 614 "schedule", 615 "scheduler", 616 "schema", 617 "schemas", 618 "second", 619 "select", 620 "semi", 621 "sequence", 622 "serializable", 623 "session", 624 "set", 625 "sets", 626 "shape", 627 "show", 628 "signed", 629 "skew", 630 "smallint", 631 "snapshot", 632 "soname", 633 "split", 634 "sql_block_rule", 635 "start", 636 "starts", 637 "stats", 638 "status", 639 "stop", 640 "storage", 641 "stream", 642 "streaming", 643 "string", 644 "struct", 645 "subdate", 646 "sum", 647 "superuser", 648 "switch", 649 "sync", 650 "system", 651 "table", 652 "tables", 653 "tablesample", 654 "tablet", 655 "tablets", 656 "task", 657 "tasks", 658 "temporary", 659 "terminated", 660 "text", 661 "than", 662 "then", 663 "time", 664 "timestamp", 665 "timestampadd", 666 "timestampdiff", 667 "tinyint", 668 "to", 669 "transaction", 670 "trash", 671 "tree", 672 "triggers", 673 "trim", 674 "true", 675 "truncate", 676 "type", 677 "type_cast", 678 "types", 679 "unbounded", 680 "uncommitted", 681 "uninstall", 682 "union", 683 "unique", 684 "unlock", 685 "unsigned", 686 "update", 687 "use", 688 "user", 689 "using", 690 "value", 691 "values", 692 "varchar", 693 "variables", 694 "variant", 695 "vault", 696 "verbose", 697 "version", 698 "view", 699 "warnings", 700 "week", 701 "when", 702 "where", 703 "whitelist", 704 "with", 705 "work", 706 "workload", 707 "write", 708 "xor", 709 "year", 710 } 711 712 def uniquekeyproperty_sql( 713 self, expression: exp.UniqueKeyProperty, prefix: str = "UNIQUE KEY" 714 ) -> str: 715 create_stmt = expression.find_ancestor(exp.Create) 716 if create_stmt and create_stmt.args["properties"].find(exp.MaterializedProperty): 717 return super().uniquekeyproperty_sql(expression, prefix="KEY") 718 719 return super().uniquekeyproperty_sql(expression) 720 721 def partition_sql(self, expression: exp.Partition) -> str: 722 parent = expression.parent 723 if isinstance(parent, (exp.PartitionByRangeProperty, exp.PartitionByListProperty)): 724 return ", ".join(self.sql(e) for e in expression.expressions) 725 return super().partition_sql(expression) 726 727 def partitionrange_sql(self, expression: exp.PartitionRange) -> str: 728 name = self.sql(expression, "this") 729 values = expression.expressions 730 731 if len(values) != 1: 732 # Multiple values: use VALUES [ ... ) 733 if values and isinstance(values[0], list): 734 values_sql = ", ".join( 735 f"({', '.join(self.sql(v) for v in inner)})" for inner in values 736 ) 737 else: 738 values_sql = ", ".join(f"({self.sql(v)})" for v in values) 739 740 return f"PARTITION {name} VALUES [{values_sql})" 741 742 return f"PARTITION {name} VALUES LESS THAN ({self.sql(values[0])})" 743 744 def partitionbyrangepropertydynamic_sql( 745 self, expression: exp.PartitionByRangePropertyDynamic 746 ) -> str: 747 # Generates: FROM ("start") TO ("end") INTERVAL N UNIT 748 start = self.sql(expression, "start") 749 end = self.sql(expression, "end") 750 every = expression.args.get("every") 751 752 if every: 753 number = self.sql(every, "this") 754 interval = f"INTERVAL {number} {self.sql(every, 'unit')}" 755 else: 756 interval = "" 757 758 return f"FROM ({start}) TO ({end}) {interval}" 759 760 def partitionbyrangeproperty_sql(self, expression: exp.PartitionByRangeProperty) -> str: 761 partition_expressions = self.expressions( 762 expression, key="partition_expressions", indent=False 763 ) 764 create_sql = self.expressions(expression, key="create_expressions", indent=False) 765 return f"PARTITION BY RANGE ({partition_expressions}) ({create_sql})" 766 767 def partitionbylistproperty_sql(self, expression: exp.PartitionByListProperty) -> str: 768 partition_expressions = self.expressions( 769 expression, key="partition_expressions", indent=False 770 ) 771 create_sql = self.expressions(expression, key="create_expressions", indent=False) 772 return f"PARTITION BY LIST ({partition_expressions}) ({create_sql})" 773 774 def partitionlist_sql(self, expression: exp.PartitionList) -> str: 775 name = self.sql(expression, "this") 776 values = self.expressions(expression, indent=False) 777 return f"PARTITION {name} VALUES IN ({values})" 778 779 def partitionedbyproperty_sql(self, expression: exp.PartitionedByProperty) -> str: 780 node = expression.this 781 if isinstance(node, exp.Schema): 782 parts = ", ".join(self.sql(e) for e in node.expressions) 783 return f"PARTITION BY ({parts})" 784 return f"PARTITION BY ({self.sql(node)})" 785 786 def table_sql(self, expression: exp.Table, sep: str = " AS ") -> str: 787 """Override table_sql to avoid AS keyword in UPDATE and DELETE statements.""" 788 ancestor = expression.find_ancestor(exp.Update, exp.Delete, exp.Select) 789 if not isinstance(ancestor, exp.Select): 790 sep = " " 791 return super().table_sql(expression, sep=sep) 792 793 def alterrename_sql(self, expression: exp.AlterRename, include_to: bool = True) -> str: 794 return super().alterrename_sql(expression, include_to=False)
44class Doris(MySQL): 45 DATE_FORMAT = "'yyyy-MM-dd'" 46 DATEINT_FORMAT = "'yyyyMMdd'" 47 TIME_FORMAT = "'yyyy-MM-dd HH:mm:ss'" 48 49 class Parser(MySQL.Parser): 50 FUNCTIONS = { 51 **MySQL.Parser.FUNCTIONS, 52 "COLLECT_SET": exp.ArrayUniqueAgg.from_arg_list, 53 "DATE_TRUNC": _build_date_trunc, 54 "MONTHS_ADD": exp.AddMonths.from_arg_list, 55 "REGEXP": exp.RegexpLike.from_arg_list, 56 "TO_DATE": exp.TsOrDsToDate.from_arg_list, 57 } 58 59 FUNCTION_PARSERS = MySQL.Parser.FUNCTION_PARSERS.copy() 60 FUNCTION_PARSERS.pop("GROUP_CONCAT") 61 62 NO_PAREN_FUNCTIONS = MySQL.Parser.NO_PAREN_FUNCTIONS.copy() 63 NO_PAREN_FUNCTIONS.pop(TokenType.CURRENT_DATE) 64 65 PROPERTY_PARSERS = { 66 **MySQL.Parser.PROPERTY_PARSERS, 67 "PROPERTIES": lambda self: self._parse_wrapped_properties(), 68 "UNIQUE": lambda self: self._parse_composite_key_property(exp.UniqueKeyProperty), 69 # Plain KEY without UNIQUE/DUPLICATE/AGGREGATE prefixes should be treated as UniqueKeyProperty with unique=False 70 "KEY": lambda self: self._parse_composite_key_property(exp.UniqueKeyProperty), 71 "PARTITION BY": lambda self: self._parse_partition_by_opt_range(), 72 "BUILD": lambda self: self._parse_build_property(), 73 "REFRESH": lambda self: self._parse_refresh_property(), 74 } 75 76 def _parse_partitioning_granularity_dynamic(self) -> exp.PartitionByRangePropertyDynamic: 77 self._match_text_seq("FROM") 78 start = self._parse_wrapped(self._parse_string) 79 self._match_text_seq("TO") 80 end = self._parse_wrapped(self._parse_string) 81 self._match_text_seq("INTERVAL") 82 number = self._parse_number() 83 unit = self._parse_var(any_token=True) 84 every = self.expression(exp.Interval, this=number, unit=unit) 85 return self.expression( 86 exp.PartitionByRangePropertyDynamic, start=start, end=end, every=every 87 ) 88 89 def _parse_partition_definition(self) -> exp.Partition: 90 self._match_text_seq("PARTITION") 91 92 name = self._parse_id_var() 93 self._match_text_seq("VALUES") 94 95 if self._match_text_seq("LESS", "THAN"): 96 values = self._parse_wrapped_csv(self._parse_expression) 97 if len(values) == 1 and values[0].name.upper() == "MAXVALUE": 98 values = [exp.var("MAXVALUE")] 99 100 part_range = self.expression(exp.PartitionRange, this=name, expressions=values) 101 return self.expression(exp.Partition, expressions=[part_range]) 102 103 self._match(TokenType.L_BRACKET) 104 values = self._parse_csv(lambda: self._parse_wrapped_csv(self._parse_expression)) 105 106 self._match(TokenType.R_BRACKET) 107 self._match(TokenType.R_PAREN) 108 109 part_range = self.expression(exp.PartitionRange, this=name, expressions=values) 110 return self.expression(exp.Partition, expressions=[part_range]) 111 112 def _parse_partition_definition_list(self) -> exp.Partition: 113 # PARTITION <name> VALUES IN (<value_csv>) 114 self._match_text_seq("PARTITION") 115 name = self._parse_id_var() 116 self._match_text_seq("VALUES", "IN") 117 values = self._parse_wrapped_csv(self._parse_expression) 118 part_list = self.expression(exp.PartitionList, this=name, expressions=values) 119 return self.expression(exp.Partition, expressions=[part_list]) 120 121 def _parse_partition_by_opt_range( 122 self, 123 ) -> exp.PartitionedByProperty | exp.PartitionByRangeProperty | exp.PartitionByListProperty: 124 if self._match_text_seq("LIST"): 125 return self.expression( 126 exp.PartitionByListProperty, 127 partition_expressions=self._parse_wrapped_id_vars(), 128 create_expressions=self._parse_wrapped_csv( 129 self._parse_partition_definition_list 130 ), 131 ) 132 133 if not self._match_text_seq("RANGE"): 134 return super()._parse_partitioned_by() 135 136 partition_expressions = self._parse_wrapped_id_vars() 137 self._match_l_paren() 138 139 if self._match_text_seq("FROM", advance=False): 140 create_expressions = self._parse_csv(self._parse_partitioning_granularity_dynamic) 141 elif self._match_text_seq("PARTITION", advance=False): 142 create_expressions = self._parse_csv(self._parse_partition_definition) 143 else: 144 create_expressions = None 145 146 self._match_r_paren() 147 148 return self.expression( 149 exp.PartitionByRangeProperty, 150 partition_expressions=partition_expressions, 151 create_expressions=create_expressions, 152 ) 153 154 def _parse_build_property(self) -> exp.BuildProperty: 155 return self.expression(exp.BuildProperty, this=self._parse_var(upper=True)) 156 157 def _parse_refresh_property(self) -> exp.RefreshTriggerProperty: 158 method = self._parse_var(upper=True) 159 160 self._match(TokenType.ON) 161 162 kind = self._match_texts(("MANUAL", "COMMIT", "SCHEDULE")) and self._prev.text.upper() 163 every = self._match_text_seq("EVERY") and self._parse_number() 164 unit = self._parse_var(any_token=True) if every else None 165 starts = self._match_text_seq("STARTS") and self._parse_string() 166 167 return self.expression( 168 exp.RefreshTriggerProperty, 169 method=method, 170 kind=kind, 171 every=every, 172 unit=unit, 173 starts=starts, 174 ) 175 176 class Generator(MySQL.Generator): 177 LAST_DAY_SUPPORTS_DATE_PART = False 178 VARCHAR_REQUIRES_SIZE = False 179 WITH_PROPERTIES_PREFIX = "PROPERTIES" 180 RENAME_TABLE_WITH_DB = False 181 182 TYPE_MAPPING = { 183 **MySQL.Generator.TYPE_MAPPING, 184 exp.DataType.Type.TEXT: "STRING", 185 exp.DataType.Type.TIMESTAMP: "DATETIME", 186 exp.DataType.Type.TIMESTAMPTZ: "DATETIME", 187 } 188 189 PROPERTIES_LOCATION = { 190 **MySQL.Generator.PROPERTIES_LOCATION, 191 exp.UniqueKeyProperty: exp.Properties.Location.POST_SCHEMA, 192 exp.PartitionByRangeProperty: exp.Properties.Location.POST_SCHEMA, 193 exp.PartitionByListProperty: exp.Properties.Location.POST_SCHEMA, 194 exp.PartitionedByProperty: exp.Properties.Location.POST_SCHEMA, 195 exp.BuildProperty: exp.Properties.Location.POST_SCHEMA, 196 exp.RefreshTriggerProperty: exp.Properties.Location.POST_SCHEMA, 197 } 198 199 CAST_MAPPING = {} 200 TIMESTAMP_FUNC_TYPES = set() 201 202 TRANSFORMS = { 203 **MySQL.Generator.TRANSFORMS, 204 exp.AddMonths: rename_func("MONTHS_ADD"), 205 exp.ApproxDistinct: approx_count_distinct_sql, 206 exp.ArgMax: rename_func("MAX_BY"), 207 exp.ArgMin: rename_func("MIN_BY"), 208 exp.ArrayAgg: rename_func("COLLECT_LIST"), 209 exp.ArrayToString: rename_func("ARRAY_JOIN"), 210 exp.ArrayUniqueAgg: rename_func("COLLECT_SET"), 211 exp.CurrentDate: lambda self, _: self.func("CURRENT_DATE"), 212 exp.CurrentTimestamp: lambda self, _: self.func("NOW"), 213 exp.DateTrunc: lambda self, e: self.func("DATE_TRUNC", e.this, unit_to_str(e)), 214 exp.GroupConcat: lambda self, e: self.func( 215 "GROUP_CONCAT", e.this, e.args.get("separator") or exp.Literal.string(",") 216 ), 217 exp.JSONExtractScalar: lambda self, e: self.func("JSON_EXTRACT", e.this, e.expression), 218 exp.Lag: _lag_lead_sql, 219 exp.Lead: _lag_lead_sql, 220 exp.Map: rename_func("ARRAY_MAP"), 221 exp.Property: property_sql, 222 exp.RegexpLike: rename_func("REGEXP"), 223 exp.RegexpSplit: rename_func("SPLIT_BY_STRING"), 224 exp.SchemaCommentProperty: lambda self, e: self.naked_property(e), 225 exp.Split: rename_func("SPLIT_BY_STRING"), 226 exp.StringToArray: rename_func("SPLIT_BY_STRING"), 227 exp.StrToUnix: lambda self, e: self.func("UNIX_TIMESTAMP", e.this, self.format_time(e)), 228 exp.TimeStrToDate: rename_func("TO_DATE"), 229 exp.TsOrDsAdd: lambda self, e: self.func("DATE_ADD", e.this, e.expression), 230 exp.TsOrDsToDate: lambda self, e: self.func("TO_DATE", e.this), 231 exp.TimeToUnix: rename_func("UNIX_TIMESTAMP"), 232 exp.TimestampTrunc: lambda self, e: self.func("DATE_TRUNC", e.this, unit_to_str(e)), 233 exp.UnixToStr: lambda self, e: self.func( 234 "FROM_UNIXTIME", e.this, time_format("doris")(self, e) 235 ), 236 exp.UnixToTime: rename_func("FROM_UNIXTIME"), 237 } 238 239 # https://github.com/apache/doris/blob/e4f41dbf1ec03f5937fdeba2ee1454a20254015b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisLexer.g4#L93 240 RESERVED_KEYWORDS = { 241 "account_lock", 242 "account_unlock", 243 "add", 244 "adddate", 245 "admin", 246 "after", 247 "agg_state", 248 "aggregate", 249 "alias", 250 "all", 251 "alter", 252 "analyze", 253 "analyzed", 254 "and", 255 "anti", 256 "append", 257 "array", 258 "array_range", 259 "as", 260 "asc", 261 "at", 262 "authors", 263 "auto", 264 "auto_increment", 265 "backend", 266 "backends", 267 "backup", 268 "begin", 269 "belong", 270 "between", 271 "bigint", 272 "bin", 273 "binary", 274 "binlog", 275 "bitand", 276 "bitmap", 277 "bitmap_union", 278 "bitor", 279 "bitxor", 280 "blob", 281 "boolean", 282 "brief", 283 "broker", 284 "buckets", 285 "build", 286 "builtin", 287 "bulk", 288 "by", 289 "cached", 290 "call", 291 "cancel", 292 "case", 293 "cast", 294 "catalog", 295 "catalogs", 296 "chain", 297 "char", 298 "character", 299 "charset", 300 "check", 301 "clean", 302 "cluster", 303 "clusters", 304 "collate", 305 "collation", 306 "collect", 307 "column", 308 "columns", 309 "comment", 310 "commit", 311 "committed", 312 "compact", 313 "complete", 314 "config", 315 "connection", 316 "connection_id", 317 "consistent", 318 "constraint", 319 "constraints", 320 "convert", 321 "copy", 322 "count", 323 "create", 324 "creation", 325 "cron", 326 "cross", 327 "cube", 328 "current", 329 "current_catalog", 330 "current_date", 331 "current_time", 332 "current_timestamp", 333 "current_user", 334 "data", 335 "database", 336 "databases", 337 "date", 338 "date_add", 339 "date_ceil", 340 "date_diff", 341 "date_floor", 342 "date_sub", 343 "dateadd", 344 "datediff", 345 "datetime", 346 "datetimev2", 347 "datev2", 348 "datetimev1", 349 "datev1", 350 "day", 351 "days_add", 352 "days_sub", 353 "decimal", 354 "decimalv2", 355 "decimalv3", 356 "decommission", 357 "default", 358 "deferred", 359 "delete", 360 "demand", 361 "desc", 362 "describe", 363 "diagnose", 364 "disk", 365 "distinct", 366 "distinctpc", 367 "distinctpcsa", 368 "distributed", 369 "distribution", 370 "div", 371 "do", 372 "doris_internal_table_id", 373 "double", 374 "drop", 375 "dropp", 376 "dual", 377 "duplicate", 378 "dynamic", 379 "else", 380 "enable", 381 "encryptkey", 382 "encryptkeys", 383 "end", 384 "ends", 385 "engine", 386 "engines", 387 "enter", 388 "errors", 389 "events", 390 "every", 391 "except", 392 "exclude", 393 "execute", 394 "exists", 395 "expired", 396 "explain", 397 "export", 398 "extended", 399 "external", 400 "extract", 401 "failed_login_attempts", 402 "false", 403 "fast", 404 "feature", 405 "fields", 406 "file", 407 "filter", 408 "first", 409 "float", 410 "follower", 411 "following", 412 "for", 413 "foreign", 414 "force", 415 "format", 416 "free", 417 "from", 418 "frontend", 419 "frontends", 420 "full", 421 "function", 422 "functions", 423 "generic", 424 "global", 425 "grant", 426 "grants", 427 "graph", 428 "group", 429 "grouping", 430 "groups", 431 "hash", 432 "having", 433 "hdfs", 434 "help", 435 "histogram", 436 "hll", 437 "hll_union", 438 "hostname", 439 "hour", 440 "hub", 441 "identified", 442 "if", 443 "ignore", 444 "immediate", 445 "in", 446 "incremental", 447 "index", 448 "indexes", 449 "infile", 450 "inner", 451 "insert", 452 "install", 453 "int", 454 "integer", 455 "intermediate", 456 "intersect", 457 "interval", 458 "into", 459 "inverted", 460 "ipv4", 461 "ipv6", 462 "is", 463 "is_not_null_pred", 464 "is_null_pred", 465 "isnull", 466 "isolation", 467 "job", 468 "jobs", 469 "join", 470 "json", 471 "jsonb", 472 "key", 473 "keys", 474 "kill", 475 "label", 476 "largeint", 477 "last", 478 "lateral", 479 "ldap", 480 "ldap_admin_password", 481 "left", 482 "less", 483 "level", 484 "like", 485 "limit", 486 "lines", 487 "link", 488 "list", 489 "load", 490 "local", 491 "localtime", 492 "localtimestamp", 493 "location", 494 "lock", 495 "logical", 496 "low_priority", 497 "manual", 498 "map", 499 "match", 500 "match_all", 501 "match_any", 502 "match_phrase", 503 "match_phrase_edge", 504 "match_phrase_prefix", 505 "match_regexp", 506 "materialized", 507 "max", 508 "maxvalue", 509 "memo", 510 "merge", 511 "migrate", 512 "migrations", 513 "min", 514 "minus", 515 "minute", 516 "modify", 517 "month", 518 "mtmv", 519 "name", 520 "names", 521 "natural", 522 "negative", 523 "never", 524 "next", 525 "ngram_bf", 526 "no", 527 "non_nullable", 528 "not", 529 "null", 530 "nulls", 531 "observer", 532 "of", 533 "offset", 534 "on", 535 "only", 536 "open", 537 "optimized", 538 "or", 539 "order", 540 "outer", 541 "outfile", 542 "over", 543 "overwrite", 544 "parameter", 545 "parsed", 546 "partition", 547 "partitions", 548 "password", 549 "password_expire", 550 "password_history", 551 "password_lock_time", 552 "password_reuse", 553 "path", 554 "pause", 555 "percent", 556 "period", 557 "permissive", 558 "physical", 559 "plan", 560 "process", 561 "plugin", 562 "plugins", 563 "policy", 564 "preceding", 565 "prepare", 566 "primary", 567 "proc", 568 "procedure", 569 "processlist", 570 "profile", 571 "properties", 572 "property", 573 "quantile_state", 574 "quantile_union", 575 "query", 576 "quota", 577 "random", 578 "range", 579 "read", 580 "real", 581 "rebalance", 582 "recover", 583 "recycle", 584 "refresh", 585 "references", 586 "regexp", 587 "release", 588 "rename", 589 "repair", 590 "repeatable", 591 "replace", 592 "replace_if_not_null", 593 "replica", 594 "repositories", 595 "repository", 596 "resource", 597 "resources", 598 "restore", 599 "restrictive", 600 "resume", 601 "returns", 602 "revoke", 603 "rewritten", 604 "right", 605 "rlike", 606 "role", 607 "roles", 608 "rollback", 609 "rollup", 610 "routine", 611 "row", 612 "rows", 613 "s3", 614 "sample", 615 "schedule", 616 "scheduler", 617 "schema", 618 "schemas", 619 "second", 620 "select", 621 "semi", 622 "sequence", 623 "serializable", 624 "session", 625 "set", 626 "sets", 627 "shape", 628 "show", 629 "signed", 630 "skew", 631 "smallint", 632 "snapshot", 633 "soname", 634 "split", 635 "sql_block_rule", 636 "start", 637 "starts", 638 "stats", 639 "status", 640 "stop", 641 "storage", 642 "stream", 643 "streaming", 644 "string", 645 "struct", 646 "subdate", 647 "sum", 648 "superuser", 649 "switch", 650 "sync", 651 "system", 652 "table", 653 "tables", 654 "tablesample", 655 "tablet", 656 "tablets", 657 "task", 658 "tasks", 659 "temporary", 660 "terminated", 661 "text", 662 "than", 663 "then", 664 "time", 665 "timestamp", 666 "timestampadd", 667 "timestampdiff", 668 "tinyint", 669 "to", 670 "transaction", 671 "trash", 672 "tree", 673 "triggers", 674 "trim", 675 "true", 676 "truncate", 677 "type", 678 "type_cast", 679 "types", 680 "unbounded", 681 "uncommitted", 682 "uninstall", 683 "union", 684 "unique", 685 "unlock", 686 "unsigned", 687 "update", 688 "use", 689 "user", 690 "using", 691 "value", 692 "values", 693 "varchar", 694 "variables", 695 "variant", 696 "vault", 697 "verbose", 698 "version", 699 "view", 700 "warnings", 701 "week", 702 "when", 703 "where", 704 "whitelist", 705 "with", 706 "work", 707 "workload", 708 "write", 709 "xor", 710 "year", 711 } 712 713 def uniquekeyproperty_sql( 714 self, expression: exp.UniqueKeyProperty, prefix: str = "UNIQUE KEY" 715 ) -> str: 716 create_stmt = expression.find_ancestor(exp.Create) 717 if create_stmt and create_stmt.args["properties"].find(exp.MaterializedProperty): 718 return super().uniquekeyproperty_sql(expression, prefix="KEY") 719 720 return super().uniquekeyproperty_sql(expression) 721 722 def partition_sql(self, expression: exp.Partition) -> str: 723 parent = expression.parent 724 if isinstance(parent, (exp.PartitionByRangeProperty, exp.PartitionByListProperty)): 725 return ", ".join(self.sql(e) for e in expression.expressions) 726 return super().partition_sql(expression) 727 728 def partitionrange_sql(self, expression: exp.PartitionRange) -> str: 729 name = self.sql(expression, "this") 730 values = expression.expressions 731 732 if len(values) != 1: 733 # Multiple values: use VALUES [ ... ) 734 if values and isinstance(values[0], list): 735 values_sql = ", ".join( 736 f"({', '.join(self.sql(v) for v in inner)})" for inner in values 737 ) 738 else: 739 values_sql = ", ".join(f"({self.sql(v)})" for v in values) 740 741 return f"PARTITION {name} VALUES [{values_sql})" 742 743 return f"PARTITION {name} VALUES LESS THAN ({self.sql(values[0])})" 744 745 def partitionbyrangepropertydynamic_sql( 746 self, expression: exp.PartitionByRangePropertyDynamic 747 ) -> str: 748 # Generates: FROM ("start") TO ("end") INTERVAL N UNIT 749 start = self.sql(expression, "start") 750 end = self.sql(expression, "end") 751 every = expression.args.get("every") 752 753 if every: 754 number = self.sql(every, "this") 755 interval = f"INTERVAL {number} {self.sql(every, 'unit')}" 756 else: 757 interval = "" 758 759 return f"FROM ({start}) TO ({end}) {interval}" 760 761 def partitionbyrangeproperty_sql(self, expression: exp.PartitionByRangeProperty) -> str: 762 partition_expressions = self.expressions( 763 expression, key="partition_expressions", indent=False 764 ) 765 create_sql = self.expressions(expression, key="create_expressions", indent=False) 766 return f"PARTITION BY RANGE ({partition_expressions}) ({create_sql})" 767 768 def partitionbylistproperty_sql(self, expression: exp.PartitionByListProperty) -> str: 769 partition_expressions = self.expressions( 770 expression, key="partition_expressions", indent=False 771 ) 772 create_sql = self.expressions(expression, key="create_expressions", indent=False) 773 return f"PARTITION BY LIST ({partition_expressions}) ({create_sql})" 774 775 def partitionlist_sql(self, expression: exp.PartitionList) -> str: 776 name = self.sql(expression, "this") 777 values = self.expressions(expression, indent=False) 778 return f"PARTITION {name} VALUES IN ({values})" 779 780 def partitionedbyproperty_sql(self, expression: exp.PartitionedByProperty) -> str: 781 node = expression.this 782 if isinstance(node, exp.Schema): 783 parts = ", ".join(self.sql(e) for e in node.expressions) 784 return f"PARTITION BY ({parts})" 785 return f"PARTITION BY ({self.sql(node)})" 786 787 def table_sql(self, expression: exp.Table, sep: str = " AS ") -> str: 788 """Override table_sql to avoid AS keyword in UPDATE and DELETE statements.""" 789 ancestor = expression.find_ancestor(exp.Update, exp.Delete, exp.Select) 790 if not isinstance(ancestor, exp.Select): 791 sep = " " 792 return super().table_sql(expression, sep=sep) 793 794 def alterrename_sql(self, expression: exp.AlterRename, include_to: bool = True) -> str: 795 return super().alterrename_sql(expression, include_to=False)
UNESCAPED_SEQUENCES: Dict[str, str] =
{'\\a': '\x07', '\\b': '\x08', '\\f': '\x0c', '\\n': '\n', '\\r': '\r', '\\t': '\t', '\\v': '\x0b', '\\\\': '\\'}
Mapping of an escaped sequence (\n
) to its unescaped version (
).
tokenizer_class =
<class 'sqlglot.tokens.Tokenizer'>
parser_class =
<class 'Doris.Parser'>
generator_class =
<class 'Doris.Generator'>
TIME_TRIE: Dict =
{'%': {'M': {0: True}, 'c': {0: True}, 'e': {0: True}, 'h': {0: True}, 'i': {0: True}, 's': {0: True}, 'u': {0: True}, 'k': {0: True}, 'l': {0: True}, 'T': {0: True}, 'W': {0: True}}}
FORMAT_TRIE: Dict =
{'%': {'M': {0: True}, 'c': {0: True}, 'e': {0: True}, 'h': {0: True}, 'i': {0: True}, 's': {0: True}, 'u': {0: True}, 'k': {0: True}, 'l': {0: True}, 'T': {0: True}, 'W': {0: True}}}
INVERSE_TIME_MAPPING: Dict[str, str] =
{'%B': '%M', '%-m': '%c', '%-d': '%e', '%I': '%h', '%M': '%i', '%S': '%s', '%W': '%u', '%-H': '%k', '%-I': '%l', '%H:%M:%S': '%T', '%A': '%W'}
INVERSE_TIME_TRIE: Dict =
{'%': {'B': {0: True}, '-': {'m': {0: True}, 'd': {0: True}, 'H': {0: True}, 'I': {0: True}}, 'I': {0: True}, 'M': {0: True}, 'S': {0: True}, 'W': {0: True}, 'H': {':': {'%': {'M': {':': {'%': {'S': {0: True}}}}}}}, 'A': {0: True}}}
49 class Parser(MySQL.Parser): 50 FUNCTIONS = { 51 **MySQL.Parser.FUNCTIONS, 52 "COLLECT_SET": exp.ArrayUniqueAgg.from_arg_list, 53 "DATE_TRUNC": _build_date_trunc, 54 "MONTHS_ADD": exp.AddMonths.from_arg_list, 55 "REGEXP": exp.RegexpLike.from_arg_list, 56 "TO_DATE": exp.TsOrDsToDate.from_arg_list, 57 } 58 59 FUNCTION_PARSERS = MySQL.Parser.FUNCTION_PARSERS.copy() 60 FUNCTION_PARSERS.pop("GROUP_CONCAT") 61 62 NO_PAREN_FUNCTIONS = MySQL.Parser.NO_PAREN_FUNCTIONS.copy() 63 NO_PAREN_FUNCTIONS.pop(TokenType.CURRENT_DATE) 64 65 PROPERTY_PARSERS = { 66 **MySQL.Parser.PROPERTY_PARSERS, 67 "PROPERTIES": lambda self: self._parse_wrapped_properties(), 68 "UNIQUE": lambda self: self._parse_composite_key_property(exp.UniqueKeyProperty), 69 # Plain KEY without UNIQUE/DUPLICATE/AGGREGATE prefixes should be treated as UniqueKeyProperty with unique=False 70 "KEY": lambda self: self._parse_composite_key_property(exp.UniqueKeyProperty), 71 "PARTITION BY": lambda self: self._parse_partition_by_opt_range(), 72 "BUILD": lambda self: self._parse_build_property(), 73 "REFRESH": lambda self: self._parse_refresh_property(), 74 } 75 76 def _parse_partitioning_granularity_dynamic(self) -> exp.PartitionByRangePropertyDynamic: 77 self._match_text_seq("FROM") 78 start = self._parse_wrapped(self._parse_string) 79 self._match_text_seq("TO") 80 end = self._parse_wrapped(self._parse_string) 81 self._match_text_seq("INTERVAL") 82 number = self._parse_number() 83 unit = self._parse_var(any_token=True) 84 every = self.expression(exp.Interval, this=number, unit=unit) 85 return self.expression( 86 exp.PartitionByRangePropertyDynamic, start=start, end=end, every=every 87 ) 88 89 def _parse_partition_definition(self) -> exp.Partition: 90 self._match_text_seq("PARTITION") 91 92 name = self._parse_id_var() 93 self._match_text_seq("VALUES") 94 95 if self._match_text_seq("LESS", "THAN"): 96 values = self._parse_wrapped_csv(self._parse_expression) 97 if len(values) == 1 and values[0].name.upper() == "MAXVALUE": 98 values = [exp.var("MAXVALUE")] 99 100 part_range = self.expression(exp.PartitionRange, this=name, expressions=values) 101 return self.expression(exp.Partition, expressions=[part_range]) 102 103 self._match(TokenType.L_BRACKET) 104 values = self._parse_csv(lambda: self._parse_wrapped_csv(self._parse_expression)) 105 106 self._match(TokenType.R_BRACKET) 107 self._match(TokenType.R_PAREN) 108 109 part_range = self.expression(exp.PartitionRange, this=name, expressions=values) 110 return self.expression(exp.Partition, expressions=[part_range]) 111 112 def _parse_partition_definition_list(self) -> exp.Partition: 113 # PARTITION <name> VALUES IN (<value_csv>) 114 self._match_text_seq("PARTITION") 115 name = self._parse_id_var() 116 self._match_text_seq("VALUES", "IN") 117 values = self._parse_wrapped_csv(self._parse_expression) 118 part_list = self.expression(exp.PartitionList, this=name, expressions=values) 119 return self.expression(exp.Partition, expressions=[part_list]) 120 121 def _parse_partition_by_opt_range( 122 self, 123 ) -> exp.PartitionedByProperty | exp.PartitionByRangeProperty | exp.PartitionByListProperty: 124 if self._match_text_seq("LIST"): 125 return self.expression( 126 exp.PartitionByListProperty, 127 partition_expressions=self._parse_wrapped_id_vars(), 128 create_expressions=self._parse_wrapped_csv( 129 self._parse_partition_definition_list 130 ), 131 ) 132 133 if not self._match_text_seq("RANGE"): 134 return super()._parse_partitioned_by() 135 136 partition_expressions = self._parse_wrapped_id_vars() 137 self._match_l_paren() 138 139 if self._match_text_seq("FROM", advance=False): 140 create_expressions = self._parse_csv(self._parse_partitioning_granularity_dynamic) 141 elif self._match_text_seq("PARTITION", advance=False): 142 create_expressions = self._parse_csv(self._parse_partition_definition) 143 else: 144 create_expressions = None 145 146 self._match_r_paren() 147 148 return self.expression( 149 exp.PartitionByRangeProperty, 150 partition_expressions=partition_expressions, 151 create_expressions=create_expressions, 152 ) 153 154 def _parse_build_property(self) -> exp.BuildProperty: 155 return self.expression(exp.BuildProperty, this=self._parse_var(upper=True)) 156 157 def _parse_refresh_property(self) -> exp.RefreshTriggerProperty: 158 method = self._parse_var(upper=True) 159 160 self._match(TokenType.ON) 161 162 kind = self._match_texts(("MANUAL", "COMMIT", "SCHEDULE")) and self._prev.text.upper() 163 every = self._match_text_seq("EVERY") and self._parse_number() 164 unit = self._parse_var(any_token=True) if every else None 165 starts = self._match_text_seq("STARTS") and self._parse_string() 166 167 return self.expression( 168 exp.RefreshTriggerProperty, 169 method=method, 170 kind=kind, 171 every=every, 172 unit=unit, 173 starts=starts, 174 )
Parser consumes a list of tokens produced by the Tokenizer and produces a parsed syntax tree.
Arguments:
- error_level: The desired error level. Default: ErrorLevel.IMMEDIATE
- error_message_context: The amount of context to capture from a query string when displaying the error message (in number of characters). Default: 100
- max_errors: Maximum number of error messages to include in a raised ParseError. This is only relevant if error_level is ErrorLevel.RAISE. Default: 3
FUNCTIONS =
{'ABS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Abs'>>, 'ADD_MONTHS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.AddMonths'>>, 'AND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.And'>>, 'ANONYMOUS_AGG_FUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.AnonymousAggFunc'>>, 'ANY_VALUE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.AnyValue'>>, 'APPLY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Apply'>>, 'APPROX_DISTINCT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxDistinct'>>, 'APPROX_COUNT_DISTINCT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxDistinct'>>, 'APPROX_QUANTILE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxQuantile'>>, 'APPROX_QUANTILES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxQuantiles'>>, 'APPROX_TOP_K': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxTopK'>>, 'APPROX_TOP_SUM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxTopSum'>>, 'ARG_MAX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMax'>>, 'ARGMAX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMax'>>, 'MAX_BY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMax'>>, 'ARG_MIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMin'>>, 'ARGMIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMin'>>, 'MIN_BY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMin'>>, 'ARRAY': <function Parser.<lambda>>, 'ARRAY_AGG': <function Parser.<lambda>>, 'ARRAY_ALL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayAll'>>, 'ARRAY_ANY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayAny'>>, 'ARRAY_CONCAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayConcat'>>, 'ARRAY_CAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayConcat'>>, 'ARRAY_CONCAT_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayConcatAgg'>>, 'ARRAY_CONSTRUCT_COMPACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayConstructCompact'>>, 'ARRAY_CONTAINS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayContains'>>, 'ARRAY_HAS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayContains'>>, 'ARRAY_CONTAINS_ALL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayContainsAll'>>, 'ARRAY_HAS_ALL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayContainsAll'>>, 'FILTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayFilter'>>, 'ARRAY_FILTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayFilter'>>, 'ARRAY_FIRST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayFirst'>>, 'ARRAY_INTERSECT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayIntersect'>>, 'ARRAY_INTERSECTION': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayIntersect'>>, 'ARRAY_LAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayLast'>>, 'ARRAY_OVERLAPS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayOverlaps'>>, 'ARRAY_REMOVE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayRemove'>>, 'ARRAY_REVERSE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayReverse'>>, 'ARRAY_SIZE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySize'>>, 'ARRAY_LENGTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySize'>>, 'ARRAY_SLICE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySlice'>>, 'ARRAY_SORT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySort'>>, 'ARRAY_SUM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySum'>>, 'ARRAY_TO_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayToString'>>, 'ARRAY_JOIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayToString'>>, 'ARRAY_UNION_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayUnionAgg'>>, 'ARRAY_UNIQUE_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayUniqueAgg'>>, 'ASCII': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Ascii'>>, 'AVG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Avg'>>, 'BIT_AND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitwiseAndAgg'>>, 'BIT_COUNT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitwiseCountAgg'>>, 'BIT_OR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitwiseOrAgg'>>, 'BIT_XOR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitwiseXorAgg'>>, 'BYTE_LENGTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ByteLength'>>, 'CASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Case'>>, 'CAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Cast'>>, 'CAST_TO_STR_TYPE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CastToStrType'>>, 'CBRT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Cbrt'>>, 'CEIL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Ceil'>>, 'CEILING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Ceil'>>, 'CHR': <function Parser.<lambda>>, 'CHAR': <function Parser.<lambda>>, 'COALESCE': <function build_coalesce>, 'IFNULL': <function build_coalesce>, 'NVL': <function build_coalesce>, 'CODE_POINTS_TO_BYTES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CodePointsToBytes'>>, 'CODE_POINTS_TO_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CodePointsToString'>>, 'COLLATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Collate'>>, 'COLUMNS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Columns'>>, 'COMBINED_AGG_FUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CombinedAggFunc'>>, 'COMBINED_PARAMETERIZED_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CombinedParameterizedAgg'>>, 'CONCAT': <function Parser.<lambda>>, 'CONCAT_WS': <function Parser.<lambda>>, 'CONNECT_BY_ROOT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ConnectByRoot'>>, 'CONTAINS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Contains'>>, 'CONVERT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Convert'>>, 'CONVERT_TIMEZONE': <function build_convert_timezone>, 'CONVERT_TO_CHARSET': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ConvertToCharset'>>, 'CORR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Corr'>>, 'COUNT': <function Parser.<lambda>>, 'COUNT_IF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CountIf'>>, 'COUNTIF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CountIf'>>, 'COVAR_POP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CovarPop'>>, 'COVAR_SAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CovarSamp'>>, 'CUME_DIST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CumeDist'>>, 'CURRENT_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentDate'>>, 'CURRENT_DATETIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentDatetime'>>, 'CURRENT_SCHEMA': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentSchema'>>, 'CURRENT_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentTime'>>, 'CURRENT_TIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentTimestamp'>>, 'CURRENT_TIMESTAMP_L_T_Z': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentTimestampLTZ'>>, 'CURRENT_USER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentUser'>>, 'DATE': <function MySQL.Parser.<lambda>>, 'DATE_ADD': <function build_date_delta_with_interval.<locals>._builder>, 'DATE_BIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateBin'>>, 'DATEDIFF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateDiff'>>, 'DATE_DIFF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateDiff'>>, 'DATE_FROM_PARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateFromParts'>>, 'DATEFROMPARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateFromParts'>>, 'DATE_FROM_UNIX_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateFromUnixDate'>>, 'DATE_STR_TO_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateStrToDate'>>, 'DATE_SUB': <function build_date_delta_with_interval.<locals>._builder>, 'DATE_TO_DATE_STR': <function Parser.<lambda>>, 'DATE_TO_DI': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateToDi'>>, 'DATE_TRUNC': <function _build_date_trunc>, 'DATETIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Datetime'>>, 'DATETIME_ADD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DatetimeAdd'>>, 'DATETIME_DIFF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DatetimeDiff'>>, 'DATETIME_SUB': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DatetimeSub'>>, 'DATETIME_TRUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DatetimeTrunc'>>, 'DAY': <function MySQL.Parser.<lambda>>, 'DAY_OF_MONTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfMonth'>>, 'DAYOFMONTH': <function MySQL.Parser.<lambda>>, 'DAY_OF_WEEK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfWeek'>>, 'DAYOFWEEK': <function MySQL.Parser.<lambda>>, 'DAYOFWEEK_ISO': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfWeekIso'>>, 'ISODOW': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfWeekIso'>>, 'DAY_OF_YEAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfYear'>>, 'DAYOFYEAR': <function MySQL.Parser.<lambda>>, 'DECODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Decode'>>, 'DECODE_CASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DecodeCase'>>, 'DENSE_RANK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DenseRank'>>, 'DI_TO_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DiToDate'>>, 'ENCODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Encode'>>, 'ENDS_WITH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.EndsWith'>>, 'ENDSWITH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.EndsWith'>>, 'EXISTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Exists'>>, 'EXP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Exp'>>, 'EXPLODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Explode'>>, 'EXPLODE_OUTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ExplodeOuter'>>, 'EXPLODING_GENERATE_SERIES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ExplodingGenerateSeries'>>, 'EXTRACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Extract'>>, 'FARM_FINGERPRINT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FarmFingerprint'>>, 'FARMFINGERPRINT64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FarmFingerprint'>>, 'FEATURES_AT_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FeaturesAtTime'>>, 'FIRST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.First'>>, 'FIRST_VALUE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FirstValue'>>, 'FLATTEN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Flatten'>>, 'FLOAT64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Float64'>>, 'FLOOR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Floor'>>, 'FORMAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.NumberToStr'>>, 'FROM_BASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FromBase'>>, 'FROM_BASE32': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FromBase32'>>, 'FROM_BASE64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FromBase64'>>, 'FROM_ISO8601_TIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FromISO8601Timestamp'>>, 'GAP_FILL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GapFill'>>, 'GENERATE_DATE_ARRAY': <function Parser.<lambda>>, 'GENERATE_EMBEDDING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GenerateEmbedding'>>, 'GENERATE_SERIES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GenerateSeries'>>, 'GENERATE_TIMESTAMP_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GenerateTimestampArray'>>, 'GET_EXTRACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GetExtract'>>, 'GREATEST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Greatest'>>, 'GROUP_CONCAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GroupConcat'>>, 'GROUPING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Grouping'>>, 'HEX': <function build_hex>, 'HLL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Hll'>>, 'IF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.If'>>, 'IIF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.If'>>, 'INITCAP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Initcap'>>, 'INLINE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Inline'>>, 'INT64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Int64'>>, 'IS_ASCII': <bound method Func.from_arg_list of <class 'sqlglot.expressions.IsAscii'>>, 'IS_INF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.IsInf'>>, 'ISINF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.IsInf'>>, 'IS_NAN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.IsNan'>>, 'ISNAN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.IsNan'>>, 'J_S_O_N_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONArray'>>, 'J_S_O_N_ARRAY_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONArrayAgg'>>, 'JSON_ARRAY_APPEND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONArrayAppend'>>, 'JSON_ARRAY_CONTAINS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONArrayContains'>>, 'JSON_ARRAY_INSERT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONArrayInsert'>>, 'JSONB_CONTAINS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBContains'>>, 'JSONB_EXISTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBExists'>>, 'JSONB_EXTRACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBExtract'>>, 'JSONB_EXTRACT_SCALAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBExtractScalar'>>, 'J_S_O_N_B_OBJECT_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBObjectAgg'>>, 'J_S_O_N_BOOL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBool'>>, 'J_S_O_N_CAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONCast'>>, 'J_S_O_N_EXISTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONExists'>>, 'JSON_EXTRACT': <function build_extract_json_with_path.<locals>._builder>, 'JSON_EXTRACT_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONExtractArray'>>, 'JSON_EXTRACT_SCALAR': <function build_extract_json_with_path.<locals>._builder>, 'JSON_FORMAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONFormat'>>, 'J_S_O_N_KEYS_AT_DEPTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONKeysAtDepth'>>, 'J_S_O_N_OBJECT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONObject'>>, 'J_S_O_N_OBJECT_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONObjectAgg'>>, 'JSON_REMOVE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONRemove'>>, 'JSON_SET': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONSet'>>, 'JSON_STRIP_NULLS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONStripNulls'>>, 'J_S_O_N_TABLE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONTable'>>, 'JSON_TYPE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONType'>>, 'J_S_O_N_VALUE_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONValueArray'>>, 'JUSTIFY_DAYS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JustifyDays'>>, 'JUSTIFY_HOURS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JustifyHours'>>, 'JUSTIFY_INTERVAL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JustifyInterval'>>, 'LAG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Lag'>>, 'LAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Last'>>, 'LAST_DAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LastDay'>>, 'LAST_DAY_OF_MONTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LastDay'>>, 'LAST_VALUE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LastValue'>>, 'LAX_BOOL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LaxBool'>>, 'LAX_FLOAT64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LaxFloat64'>>, 'LAX_INT64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LaxInt64'>>, 'LAX_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LaxString'>>, 'LEAD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Lead'>>, 'LEAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Least'>>, 'LEFT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Left'>>, 'LENGTH': <function MySQL.Parser.<lambda>>, 'LEN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Length'>>, 'CHAR_LENGTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Length'>>, 'CHARACTER_LENGTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Length'>>, 'LEVENSHTEIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Levenshtein'>>, 'LIST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.List'>>, 'LN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Ln'>>, 'LOG': <function build_logarithm>, 'LOGICAL_AND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalAnd'>>, 'BOOL_AND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalAnd'>>, 'BOOLAND_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalAnd'>>, 'LOGICAL_OR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalOr'>>, 'BOOL_OR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalOr'>>, 'BOOLOR_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalOr'>>, 'LOWER': <function build_lower>, 'LCASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Lower'>>, 'LOWER_HEX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LowerHex'>>, 'MD5': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MD5'>>, 'MD5_DIGEST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MD5Digest'>>, 'MAKE_INTERVAL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MakeInterval'>>, 'MAP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Map'>>, 'MAP_FROM_ENTRIES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MapFromEntries'>>, 'MATCH_AGAINST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MatchAgainst'>>, 'MAX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Max'>>, 'MEDIAN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Median'>>, 'MIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Min'>>, 'MONTH': <function MySQL.Parser.<lambda>>, 'MONTHS_BETWEEN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MonthsBetween'>>, 'NEXT_VALUE_FOR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.NextValueFor'>>, 'NORMALIZE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Normalize'>>, 'NTH_VALUE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.NthValue'>>, 'NTILE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Ntile'>>, 'NULLIF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Nullif'>>, 'NUMBER_TO_STR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.NumberToStr'>>, 'NVL2': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Nvl2'>>, 'OBJECT_INSERT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ObjectInsert'>>, 'OPEN_J_S_O_N': <bound method Func.from_arg_list of <class 'sqlglot.expressions.OpenJSON'>>, 'OR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Or'>>, 'OVERLAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Overlay'>>, 'PAD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Pad'>>, 'PARAMETERIZED_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParameterizedAgg'>>, 'PARSE_BIGNUMERIC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseBignumeric'>>, 'PARSE_DATETIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseDatetime'>>, 'PARSE_JSON': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseJSON'>>, 'JSON_PARSE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseJSON'>>, 'PARSE_NUMERIC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseNumeric'>>, 'PARSE_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseTime'>>, 'PERCENT_RANK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.PercentRank'>>, 'PERCENTILE_CONT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.PercentileCont'>>, 'PERCENTILE_DISC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.PercentileDisc'>>, 'POSEXPLODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Posexplode'>>, 'POSEXPLODE_OUTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.PosexplodeOuter'>>, 'POWER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Pow'>>, 'POW': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Pow'>>, 'PREDICT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Predict'>>, 'QUANTILE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Quantile'>>, 'QUARTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Quarter'>>, 'RAND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Rand'>>, 'RANDOM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Rand'>>, 'RANDN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Randn'>>, 'RANGE_N': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RangeN'>>, 'RANK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Rank'>>, 'READ_CSV': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ReadCSV'>>, 'REDUCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Reduce'>>, 'REGEXP_EXTRACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpExtract'>>, 'REGEXP_EXTRACT_ALL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpExtractAll'>>, 'REGEXP_I_LIKE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpILike'>>, 'REGEXP_INSTR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpInstr'>>, 'REGEXP_LIKE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpLike'>>, 'REGEXP_REPLACE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpReplace'>>, 'REGEXP_SPLIT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpSplit'>>, 'REPEAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Repeat'>>, 'REPLACE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Replace'>>, 'REVERSE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Reverse'>>, 'RIGHT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Right'>>, 'ROUND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Round'>>, 'ROW_NUMBER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RowNumber'>>, 'SHA': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SHA'>>, 'SHA1': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SHA'>>, 'SHA2': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SHA2'>>, 'SAFE_CONVERT_BYTES_TO_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SafeConvertBytesToString'>>, 'SAFE_DIVIDE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SafeDivide'>>, 'SIGN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sign'>>, 'SIGNUM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sign'>>, 'SORT_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SortArray'>>, 'SOUNDEX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Soundex'>>, 'SPACE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Space'>>, 'SPLIT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Split'>>, 'SPLIT_PART': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SplitPart'>>, 'SQRT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sqrt'>>, 'ST_DISTANCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StDistance'>>, 'ST_POINT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StPoint'>>, 'ST_MAKEPOINT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StPoint'>>, 'STANDARD_HASH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StandardHash'>>, 'STAR_MAP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StarMap'>>, 'STARTS_WITH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StartsWith'>>, 'STARTSWITH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StartsWith'>>, 'STDDEV': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Stddev'>>, 'STDEV': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Stddev'>>, 'STDDEV_POP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StddevPop'>>, 'STDDEV_SAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StddevSamp'>>, 'STR_POSITION': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrPosition'>>, 'STR_TO_DATE': <function _str_to_date>, 'STR_TO_MAP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrToMap'>>, 'STR_TO_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrToTime'>>, 'STR_TO_UNIX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrToUnix'>>, 'STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.String'>>, 'STRING_TO_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StringToArray'>>, 'SPLIT_BY_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StringToArray'>>, 'STRTOK_TO_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StringToArray'>>, 'STRUCT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Struct'>>, 'STRUCT_EXTRACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StructExtract'>>, 'STUFF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Stuff'>>, 'INSERT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Stuff'>>, 'SUBSTRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Substring'>>, 'SUBSTR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Substring'>>, 'SUBSTRING_INDEX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SubstringIndex'>>, 'SUM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sum'>>, 'TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Time'>>, 'TIME_ADD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeAdd'>>, 'TIME_DIFF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeDiff'>>, 'TIME_FROM_PARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeFromParts'>>, 'TIMEFROMPARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeFromParts'>>, 'TIME_STR_TO_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeStrToDate'>>, 'TIME_STR_TO_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeStrToTime'>>, 'TIME_STR_TO_UNIX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeStrToUnix'>>, 'TIME_SUB': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeSub'>>, 'TIME_TO_STR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeToStr'>>, 'TIME_TO_TIME_STR': <function Parser.<lambda>>, 'TIME_TO_UNIX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeToUnix'>>, 'TIME_TRUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeTrunc'>>, 'TIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Timestamp'>>, 'TIMESTAMP_ADD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampAdd'>>, 'TIMESTAMPDIFF': <function build_date_delta.<locals>._builder>, 'TIMESTAMP_DIFF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampDiff'>>, 'TIMESTAMP_FROM_PARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampFromParts'>>, 'TIMESTAMPFROMPARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampFromParts'>>, 'TIMESTAMP_SUB': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampSub'>>, 'TIMESTAMP_TRUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampTrunc'>>, 'TO_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToArray'>>, 'TO_BASE32': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToBase32'>>, 'TO_BASE64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToBase64'>>, 'TO_CHAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToChar'>>, 'TO_CODE_POINTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToCodePoints'>>, 'TO_DAYS': <function MySQL.Parser.<lambda>>, 'TO_DOUBLE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToDouble'>>, 'TO_MAP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToMap'>>, 'TO_NUMBER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToNumber'>>, 'TRANSFORM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Transform'>>, 'TRANSLATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Translate'>>, 'TRIM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Trim'>>, 'TRY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Try'>>, 'TRY_CAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TryCast'>>, 'TS_OR_DI_TO_DI': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDiToDi'>>, 'TS_OR_DS_ADD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsAdd'>>, 'TS_OR_DS_DIFF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsDiff'>>, 'TS_OR_DS_TO_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsToDate'>>, 'TS_OR_DS_TO_DATE_STR': <function Parser.<lambda>>, 'TS_OR_DS_TO_DATETIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsToDatetime'>>, 'TS_OR_DS_TO_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsToTime'>>, 'TS_OR_DS_TO_TIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsToTimestamp'>>, 'TYPEOF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Typeof'>>, 'UNHEX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Unhex'>>, 'UNICODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Unicode'>>, 'UNIX_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixDate'>>, 'UNIX_MICROS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixMicros'>>, 'UNIX_MILLIS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixMillis'>>, 'UNIX_SECONDS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixSeconds'>>, 'UNIX_TO_STR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixToStr'>>, 'UNIX_TO_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixToTime'>>, 'UNIX_TO_TIME_STR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixToTimeStr'>>, 'UNNEST': <function Parser.<lambda>>, 'UPPER': <function build_upper>, 'UCASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Upper'>>, 'UUID': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Uuid'>>, 'GEN_RANDOM_UUID': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Uuid'>>, 'GENERATE_UUID': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Uuid'>>, 'UUID_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Uuid'>>, 'VAR_MAP': <function build_var_map>, 'VARIANCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Variance'>>, 'VARIANCE_SAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Variance'>>, 'VAR_SAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Variance'>>, 'VARIANCE_POP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.VariancePop'>>, 'VAR_POP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.VariancePop'>>, 'VECTOR_SEARCH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.VectorSearch'>>, 'WEEK': <function MySQL.Parser.<lambda>>, 'WEEK_OF_YEAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.WeekOfYear'>>, 'WEEKOFYEAR': <function MySQL.Parser.<lambda>>, 'XMLELEMENT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.XMLElement'>>, 'X_M_L_TABLE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.XMLTable'>>, 'XOR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Xor'>>, 'YEAR': <function MySQL.Parser.<lambda>>, 'ARRAYAGG': <function Parser.<lambda>>, 'GLOB': <function Parser.<lambda>>, 'JSON_EXTRACT_PATH_TEXT': <function build_extract_json_with_path.<locals>._builder>, 'LIKE': <function build_like>, 'LOG2': <function Parser.<lambda>>, 'LOG10': <function Parser.<lambda>>, 'LPAD': <function Parser.<lambda>>, 'LEFTPAD': <function Parser.<lambda>>, 'LTRIM': <function Parser.<lambda>>, 'MOD': <function build_mod>, 'RIGHTPAD': <function Parser.<lambda>>, 'RPAD': <function Parser.<lambda>>, 'RTRIM': <function Parser.<lambda>>, 'SCOPE_RESOLUTION': <function Parser.<lambda>>, 'STRPOS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrPosition'>>, 'CHARINDEX': <function Parser.<lambda>>, 'INSTR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrPosition'>>, 'LOCATE': <function Parser.<lambda>>, 'TO_HEX': <function build_hex>, 'CONVERT_TZ': <function MySQL.Parser.<lambda>>, 'CURDATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentDate'>>, 'DATE_FORMAT': <function build_formatted_time.<locals>._builder>, 'FROM_UNIXTIME': <function build_formatted_time.<locals>._builder>, 'ISNULL': <function isnull_to_is_null>, 'MAKETIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeFromParts'>>, 'MONTHNAME': <function MySQL.Parser.<lambda>>, 'SCHEMA': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentSchema'>>, 'DATABASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentSchema'>>, 'COLLECT_SET': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayUniqueAgg'>>, 'MONTHS_ADD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.AddMonths'>>, 'REGEXP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpLike'>>, 'TO_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsToDate'>>}
FUNCTION_PARSERS =
{'ARG_MAX': <function Parser.<dictcomp>.<lambda>>, 'ARGMAX': <function Parser.<dictcomp>.<lambda>>, 'MAX_BY': <function Parser.<dictcomp>.<lambda>>, 'ARG_MIN': <function Parser.<dictcomp>.<lambda>>, 'ARGMIN': <function Parser.<dictcomp>.<lambda>>, 'MIN_BY': <function Parser.<dictcomp>.<lambda>>, 'CAST': <function Parser.<lambda>>, 'CEIL': <function Parser.<lambda>>, 'CONVERT': <function Parser.<lambda>>, 'DECODE': <function Parser.<lambda>>, 'EXTRACT': <function Parser.<lambda>>, 'FLOOR': <function Parser.<lambda>>, 'GAP_FILL': <function Parser.<lambda>>, 'JSON_OBJECT': <function Parser.<lambda>>, 'JSON_OBJECTAGG': <function Parser.<lambda>>, 'JSON_TABLE': <function Parser.<lambda>>, 'MATCH': <function Parser.<lambda>>, 'NORMALIZE': <function Parser.<lambda>>, 'OPENJSON': <function Parser.<lambda>>, 'OVERLAY': <function Parser.<lambda>>, 'POSITION': <function Parser.<lambda>>, 'SAFE_CAST': <function Parser.<lambda>>, 'STRING_AGG': <function Parser.<lambda>>, 'SUBSTRING': <function Parser.<lambda>>, 'TRIM': <function Parser.<lambda>>, 'TRY_CAST': <function Parser.<lambda>>, 'TRY_CONVERT': <function Parser.<lambda>>, 'XMLELEMENT': <function Parser.<lambda>>, 'XMLTABLE': <function Parser.<lambda>>, 'CHAR': <function MySQL.Parser.<lambda>>, 'VALUES': <function MySQL.Parser.<lambda>>, 'JSON_VALUE': <function MySQL.Parser.<lambda>>}
NO_PAREN_FUNCTIONS =
{<TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>: <class 'sqlglot.expressions.CurrentDate'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>: <class 'sqlglot.expressions.CurrentTime'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>: <class 'sqlglot.expressions.CurrentTimestamp'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>: <class 'sqlglot.expressions.CurrentUser'>}
PROPERTY_PARSERS =
{'ALLOWED_VALUES': <function Parser.<lambda>>, 'ALGORITHM': <function Parser.<lambda>>, 'AUTO': <function Parser.<lambda>>, 'AUTO_INCREMENT': <function Parser.<lambda>>, 'BACKUP': <function Parser.<lambda>>, 'BLOCKCOMPRESSION': <function Parser.<lambda>>, 'CHARSET': <function Parser.<lambda>>, 'CHARACTER SET': <function Parser.<lambda>>, 'CHECKSUM': <function Parser.<lambda>>, 'CLUSTER BY': <function Parser.<lambda>>, 'CLUSTERED': <function Parser.<lambda>>, 'COLLATE': <function Parser.<lambda>>, 'COMMENT': <function Parser.<lambda>>, 'CONTAINS': <function Parser.<lambda>>, 'COPY': <function Parser.<lambda>>, 'DATABLOCKSIZE': <function Parser.<lambda>>, 'DATA_DELETION': <function Parser.<lambda>>, 'DEFINER': <function Parser.<lambda>>, 'DETERMINISTIC': <function Parser.<lambda>>, 'DISTRIBUTED': <function Parser.<lambda>>, 'DUPLICATE': <function Parser.<lambda>>, 'DYNAMIC': <function Parser.<lambda>>, 'DISTKEY': <function Parser.<lambda>>, 'DISTSTYLE': <function Parser.<lambda>>, 'EMPTY': <function Parser.<lambda>>, 'ENGINE': <function Parser.<lambda>>, 'ENVIRONMENT': <function Parser.<lambda>>, 'EXECUTE': <function Parser.<lambda>>, 'EXTERNAL': <function Parser.<lambda>>, 'FALLBACK': <function Parser.<lambda>>, 'FORMAT': <function Parser.<lambda>>, 'FREESPACE': <function Parser.<lambda>>, 'GLOBAL': <function Parser.<lambda>>, 'HEAP': <function Parser.<lambda>>, 'ICEBERG': <function Parser.<lambda>>, 'IMMUTABLE': <function Parser.<lambda>>, 'INHERITS': <function Parser.<lambda>>, 'INPUT': <function Parser.<lambda>>, 'JOURNAL': <function Parser.<lambda>>, 'LANGUAGE': <function Parser.<lambda>>, 'LAYOUT': <function Parser.<lambda>>, 'LIFETIME': <function Parser.<lambda>>, 'LIKE': <function Parser.<lambda>>, 'LOCATION': <function Parser.<lambda>>, 'LOCK': <function MySQL.Parser.<lambda>>, 'LOCKING': <function Parser.<lambda>>, 'LOG': <function Parser.<lambda>>, 'MATERIALIZED': <function Parser.<lambda>>, 'MERGEBLOCKRATIO': <function Parser.<lambda>>, 'MODIFIES': <function Parser.<lambda>>, 'MULTISET': <function Parser.<lambda>>, 'NO': <function Parser.<lambda>>, 'ON': <function Parser.<lambda>>, 'ORDER BY': <function Parser.<lambda>>, 'OUTPUT': <function Parser.<lambda>>, 'PARTITION': <function Parser.<lambda>>, 'PARTITION BY': <function Doris.Parser.<lambda>>, 'PARTITIONED BY': <function Parser.<lambda>>, 'PARTITIONED_BY': <function Parser.<lambda>>, 'PRIMARY KEY': <function Parser.<lambda>>, 'RANGE': <function Parser.<lambda>>, 'READS': <function Parser.<lambda>>, 'REMOTE': <function Parser.<lambda>>, 'RETURNS': <function Parser.<lambda>>, 'STRICT': <function Parser.<lambda>>, 'STREAMING': <function Parser.<lambda>>, 'ROW': <function Parser.<lambda>>, 'ROW_FORMAT': <function Parser.<lambda>>, 'SAMPLE': <function Parser.<lambda>>, 'SECURE': <function Parser.<lambda>>, 'SECURITY': <function Parser.<lambda>>, 'SET': <function Parser.<lambda>>, 'SETTINGS': <function Parser.<lambda>>, 'SHARING': <function Parser.<lambda>>, 'SORTKEY': <function Parser.<lambda>>, 'SOURCE': <function Parser.<lambda>>, 'STABLE': <function Parser.<lambda>>, 'STORED': <function Parser.<lambda>>, 'SYSTEM_VERSIONING': <function Parser.<lambda>>, 'TBLPROPERTIES': <function Parser.<lambda>>, 'TEMP': <function Parser.<lambda>>, 'TEMPORARY': <function Parser.<lambda>>, 'TO': <function Parser.<lambda>>, 'TRANSIENT': <function Parser.<lambda>>, 'TRANSFORM': <function Parser.<lambda>>, 'TTL': <function Parser.<lambda>>, 'USING': <function Parser.<lambda>>, 'UNLOGGED': <function Parser.<lambda>>, 'VOLATILE': <function Parser.<lambda>>, 'WITH': <function Parser.<lambda>>, 'PROPERTIES': <function Doris.Parser.<lambda>>, 'UNIQUE': <function Doris.Parser.<lambda>>, 'KEY': <function Doris.Parser.<lambda>>, 'BUILD': <function Doris.Parser.<lambda>>, 'REFRESH': <function Doris.Parser.<lambda>>}
TABLE_ALIAS_TOKENS =
{<TokenType.LIMIT: 'LIMIT'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.GEOGRAPHYPOINT: 'GEOGRAPHYPOINT'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.STORAGE_INTEGRATION: 'STORAGE_INTEGRATION'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.ATTACH: 'ATTACH'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.GET: 'GET'>, <TokenType.YEAR: 'YEAR'>, <TokenType.SOURCE: 'SOURCE'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.ANTI: 'ANTI'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.CURRENT_SCHEMA: 'CURRENT_SCHEMA'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.BIT: 'BIT'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.CASE: 'CASE'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.IS: 'IS'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.JSONB: 'JSONB'>, <TokenType.VOID: 'VOID'>, <TokenType.ENUM: 'ENUM'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.CUBE: 'CUBE'>, <TokenType.STAGE: 'STAGE'>, <TokenType.MULTILINESTRING: 'MULTILINESTRING'>, <TokenType.MERGE: 'MERGE'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.KILL: 'KILL'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.EXPORT: 'EXPORT'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.NOTHING: 'NOTHING'>, <TokenType.RANGE: 'RANGE'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.SMALLDATETIME: 'SMALLDATETIME'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.PROCEDURE: 'PROCEDURE'>, <TokenType.ANY: 'ANY'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.DECIMAL256: 'DECIMAL256'>, <TokenType.APPLY: 'APPLY'>, <TokenType.SHOW: 'SHOW'>, <TokenType.UNIQUE: 'UNIQUE'>, <TokenType.UINT: 'UINT'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.VIEW: 'VIEW'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.FINAL: 'FINAL'>, <TokenType.BINARY: 'BINARY'>, <TokenType.RENAME: 'RENAME'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.SEMI: 'SEMI'>, <TokenType.TOP: 'TOP'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.FIRST: 'FIRST'>, <TokenType.JSON: 'JSON'>, <TokenType.SOME: 'SOME'>, <TokenType.TABLE: 'TABLE'>, <TokenType.SUPER: 'SUPER'>, <TokenType.NULL: 'NULL'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.INDEX: 'INDEX'>, <TokenType.SINK: 'SINK'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.DATE: 'DATE'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.POINT: 'POINT'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.LOAD: 'LOAD'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.FILE_FORMAT: 'FILE_FORMAT'>, <TokenType.LINESTRING: 'LINESTRING'>, <TokenType.NAMESPACE: 'NAMESPACE'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.DATE32: 'DATE32'>, <TokenType.NEXT: 'NEXT'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.MAP: 'MAP'>, <TokenType.INET: 'INET'>, <TokenType.REFERENCES: 'REFERENCES'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.LIST: 'LIST'>, <TokenType.INT128: 'INT128'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.ALL: 'ALL'>, <TokenType.COPY: 'COPY'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.DYNAMIC: 'DYNAMIC'>, <TokenType.FALSE: 'FALSE'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.RING: 'RING'>, <TokenType.INT256: 'INT256'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.ASC: 'ASC'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.DECIMAL64: 'DECIMAL64'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.ORDINALITY: 'ORDINALITY'>, <TokenType.DESC: 'DESC'>, <TokenType.ROW: 'ROW'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.UINT256: 'UINT256'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.ROWS: 'ROWS'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.IPV4: 'IPV4'>, <TokenType.DIV: 'DIV'>, <TokenType.KEEP: 'KEEP'>, <TokenType.DELETE: 'DELETE'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.XML: 'XML'>, <TokenType.SETTINGS: 'SETTINGS'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.TEXT: 'TEXT'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.SET: 'SET'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.CHAR: 'CHAR'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.ROLLUP: 'ROLLUP'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.DETACH: 'DETACH'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.UINT128: 'UINT128'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.TRUE: 'TRUE'>, <TokenType.DATETIME2: 'DATETIME2'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.NESTED: 'NESTED'>, <TokenType.VAR: 'VAR'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.FILTER: 'FILTER'>, <TokenType.MONEY: 'MONEY'>, <TokenType.TIME: 'TIME'>, <TokenType.DECIMAL128: 'DECIMAL128'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.WAREHOUSE: 'WAREHOUSE'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.BLOB: 'BLOB'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.UUID: 'UUID'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.FORMAT: 'FORMAT'>, <TokenType.END: 'END'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.PUT: 'PUT'>, <TokenType.MODEL: 'MODEL'>, <TokenType.IPV6: 'IPV6'>, <TokenType.SEMANTIC_VIEW: 'SEMANTIC_VIEW'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.POLYGON: 'POLYGON'>, <TokenType.INT: 'INT'>, <TokenType.CACHE: 'CACHE'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.DECIMAL32: 'DECIMAL32'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.TAG: 'TAG'>, <TokenType.MULTIPOLYGON: 'MULTIPOLYGON'>, <TokenType.UDOUBLE: 'UDOUBLE'>, <TokenType.NAME: 'NAME'>, <TokenType.STREAMLIT: 'STREAMLIT'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.DATETIME: 'DATETIME'>}
SHOW_TRIE: Dict =
{'BINARY': {'LOGS': {0: True}}, 'MASTER': {'LOGS': {0: True}, 'STATUS': {0: True}}, 'BINLOG': {'EVENTS': {0: True}}, 'CHARACTER': {'SET': {0: True}}, 'CHARSET': {0: True}, 'COLLATION': {0: True}, 'FULL': {'COLUMNS': {0: True}, 'PROCESSLIST': {0: True}, 'TABLES': {0: True}}, 'COLUMNS': {0: True}, 'CREATE': {'DATABASE': {0: True}, 'EVENT': {0: True}, 'FUNCTION': {0: True}, 'PROCEDURE': {0: True}, 'TABLE': {0: True}, 'TRIGGER': {0: True}, 'VIEW': {0: True}}, 'DATABASES': {0: True}, 'SCHEMAS': {0: True}, 'ENGINE': {0: True}, 'STORAGE': {'ENGINES': {0: True}}, 'ENGINES': {0: True}, 'ERRORS': {0: True}, 'EVENTS': {0: True}, 'FUNCTION': {'CODE': {0: True}, 'STATUS': {0: True}}, 'GRANTS': {0: True}, 'INDEX': {0: True}, 'OPEN': {'TABLES': {0: True}}, 'PLUGINS': {0: True}, 'PROCEDURE': {'CODE': {0: True}, 'STATUS': {0: True}}, 'PRIVILEGES': {0: True}, 'PROCESSLIST': {0: True}, 'PROFILE': {0: True}, 'PROFILES': {0: True}, 'RELAYLOG': {'EVENTS': {0: True}}, 'REPLICAS': {0: True}, 'SLAVE': {'HOSTS': {0: True}, 'STATUS': {0: True}}, 'REPLICA': {'STATUS': {0: True}}, 'GLOBAL': {'STATUS': {0: True}, 'VARIABLES': {0: True}}, 'SESSION': {'STATUS': {0: True}, 'VARIABLES': {0: True}}, 'STATUS': {0: True}, 'TABLE': {'STATUS': {0: True}}, 'TABLES': {0: True}, 'TRIGGERS': {0: True}, 'VARIABLES': {0: True}, 'WARNINGS': {0: True}}
SET_TRIE: Dict =
{'GLOBAL': {0: True}, 'LOCAL': {0: True}, 'SESSION': {0: True}, 'TRANSACTION': {0: True}, 'PERSIST': {0: True}, 'PERSIST_ONLY': {0: True}, 'CHARACTER': {'SET': {0: True}}, 'CHARSET': {0: True}, 'NAMES': {0: True}}
Inherited Members
- sqlglot.parser.Parser
- Parser
- STRUCT_TYPE_TOKENS
- NESTED_TYPE_TOKENS
- AGGREGATE_TYPE_TOKENS
- SIGNED_TO_UNSIGNED_TYPE_TOKEN
- SUBQUERY_PREDICATES
- RESERVED_TOKENS
- DB_CREATABLES
- CREATABLES
- ALTERABLES
- ID_VAR_TOKENS
- ALIAS_TOKENS
- COLON_PLACEHOLDER_TOKENS
- ARRAY_CONSTRUCTORS
- COMMENT_TABLE_ALIAS_TOKENS
- UPDATE_ALIAS_TOKENS
- TRIM_TYPES
- ASSIGNMENT
- EQUALITY
- COMPARISON
- BITWISE
- TERM
- FACTOR
- EXPONENT
- TIMES
- TIMESTAMPS
- SET_OPERATIONS
- JOIN_METHODS
- JOIN_SIDES
- JOIN_KINDS
- JOIN_HINTS
- LAMBDAS
- COLUMN_OPERATORS
- CAST_COLUMN_OPERATORS
- EXPRESSION_PARSERS
- UNARY_PARSERS
- STRING_PARSERS
- NUMERIC_PARSERS
- PRIMARY_PARSERS
- PLACEHOLDER_PARSERS
- PIPE_SYNTAX_TRANSFORM_PARSERS
- NO_PAREN_FUNCTION_PARSERS
- INVALID_FUNC_NAME_TOKENS
- FUNCTIONS_WITH_ALIASED_ARGS
- KEY_VALUE_DEFINITIONS
- QUERY_MODIFIER_PARSERS
- QUERY_MODIFIER_TOKENS
- TYPE_LITERAL_PARSERS
- TYPE_CONVERTERS
- DDL_SELECT_TOKENS
- PRE_VOLATILE_TOKENS
- TRANSACTION_KIND
- TRANSACTION_CHARACTERISTICS
- CONFLICT_ACTIONS
- CREATE_SEQUENCE
- ISOLATED_LOADING_OPTIONS
- USABLES
- CAST_ACTIONS
- SCHEMA_BINDING_OPTIONS
- PROCEDURE_OPTIONS
- EXECUTE_AS_OPTIONS
- KEY_CONSTRAINT_OPTIONS
- WINDOW_EXCLUDE_OPTIONS
- INSERT_ALTERNATIVES
- CLONE_KEYWORDS
- HISTORICAL_DATA_PREFIX
- HISTORICAL_DATA_KIND
- OPCLASS_FOLLOW_KEYWORDS
- OPTYPE_FOLLOW_TOKENS
- TABLE_INDEX_HINT_TOKENS
- VIEW_ATTRIBUTES
- WINDOW_ALIAS_TOKENS
- WINDOW_BEFORE_PAREN_TOKENS
- WINDOW_SIDES
- JSON_KEY_VALUE_SEPARATOR_TOKENS
- FETCH_TOKENS
- ADD_CONSTRAINT_TOKENS
- DISTINCT_TOKENS
- NULL_TOKENS
- UNNEST_OFFSET_ALIAS_TOKENS
- SELECT_START_TOKENS
- COPY_INTO_VARLEN_OPTIONS
- IS_JSON_PREDICATE_KIND
- ODBC_DATETIME_LITERALS
- ON_CONDITION_TOKENS
- PRIVILEGE_FOLLOW_TOKENS
- DESCRIBE_STYLES
- ANALYZE_STYLES
- ANALYZE_EXPRESSION_PARSERS
- PARTITION_KEYWORDS
- AMBIGUOUS_ALIAS_TOKENS
- RECURSIVE_CTE_SEARCH_KIND
- MODIFIABLES
- STRICT_CAST
- PREFIXED_PIVOT_COLUMNS
- IDENTIFY_PIVOT_STRINGS
- TABLESAMPLE_CSV
- DEFAULT_SAMPLING_METHOD
- SET_REQUIRES_ASSIGNMENT_DELIMITER
- TRIM_PATTERN_FIRST
- MODIFIERS_ATTACHED_TO_SET_OP
- SET_OP_MODIFIERS
- NO_PAREN_IF_COMMANDS
- JSON_ARROWS_REQUIRE_JSON_TYPE
- COLON_IS_VARIANT_EXTRACT
- SUPPORTS_IMPLICIT_UNNEST
- INTERVAL_SPANS
- WRAPPED_TRANSFORM_COLUMN_CONSTRAINT
- OPTIONAL_ALIAS_TOKEN_CTE
- ALTER_RENAME_REQUIRES_COLUMN
- JOINS_HAVE_EQUAL_PRECEDENCE
- ZONE_AWARE_TIMESTAMP_CONSTRUCTOR
- MAP_KEYS_ARE_ARBITRARY_EXPRESSIONS
- JSON_EXTRACT_REQUIRES_JSON_EXPRESSION
- error_level
- error_message_context
- max_errors
- dialect
- reset
- parse
- parse_into
- check_errors
- raise_error
- expression
- validate_expression
- parse_set_operation
- build_cast
- errors
- sql
- sqlglot.dialects.mysql.MySQL.Parser
- FUNC_TOKENS
- CONJUNCTION
- DISJUNCTION
- RANGE_PARSERS
- STATEMENT_PARSERS
- SHOW_PARSERS
- SET_PARSERS
- CONSTRAINT_PARSERS
- ALTER_PARSERS
- ALTER_ALTER_PARSERS
- SCHEMA_UNNAMED_CONSTRAINTS
- PROFILE_TYPES
- TYPE_TOKENS
- ENUM_TYPE_TOKENS
- OPERATION_MODIFIERS
- LOG_DEFAULTS_TO_LN
- STRING_ALIASES
- VALUES_FOLLOWED_BY_PAREN
- SUPPORTS_PARTITION_SELECTION
176 class Generator(MySQL.Generator): 177 LAST_DAY_SUPPORTS_DATE_PART = False 178 VARCHAR_REQUIRES_SIZE = False 179 WITH_PROPERTIES_PREFIX = "PROPERTIES" 180 RENAME_TABLE_WITH_DB = False 181 182 TYPE_MAPPING = { 183 **MySQL.Generator.TYPE_MAPPING, 184 exp.DataType.Type.TEXT: "STRING", 185 exp.DataType.Type.TIMESTAMP: "DATETIME", 186 exp.DataType.Type.TIMESTAMPTZ: "DATETIME", 187 } 188 189 PROPERTIES_LOCATION = { 190 **MySQL.Generator.PROPERTIES_LOCATION, 191 exp.UniqueKeyProperty: exp.Properties.Location.POST_SCHEMA, 192 exp.PartitionByRangeProperty: exp.Properties.Location.POST_SCHEMA, 193 exp.PartitionByListProperty: exp.Properties.Location.POST_SCHEMA, 194 exp.PartitionedByProperty: exp.Properties.Location.POST_SCHEMA, 195 exp.BuildProperty: exp.Properties.Location.POST_SCHEMA, 196 exp.RefreshTriggerProperty: exp.Properties.Location.POST_SCHEMA, 197 } 198 199 CAST_MAPPING = {} 200 TIMESTAMP_FUNC_TYPES = set() 201 202 TRANSFORMS = { 203 **MySQL.Generator.TRANSFORMS, 204 exp.AddMonths: rename_func("MONTHS_ADD"), 205 exp.ApproxDistinct: approx_count_distinct_sql, 206 exp.ArgMax: rename_func("MAX_BY"), 207 exp.ArgMin: rename_func("MIN_BY"), 208 exp.ArrayAgg: rename_func("COLLECT_LIST"), 209 exp.ArrayToString: rename_func("ARRAY_JOIN"), 210 exp.ArrayUniqueAgg: rename_func("COLLECT_SET"), 211 exp.CurrentDate: lambda self, _: self.func("CURRENT_DATE"), 212 exp.CurrentTimestamp: lambda self, _: self.func("NOW"), 213 exp.DateTrunc: lambda self, e: self.func("DATE_TRUNC", e.this, unit_to_str(e)), 214 exp.GroupConcat: lambda self, e: self.func( 215 "GROUP_CONCAT", e.this, e.args.get("separator") or exp.Literal.string(",") 216 ), 217 exp.JSONExtractScalar: lambda self, e: self.func("JSON_EXTRACT", e.this, e.expression), 218 exp.Lag: _lag_lead_sql, 219 exp.Lead: _lag_lead_sql, 220 exp.Map: rename_func("ARRAY_MAP"), 221 exp.Property: property_sql, 222 exp.RegexpLike: rename_func("REGEXP"), 223 exp.RegexpSplit: rename_func("SPLIT_BY_STRING"), 224 exp.SchemaCommentProperty: lambda self, e: self.naked_property(e), 225 exp.Split: rename_func("SPLIT_BY_STRING"), 226 exp.StringToArray: rename_func("SPLIT_BY_STRING"), 227 exp.StrToUnix: lambda self, e: self.func("UNIX_TIMESTAMP", e.this, self.format_time(e)), 228 exp.TimeStrToDate: rename_func("TO_DATE"), 229 exp.TsOrDsAdd: lambda self, e: self.func("DATE_ADD", e.this, e.expression), 230 exp.TsOrDsToDate: lambda self, e: self.func("TO_DATE", e.this), 231 exp.TimeToUnix: rename_func("UNIX_TIMESTAMP"), 232 exp.TimestampTrunc: lambda self, e: self.func("DATE_TRUNC", e.this, unit_to_str(e)), 233 exp.UnixToStr: lambda self, e: self.func( 234 "FROM_UNIXTIME", e.this, time_format("doris")(self, e) 235 ), 236 exp.UnixToTime: rename_func("FROM_UNIXTIME"), 237 } 238 239 # https://github.com/apache/doris/blob/e4f41dbf1ec03f5937fdeba2ee1454a20254015b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisLexer.g4#L93 240 RESERVED_KEYWORDS = { 241 "account_lock", 242 "account_unlock", 243 "add", 244 "adddate", 245 "admin", 246 "after", 247 "agg_state", 248 "aggregate", 249 "alias", 250 "all", 251 "alter", 252 "analyze", 253 "analyzed", 254 "and", 255 "anti", 256 "append", 257 "array", 258 "array_range", 259 "as", 260 "asc", 261 "at", 262 "authors", 263 "auto", 264 "auto_increment", 265 "backend", 266 "backends", 267 "backup", 268 "begin", 269 "belong", 270 "between", 271 "bigint", 272 "bin", 273 "binary", 274 "binlog", 275 "bitand", 276 "bitmap", 277 "bitmap_union", 278 "bitor", 279 "bitxor", 280 "blob", 281 "boolean", 282 "brief", 283 "broker", 284 "buckets", 285 "build", 286 "builtin", 287 "bulk", 288 "by", 289 "cached", 290 "call", 291 "cancel", 292 "case", 293 "cast", 294 "catalog", 295 "catalogs", 296 "chain", 297 "char", 298 "character", 299 "charset", 300 "check", 301 "clean", 302 "cluster", 303 "clusters", 304 "collate", 305 "collation", 306 "collect", 307 "column", 308 "columns", 309 "comment", 310 "commit", 311 "committed", 312 "compact", 313 "complete", 314 "config", 315 "connection", 316 "connection_id", 317 "consistent", 318 "constraint", 319 "constraints", 320 "convert", 321 "copy", 322 "count", 323 "create", 324 "creation", 325 "cron", 326 "cross", 327 "cube", 328 "current", 329 "current_catalog", 330 "current_date", 331 "current_time", 332 "current_timestamp", 333 "current_user", 334 "data", 335 "database", 336 "databases", 337 "date", 338 "date_add", 339 "date_ceil", 340 "date_diff", 341 "date_floor", 342 "date_sub", 343 "dateadd", 344 "datediff", 345 "datetime", 346 "datetimev2", 347 "datev2", 348 "datetimev1", 349 "datev1", 350 "day", 351 "days_add", 352 "days_sub", 353 "decimal", 354 "decimalv2", 355 "decimalv3", 356 "decommission", 357 "default", 358 "deferred", 359 "delete", 360 "demand", 361 "desc", 362 "describe", 363 "diagnose", 364 "disk", 365 "distinct", 366 "distinctpc", 367 "distinctpcsa", 368 "distributed", 369 "distribution", 370 "div", 371 "do", 372 "doris_internal_table_id", 373 "double", 374 "drop", 375 "dropp", 376 "dual", 377 "duplicate", 378 "dynamic", 379 "else", 380 "enable", 381 "encryptkey", 382 "encryptkeys", 383 "end", 384 "ends", 385 "engine", 386 "engines", 387 "enter", 388 "errors", 389 "events", 390 "every", 391 "except", 392 "exclude", 393 "execute", 394 "exists", 395 "expired", 396 "explain", 397 "export", 398 "extended", 399 "external", 400 "extract", 401 "failed_login_attempts", 402 "false", 403 "fast", 404 "feature", 405 "fields", 406 "file", 407 "filter", 408 "first", 409 "float", 410 "follower", 411 "following", 412 "for", 413 "foreign", 414 "force", 415 "format", 416 "free", 417 "from", 418 "frontend", 419 "frontends", 420 "full", 421 "function", 422 "functions", 423 "generic", 424 "global", 425 "grant", 426 "grants", 427 "graph", 428 "group", 429 "grouping", 430 "groups", 431 "hash", 432 "having", 433 "hdfs", 434 "help", 435 "histogram", 436 "hll", 437 "hll_union", 438 "hostname", 439 "hour", 440 "hub", 441 "identified", 442 "if", 443 "ignore", 444 "immediate", 445 "in", 446 "incremental", 447 "index", 448 "indexes", 449 "infile", 450 "inner", 451 "insert", 452 "install", 453 "int", 454 "integer", 455 "intermediate", 456 "intersect", 457 "interval", 458 "into", 459 "inverted", 460 "ipv4", 461 "ipv6", 462 "is", 463 "is_not_null_pred", 464 "is_null_pred", 465 "isnull", 466 "isolation", 467 "job", 468 "jobs", 469 "join", 470 "json", 471 "jsonb", 472 "key", 473 "keys", 474 "kill", 475 "label", 476 "largeint", 477 "last", 478 "lateral", 479 "ldap", 480 "ldap_admin_password", 481 "left", 482 "less", 483 "level", 484 "like", 485 "limit", 486 "lines", 487 "link", 488 "list", 489 "load", 490 "local", 491 "localtime", 492 "localtimestamp", 493 "location", 494 "lock", 495 "logical", 496 "low_priority", 497 "manual", 498 "map", 499 "match", 500 "match_all", 501 "match_any", 502 "match_phrase", 503 "match_phrase_edge", 504 "match_phrase_prefix", 505 "match_regexp", 506 "materialized", 507 "max", 508 "maxvalue", 509 "memo", 510 "merge", 511 "migrate", 512 "migrations", 513 "min", 514 "minus", 515 "minute", 516 "modify", 517 "month", 518 "mtmv", 519 "name", 520 "names", 521 "natural", 522 "negative", 523 "never", 524 "next", 525 "ngram_bf", 526 "no", 527 "non_nullable", 528 "not", 529 "null", 530 "nulls", 531 "observer", 532 "of", 533 "offset", 534 "on", 535 "only", 536 "open", 537 "optimized", 538 "or", 539 "order", 540 "outer", 541 "outfile", 542 "over", 543 "overwrite", 544 "parameter", 545 "parsed", 546 "partition", 547 "partitions", 548 "password", 549 "password_expire", 550 "password_history", 551 "password_lock_time", 552 "password_reuse", 553 "path", 554 "pause", 555 "percent", 556 "period", 557 "permissive", 558 "physical", 559 "plan", 560 "process", 561 "plugin", 562 "plugins", 563 "policy", 564 "preceding", 565 "prepare", 566 "primary", 567 "proc", 568 "procedure", 569 "processlist", 570 "profile", 571 "properties", 572 "property", 573 "quantile_state", 574 "quantile_union", 575 "query", 576 "quota", 577 "random", 578 "range", 579 "read", 580 "real", 581 "rebalance", 582 "recover", 583 "recycle", 584 "refresh", 585 "references", 586 "regexp", 587 "release", 588 "rename", 589 "repair", 590 "repeatable", 591 "replace", 592 "replace_if_not_null", 593 "replica", 594 "repositories", 595 "repository", 596 "resource", 597 "resources", 598 "restore", 599 "restrictive", 600 "resume", 601 "returns", 602 "revoke", 603 "rewritten", 604 "right", 605 "rlike", 606 "role", 607 "roles", 608 "rollback", 609 "rollup", 610 "routine", 611 "row", 612 "rows", 613 "s3", 614 "sample", 615 "schedule", 616 "scheduler", 617 "schema", 618 "schemas", 619 "second", 620 "select", 621 "semi", 622 "sequence", 623 "serializable", 624 "session", 625 "set", 626 "sets", 627 "shape", 628 "show", 629 "signed", 630 "skew", 631 "smallint", 632 "snapshot", 633 "soname", 634 "split", 635 "sql_block_rule", 636 "start", 637 "starts", 638 "stats", 639 "status", 640 "stop", 641 "storage", 642 "stream", 643 "streaming", 644 "string", 645 "struct", 646 "subdate", 647 "sum", 648 "superuser", 649 "switch", 650 "sync", 651 "system", 652 "table", 653 "tables", 654 "tablesample", 655 "tablet", 656 "tablets", 657 "task", 658 "tasks", 659 "temporary", 660 "terminated", 661 "text", 662 "than", 663 "then", 664 "time", 665 "timestamp", 666 "timestampadd", 667 "timestampdiff", 668 "tinyint", 669 "to", 670 "transaction", 671 "trash", 672 "tree", 673 "triggers", 674 "trim", 675 "true", 676 "truncate", 677 "type", 678 "type_cast", 679 "types", 680 "unbounded", 681 "uncommitted", 682 "uninstall", 683 "union", 684 "unique", 685 "unlock", 686 "unsigned", 687 "update", 688 "use", 689 "user", 690 "using", 691 "value", 692 "values", 693 "varchar", 694 "variables", 695 "variant", 696 "vault", 697 "verbose", 698 "version", 699 "view", 700 "warnings", 701 "week", 702 "when", 703 "where", 704 "whitelist", 705 "with", 706 "work", 707 "workload", 708 "write", 709 "xor", 710 "year", 711 } 712 713 def uniquekeyproperty_sql( 714 self, expression: exp.UniqueKeyProperty, prefix: str = "UNIQUE KEY" 715 ) -> str: 716 create_stmt = expression.find_ancestor(exp.Create) 717 if create_stmt and create_stmt.args["properties"].find(exp.MaterializedProperty): 718 return super().uniquekeyproperty_sql(expression, prefix="KEY") 719 720 return super().uniquekeyproperty_sql(expression) 721 722 def partition_sql(self, expression: exp.Partition) -> str: 723 parent = expression.parent 724 if isinstance(parent, (exp.PartitionByRangeProperty, exp.PartitionByListProperty)): 725 return ", ".join(self.sql(e) for e in expression.expressions) 726 return super().partition_sql(expression) 727 728 def partitionrange_sql(self, expression: exp.PartitionRange) -> str: 729 name = self.sql(expression, "this") 730 values = expression.expressions 731 732 if len(values) != 1: 733 # Multiple values: use VALUES [ ... ) 734 if values and isinstance(values[0], list): 735 values_sql = ", ".join( 736 f"({', '.join(self.sql(v) for v in inner)})" for inner in values 737 ) 738 else: 739 values_sql = ", ".join(f"({self.sql(v)})" for v in values) 740 741 return f"PARTITION {name} VALUES [{values_sql})" 742 743 return f"PARTITION {name} VALUES LESS THAN ({self.sql(values[0])})" 744 745 def partitionbyrangepropertydynamic_sql( 746 self, expression: exp.PartitionByRangePropertyDynamic 747 ) -> str: 748 # Generates: FROM ("start") TO ("end") INTERVAL N UNIT 749 start = self.sql(expression, "start") 750 end = self.sql(expression, "end") 751 every = expression.args.get("every") 752 753 if every: 754 number = self.sql(every, "this") 755 interval = f"INTERVAL {number} {self.sql(every, 'unit')}" 756 else: 757 interval = "" 758 759 return f"FROM ({start}) TO ({end}) {interval}" 760 761 def partitionbyrangeproperty_sql(self, expression: exp.PartitionByRangeProperty) -> str: 762 partition_expressions = self.expressions( 763 expression, key="partition_expressions", indent=False 764 ) 765 create_sql = self.expressions(expression, key="create_expressions", indent=False) 766 return f"PARTITION BY RANGE ({partition_expressions}) ({create_sql})" 767 768 def partitionbylistproperty_sql(self, expression: exp.PartitionByListProperty) -> str: 769 partition_expressions = self.expressions( 770 expression, key="partition_expressions", indent=False 771 ) 772 create_sql = self.expressions(expression, key="create_expressions", indent=False) 773 return f"PARTITION BY LIST ({partition_expressions}) ({create_sql})" 774 775 def partitionlist_sql(self, expression: exp.PartitionList) -> str: 776 name = self.sql(expression, "this") 777 values = self.expressions(expression, indent=False) 778 return f"PARTITION {name} VALUES IN ({values})" 779 780 def partitionedbyproperty_sql(self, expression: exp.PartitionedByProperty) -> str: 781 node = expression.this 782 if isinstance(node, exp.Schema): 783 parts = ", ".join(self.sql(e) for e in node.expressions) 784 return f"PARTITION BY ({parts})" 785 return f"PARTITION BY ({self.sql(node)})" 786 787 def table_sql(self, expression: exp.Table, sep: str = " AS ") -> str: 788 """Override table_sql to avoid AS keyword in UPDATE and DELETE statements.""" 789 ancestor = expression.find_ancestor(exp.Update, exp.Delete, exp.Select) 790 if not isinstance(ancestor, exp.Select): 791 sep = " " 792 return super().table_sql(expression, sep=sep) 793 794 def alterrename_sql(self, expression: exp.AlterRename, include_to: bool = True) -> str: 795 return super().alterrename_sql(expression, include_to=False)
Generator converts a given syntax tree to the corresponding SQL string.
Arguments:
- pretty: Whether to format the produced SQL string. Default: False.
- identify: Determines when an identifier should be quoted. Possible values are: False (default): Never quote, except in cases where it's mandatory by the dialect. True or 'always': Always quote. 'safe': Only quote identifiers that are case insensitive.
- normalize: Whether to normalize identifiers to lowercase. Default: False.
- pad: The pad size in a formatted string. For example, this affects the indentation of a projection in a query, relative to its nesting level. Default: 2.
- indent: The indentation size in a formatted string. For example, this affects the
indentation of subqueries and filters under a
WHERE
clause. Default: 2. - normalize_functions: How to normalize function names. Possible values are: "upper" or True (default): Convert names to uppercase. "lower": Convert names to lowercase. False: Disables function name normalization.
- unsupported_level: Determines the generator's behavior when it encounters unsupported expressions. Default ErrorLevel.WARN.
- max_unsupported: Maximum number of unsupported messages to include in a raised UnsupportedError. This is only relevant if unsupported_level is ErrorLevel.RAISE. Default: 3
- leading_comma: Whether the comma is leading or trailing in select expressions. This is only relevant when generating in pretty mode. Default: False
- max_text_width: The max number of characters in a segment before creating new lines in pretty mode. The default is on the smaller end because the length only represents a segment and not the true line length. Default: 80
- comments: Whether to preserve comments in the output SQL code. Default: True
TYPE_MAPPING =
{<Type.DATETIME2: 'DATETIME2'>: 'DATETIME', <Type.NCHAR: 'NCHAR'>: 'CHAR', <Type.NVARCHAR: 'NVARCHAR'>: 'VARCHAR', <Type.INET: 'INET'>: 'INET', <Type.ROWVERSION: 'ROWVERSION'>: 'VARBINARY', <Type.SMALLDATETIME: 'SMALLDATETIME'>: 'DATETIME', <Type.UBIGINT: 'UBIGINT'>: 'BIGINT', <Type.UINT: 'UINT'>: 'INT', <Type.UMEDIUMINT: 'UMEDIUMINT'>: 'MEDIUMINT', <Type.USMALLINT: 'USMALLINT'>: 'SMALLINT', <Type.UTINYINT: 'UTINYINT'>: 'TINYINT', <Type.UDECIMAL: 'UDECIMAL'>: 'DECIMAL', <Type.UDOUBLE: 'UDOUBLE'>: 'DOUBLE', <Type.TIMESTAMP: 'TIMESTAMP'>: 'DATETIME', <Type.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>: 'DATETIME', <Type.TIMESTAMPTZ: 'TIMESTAMPTZ'>: 'DATETIME', <Type.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>: 'TIMESTAMP', <Type.TEXT: 'TEXT'>: 'STRING'}
PROPERTIES_LOCATION =
{<class 'sqlglot.expressions.AllowedValuesProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.AlgorithmProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.AutoIncrementProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.AutoRefreshProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.BackupProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.BlockCompressionProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.CharacterSetProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ChecksumProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.CollateProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.CopyGrantsProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.Cluster'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ClusteredByProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DistributedByProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DuplicateKeyProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DataBlocksizeProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.DataDeletionProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DefinerProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.DictRange'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DictProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DynamicProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.DistKeyProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DistStyleProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.EmptyProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.EncodeProperty'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.EngineProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.EnviromentProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ExecuteAsProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ExternalProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.FallbackProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.FileFormatProperty'>: <Location.POST_WITH: 'POST_WITH'>, <class 'sqlglot.expressions.FreespaceProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.GlobalProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.HeapProperty'>: <Location.POST_WITH: 'POST_WITH'>, <class 'sqlglot.expressions.InheritsProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.IcebergProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.IncludeProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.InputModelProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.IsolatedLoadingProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.JournalProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.LanguageProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.LikeProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.LocationProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.LockProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.LockingProperty'>: <Location.POST_ALIAS: 'POST_ALIAS'>, <class 'sqlglot.expressions.LogProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.MaterializedProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.MergeBlockRatioProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.NoPrimaryIndexProperty'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.OnProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.OnCommitProperty'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.Order'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.OutputModelProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.PartitionedByProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.PartitionedOfProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.PrimaryKey'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.Property'>: <Location.POST_WITH: 'POST_WITH'>, <class 'sqlglot.expressions.RemoteWithConnectionModelProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ReturnsProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.RowFormatProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.RowFormatDelimitedProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.RowFormatSerdeProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SampleProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SchemaCommentProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SecureProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.SecurityProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SerdeProperties'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.Set'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SettingsProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SetProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.SetConfigProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SharingProperty'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.SequenceProperties'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.SortKeyProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SqlReadWriteProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SqlSecurityProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.StabilityProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.StorageHandlerProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.StreamingTableProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.StrictProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.Tags'>: <Location.POST_WITH: 'POST_WITH'>, <class 'sqlglot.expressions.TemporaryProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.ToTableProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.TransientProperty'>: <Location.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.TransformModelProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.MergeTreeTTL'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.UnloggedProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.UsingTemplateProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ViewAttributeProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.VolatileProperty'>: <Location.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.WithDataProperty'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.WithJournalTableProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.WithProcedureOptions'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.WithSchemaBindingProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.WithSystemVersioningProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ForceProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.UniqueKeyProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.PartitionByRangeProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.PartitionByListProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.BuildProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.RefreshTriggerProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>}
TRANSFORMS =
{<class 'sqlglot.expressions.JSONPathFilter'>: <function <lambda>>, <class 'sqlglot.expressions.JSONPathKey'>: <function <lambda>>, <class 'sqlglot.expressions.JSONPathRecursive'>: <function <lambda>>, <class 'sqlglot.expressions.JSONPathRoot'>: <function <lambda>>, <class 'sqlglot.expressions.JSONPathScript'>: <function <lambda>>, <class 'sqlglot.expressions.JSONPathSelector'>: <function <lambda>>, <class 'sqlglot.expressions.JSONPathSlice'>: <function <lambda>>, <class 'sqlglot.expressions.JSONPathSubscript'>: <function <lambda>>, <class 'sqlglot.expressions.JSONPathUnion'>: <function <lambda>>, <class 'sqlglot.expressions.JSONPathWildcard'>: <function <lambda>>, <class 'sqlglot.expressions.AllowedValuesProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.AnalyzeColumns'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.AnalyzeWith'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ArrayContainsAll'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ArrayOverlaps'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.AutoRefreshProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.BackupProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CaseSpecificColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Ceil'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CharacterSetColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CharacterSetProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ClusteredColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CollateColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CommentColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ConnectByRoot'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ConvertToCharset'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CopyGrantsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CredentialsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.DateFormatColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.DefaultColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.DynamicProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.EmptyProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.EncodeColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.EnviromentProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.EphemeralColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ExcludeColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ExecuteAsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Except'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ExternalProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Floor'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Get'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.GlobalProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.HeapProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.IcebergProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.InheritsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.InlineLengthColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.InputModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Intersect'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.IntervalSpan'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Int64'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.LanguageProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.LocationProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.LogProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.MaterializedProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.NonClusteredColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.NoPrimaryIndexProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.NotForReplicationColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.OnCommitProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.OnProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.OnUpdateColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Operator'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.OutputModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.PathColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.PartitionedByBucket'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.PartitionByTruncate'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.PivotAny'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.PositionalColumn'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ProjectionPolicyColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Put'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.RemoteWithConnectionModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ReturnsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SampleProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SecureProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SecurityProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SetConfigProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SetProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SettingsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SharingProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SqlReadWriteProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SqlSecurityProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.StabilityProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Stream'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.StreamingTableProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.StrictProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SwapTable'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TableColumn'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Tags'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TemporaryProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TitleColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ToMap'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ToTableProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TransformModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TransientProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Union'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.UnloggedProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.UsingTemplateProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.UsingData'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Uuid'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.UppercaseColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.VarMap'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ViewAttributeProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.VolatileProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WeekStart'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WithJournalTableProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WithProcedureOptions'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WithSchemaBindingProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WithOperator'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ForceProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ArrayAgg'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.CurrentDate'>: <function Doris.Generator.<lambda>>, <class 'sqlglot.expressions.DateDiff'>: <function _remove_ts_or_ds_to_date.<locals>.func>, <class 'sqlglot.expressions.DateAdd'>: <function _remove_ts_or_ds_to_date.<locals>.func>, <class 'sqlglot.expressions.DateStrToDate'>: <function datestrtodate_sql>, <class 'sqlglot.expressions.DateSub'>: <function _remove_ts_or_ds_to_date.<locals>.func>, <class 'sqlglot.expressions.DateTrunc'>: <function Doris.Generator.<lambda>>, <class 'sqlglot.expressions.Day'>: <function _remove_ts_or_ds_to_date.<locals>.func>, <class 'sqlglot.expressions.DayOfMonth'>: <function _remove_ts_or_ds_to_date.<locals>.func>, <class 'sqlglot.expressions.DayOfWeek'>: <function _remove_ts_or_ds_to_date.<locals>.func>, <class 'sqlglot.expressions.DayOfYear'>: <function _remove_ts_or_ds_to_date.<locals>.func>, <class 'sqlglot.expressions.GroupConcat'>: <function Doris.Generator.<lambda>>, <class 'sqlglot.expressions.ILike'>: <function no_ilike_sql>, <class 'sqlglot.expressions.JSONExtractScalar'>: <function Doris.Generator.<lambda>>, <class 'sqlglot.expressions.Length'>: <function length_or_char_length_sql>, <class 'sqlglot.expressions.LogicalOr'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.LogicalAnd'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.Max'>: <function max_or_greatest>, <class 'sqlglot.expressions.Min'>: <function min_or_least>, <class 'sqlglot.expressions.Month'>: <function _remove_ts_or_ds_to_date.<locals>.func>, <class 'sqlglot.expressions.NullSafeEQ'>: <function MySQL.Generator.<lambda>>, <class 'sqlglot.expressions.NullSafeNEQ'>: <function MySQL.Generator.<lambda>>, <class 'sqlglot.expressions.NumberToStr'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.Pivot'>: <function no_pivot_sql>, <class 'sqlglot.expressions.Select'>: <function preprocess.<locals>._to_sql>, <class 'sqlglot.expressions.StrPosition'>: <function MySQL.Generator.<lambda>>, <class 'sqlglot.expressions.StrToDate'>: <function _str_to_date_sql>, <class 'sqlglot.expressions.StrToTime'>: <function _str_to_date_sql>, <class 'sqlglot.expressions.Stuff'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.TableSample'>: <function no_tablesample_sql>, <class 'sqlglot.expressions.TimeFromParts'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.TimestampAdd'>: <function date_add_interval_sql.<locals>.func>, <class 'sqlglot.expressions.TimestampDiff'>: <function MySQL.Generator.<lambda>>, <class 'sqlglot.expressions.TimestampSub'>: <function date_add_interval_sql.<locals>.func>, <class 'sqlglot.expressions.TimeStrToUnix'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.TimeStrToTime'>: <function MySQL.Generator.<lambda>>, <class 'sqlglot.expressions.TimeToStr'>: <function _remove_ts_or_ds_to_date.<locals>.func>, <class 'sqlglot.expressions.Trim'>: <function trim_sql>, <class 'sqlglot.expressions.TryCast'>: <function no_trycast_sql>, <class 'sqlglot.expressions.TsOrDsAdd'>: <function Doris.Generator.<lambda>>, <class 'sqlglot.expressions.TsOrDsDiff'>: <function MySQL.Generator.<lambda>>, <class 'sqlglot.expressions.TsOrDsToDate'>: <function Doris.Generator.<lambda>>, <class 'sqlglot.expressions.Unicode'>: <function MySQL.Generator.<lambda>>, <class 'sqlglot.expressions.UnixToTime'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.Week'>: <function _remove_ts_or_ds_to_date.<locals>.func>, <class 'sqlglot.expressions.WeekOfYear'>: <function _remove_ts_or_ds_to_date.<locals>.func>, <class 'sqlglot.expressions.Year'>: <function _remove_ts_or_ds_to_date.<locals>.func>, <class 'sqlglot.expressions.AddMonths'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.ApproxDistinct'>: <function approx_count_distinct_sql>, <class 'sqlglot.expressions.ArgMax'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.ArgMin'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.ArrayToString'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.ArrayUniqueAgg'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.CurrentTimestamp'>: <function Doris.Generator.<lambda>>, <class 'sqlglot.expressions.Lag'>: <function _lag_lead_sql>, <class 'sqlglot.expressions.Lead'>: <function _lag_lead_sql>, <class 'sqlglot.expressions.Map'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.Property'>: <function property_sql>, <class 'sqlglot.expressions.RegexpLike'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.RegexpSplit'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.SchemaCommentProperty'>: <function Doris.Generator.<lambda>>, <class 'sqlglot.expressions.Split'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.StringToArray'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.StrToUnix'>: <function Doris.Generator.<lambda>>, <class 'sqlglot.expressions.TimeStrToDate'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.TimeToUnix'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.TimestampTrunc'>: <function Doris.Generator.<lambda>>, <class 'sqlglot.expressions.UnixToStr'>: <function Doris.Generator.<lambda>>}
RESERVED_KEYWORDS =
{'datetimev2', 'proc', 'refresh', 'second', 'migrations', 'decommission', 'first', 'resume', 'external', 'recycle', 'complete', 'schema', 'modify', 'text', 'exists', 'storage', 'date', 'brief', 'tables', 'account_lock', 'case', 'doris_internal_table_id', 'value', 'convert', 'unique', 'list', 'drop', 'policy', 'timestampdiff', 'sets', 'transaction', 'bitor', 'hostname', 'schemas', 'int', 'export', 'cross', 'creation', 'match', 'lateral', 'truncate', 'read', 'largeint', 'cached', 'sync', 'subdate', 'tablesample', 'type_cast', 'auto', 'using', 'system', 'days_add', 'backends', 'union', 'maxvalue', 'datetime', 'level', 'float', 'inverted', 'authors', 'isnull', 'left', 'datev1', 'index', 'file', 'real', 'boolean', 'minus', 'never', 'quota', 'date_diff', 'bitxor', 'graph', 'minute', 'is_not_null_pred', 'password_lock_time', 'compact', 'physical', 'ipv6', 'work', 'random', 'force', 'hub', 'regexp', 'bitand', 'over', 'buckets', 'row', 'decimalv3', 'pause', 'struct', 'outer', 'last', 'view', 'match_phrase', 'constraints', 'default', 'terminated', 'match_all', 'temporary', 'delete', 'after', 'exclude', 'user', 'show', 'soname', 'max', 'update', 'task', 'failed_login_attempts', 'null', 'overwrite', 'switch', 'lines', 'timestampadd', 'dynamic', 'database', 'query', 'procedure', 'follower', 'in', 'unbounded', 'else', 'enter', 'execute', 'label', 'commit', 'hll', 'password_reuse', 'percent', 'profile', 'where', 'false', 'constraint', 'intermediate', 'between', 'non_nullable', 'restrictive', 'grants', 'if', 'infile', 'sequence', 'distinctpc', 'foreign', 'cancel', 'bigint', 'except', 'ignore', 'name', 'is_null_pred', 'with', 'tinyint', 'deferred', 'manual', 'sum', 'signed', 'hll_union', 'encryptkeys', 'mtmv', 'version', 'grant', 'repair', 's3', 'materialized', 'set', 'xor', 'release', 'functions', 'on', 'column', 'next', 'comment', 'plugins', 'tasks', 'admin', 'filter', 'right', 'install', 'routine', 'identified', 'date_ceil', 'prepare', 'format', 'split', 'aggregate', 'insert', 'recover', 'cluster', 'end', 'primary', 'extract', 'json', 'append', 'cast', 'cube', 'migrate', 'enable', 'semi', 'range', 'disk', 'call', 'session', 'function', 'local', 'distinctpcsa', 'binary', 'catalog', 'distribution', 'all', 'replace_if_not_null', 'builtin', 'limit', 'trim', 'write', 'day', 'load', 'double', 'jsonb', 'is', 'backup', 'begin', 'rows', 'roles', 'permissive', 'offset', 'quantile_state', 'charset', 'current_catalog', 'match_phrase_prefix', 'nulls', 'only', 'preceding', 'dropp', 'free', 'current_user', 'backend', 'char', 'clean', 'chain', 'match_phrase_edge', 'bitmap_union', 'describe', 'diagnose', 'add', 'timestamp', 'skew', 'repository', 'inner', 'cron', 'datev2', 'date_add', 'resource', 'optimized', 'ends', 'grouping', 'smallint', 'like', 'replace', 'agg_state', 'current_timestamp', 'use', 'select', 'schedule', 'workload', 'current_time', 'distinct', 'lock', 'trash', 'analyze', 'connection_id', 'count', 'jobs', 'whitelist', 'stop', 'broker', 'password', 'process', 'rebalance', 'character', 'time', 'copy', 'errors', 'names', 'encryptkey', 'databases', 'events', 'parameter', 'uninstall', 'scheduler', 'ngram_bf', 'vault', 'month', 'tablet', 'datediff', 'array_range', 'fields', 'intersect', 'starts', 'types', 'less', 'references', 'bitmap', 'adddate', 'rollup', 'plan', 'open', 'role', 'week', 'unsigned', 'or', 'negative', 'snapshot', 'collect', 'join', 'unlock', 'dateadd', 'and', 'match_any', 'ldap', 'duplicate', 'to', 'password_expire', 'merge', 'build', 'processlist', 'collation', 'at', 'values', 'localtime', 'rollback', 'anti', 'date_floor', 'plugin', 'variables', 'path', 'properties', 'alter', 'string', 'true', 'min', 'varchar', 'repeatable', 'period', 'table', 'alias', 'shape', 'feature', 'of', 'histogram', 'consistent', 'binlog', 'fast', 'blob', 'config', 'stats', 'from', 'returns', 'no', 'verbose', 'replica', 'warnings', 'generic', 'repositories', 'auto_increment', 'keys', 'dual', 'catalogs', 'full', 'than', 'belong', 'job', 'key', 'incremental', 'current_date', 'clusters', 'bin', 'revoke', 'parsed', 'serializable', 'rlike', 'extended', 'ldap_admin_password', 'start', 'every', 'order', 'days_sub', 'kill', 'not', 'restore', 'collate', 'date_sub', 'low_priority', 'partition', 'sample', 'frontend', 'partitions', 'array', 'logical', 'tablets', 'isolation', 'columns', 'when', 'do', 'indexes', 'current', 'hdfs', 'resources', 'by', 'natural', 'explain', 'committed', 'connection', 'as', 'engine', 'div', 'demand', 'hour', 'global', 'frontends', 'memo', 'quantile_union', 'bulk', 'observer', 'localtimestamp', 'create', 'variant', 'analyzed', 'group', 'ipv4', 'into', 'help', 'decimal', 'engines', 'link', 'streaming', 'asc', 'account_unlock', 'following', 'property', 'groups', 'data', 'desc', 'rewritten', 'interval', 'outfile', 'uncommitted', 'tree', 'match_regexp', 'password_history', 'type', 'sql_block_rule', 'then', 'decimalv2', 'hash', 'check', 'location', 'superuser', 'year', 'expired', 'immediate', 'datetimev1', 'map', 'triggers', 'rename', 'stream', 'having', 'integer', 'status', 'for', 'distributed'}
def
uniquekeyproperty_sql( self, expression: sqlglot.expressions.UniqueKeyProperty, prefix: str = 'UNIQUE KEY') -> str:
713 def uniquekeyproperty_sql( 714 self, expression: exp.UniqueKeyProperty, prefix: str = "UNIQUE KEY" 715 ) -> str: 716 create_stmt = expression.find_ancestor(exp.Create) 717 if create_stmt and create_stmt.args["properties"].find(exp.MaterializedProperty): 718 return super().uniquekeyproperty_sql(expression, prefix="KEY") 719 720 return super().uniquekeyproperty_sql(expression)
728 def partitionrange_sql(self, expression: exp.PartitionRange) -> str: 729 name = self.sql(expression, "this") 730 values = expression.expressions 731 732 if len(values) != 1: 733 # Multiple values: use VALUES [ ... ) 734 if values and isinstance(values[0], list): 735 values_sql = ", ".join( 736 f"({', '.join(self.sql(v) for v in inner)})" for inner in values 737 ) 738 else: 739 values_sql = ", ".join(f"({self.sql(v)})" for v in values) 740 741 return f"PARTITION {name} VALUES [{values_sql})" 742 743 return f"PARTITION {name} VALUES LESS THAN ({self.sql(values[0])})"
def
partitionbyrangepropertydynamic_sql( self, expression: sqlglot.expressions.PartitionByRangePropertyDynamic) -> str:
745 def partitionbyrangepropertydynamic_sql( 746 self, expression: exp.PartitionByRangePropertyDynamic 747 ) -> str: 748 # Generates: FROM ("start") TO ("end") INTERVAL N UNIT 749 start = self.sql(expression, "start") 750 end = self.sql(expression, "end") 751 every = expression.args.get("every") 752 753 if every: 754 number = self.sql(every, "this") 755 interval = f"INTERVAL {number} {self.sql(every, 'unit')}" 756 else: 757 interval = "" 758 759 return f"FROM ({start}) TO ({end}) {interval}"
def
partitionbyrangeproperty_sql(self, expression: sqlglot.expressions.PartitionByRangeProperty) -> str:
761 def partitionbyrangeproperty_sql(self, expression: exp.PartitionByRangeProperty) -> str: 762 partition_expressions = self.expressions( 763 expression, key="partition_expressions", indent=False 764 ) 765 create_sql = self.expressions(expression, key="create_expressions", indent=False) 766 return f"PARTITION BY RANGE ({partition_expressions}) ({create_sql})"
def
partitionbylistproperty_sql(self, expression: sqlglot.expressions.PartitionByListProperty) -> str:
768 def partitionbylistproperty_sql(self, expression: exp.PartitionByListProperty) -> str: 769 partition_expressions = self.expressions( 770 expression, key="partition_expressions", indent=False 771 ) 772 create_sql = self.expressions(expression, key="create_expressions", indent=False) 773 return f"PARTITION BY LIST ({partition_expressions}) ({create_sql})"
787 def table_sql(self, expression: exp.Table, sep: str = " AS ") -> str: 788 """Override table_sql to avoid AS keyword in UPDATE and DELETE statements.""" 789 ancestor = expression.find_ancestor(exp.Update, exp.Delete, exp.Select) 790 if not isinstance(ancestor, exp.Select): 791 sep = " " 792 return super().table_sql(expression, sep=sep)
Override table_sql to avoid AS keyword in UPDATE and DELETE statements.
def
alterrename_sql( self, expression: sqlglot.expressions.AlterRename, include_to: bool = True) -> str:
AFTER_HAVING_MODIFIER_TRANSFORMS =
{'windows': <function Generator.<lambda>>, 'qualify': <function Generator.<lambda>>}
Inherited Members
- sqlglot.generator.Generator
- Generator
- IGNORE_NULLS_IN_FUNC
- EXCEPT_INTERSECT_SUPPORT_ALL_CLAUSE
- CREATE_FUNCTION_RETURN_AS
- MATCHED_BY_SOURCE
- SINGLE_STRING_INTERVAL
- GROUPINGS_SEP
- INDEX_ON
- QUERY_HINTS
- IS_BOOL_ALLOWED
- LIMIT_IS_TOP
- RETURNING_END
- EXTRACT_ALLOWS_QUOTES
- TZ_TO_WITH_TIME_ZONE
- ALTER_TABLE_INCLUDE_COLUMN_KEYWORD
- UNNEST_WITH_ORDINALITY
- AGGREGATE_FILTER_SUPPORTED
- SEMI_ANTI_JOIN_WITH_SIDE
- COMPUTED_COLUMN_WITH_TYPE
- SUPPORTS_TABLE_COPY
- TABLESAMPLE_REQUIRES_PARENS
- TABLESAMPLE_SIZE_IS_ROWS
- TABLESAMPLE_KEYWORDS
- TABLESAMPLE_WITH_METHOD
- TABLESAMPLE_SEED_KEYWORD
- COLLATE_IS_FUNC
- DATA_TYPE_SPECIFIERS_ALLOWED
- ENSURE_BOOLS
- CTE_RECURSIVE_KEYWORD_REQUIRED
- SUPPORTS_SINGLE_ARG_CONCAT
- SUPPORTS_TABLE_ALIAS_COLUMNS
- UNPIVOT_ALIASES_ARE_IDENTIFIERS
- INSERT_OVERWRITE
- SUPPORTS_SELECT_INTO
- SUPPORTS_UNLOGGED_TABLES
- SUPPORTS_CREATE_TABLE_LIKE
- LIKE_PROPERTY_INSIDE_SCHEMA
- MULTI_ARG_DISTINCT
- JSON_PATH_SINGLE_QUOTE_ESCAPE
- SUPPORTED_JSON_PATH_PARTS
- CAN_IMPLEMENT_ARRAY_ANY
- SUPPORTS_WINDOW_EXCLUDE
- SET_OP_MODIFIERS
- COPY_PARAMS_ARE_WRAPPED
- COPY_PARAMS_EQ_REQUIRED
- COPY_HAS_INTO_KEYWORD
- STAR_EXCEPT
- HEX_FUNC
- QUOTE_JSON_PATH
- SUPPORTS_EXPLODING_PROJECTIONS
- ARRAY_CONCAT_IS_VAR_LEN
- SUPPORTS_CONVERT_TIMEZONE
- SUPPORTS_UNIX_SECONDS
- ALTER_SET_WRAPPED
- NORMALIZE_EXTRACT_DATE_PARTS
- ARRAY_SIZE_NAME
- ALTER_SET_TYPE
- ARRAY_SIZE_DIM_REQUIRED
- SUPPORTS_BETWEEN_FLAGS
- SUPPORTS_LIKE_QUANTIFIERS
- UNSUPPORTED_TYPES
- TIME_PART_SINGULARS
- TOKEN_MAPPING
- STRUCT_DELIMITER
- PARAMETER_TOKEN
- NAMED_PLACEHOLDER_TOKEN
- EXPRESSION_PRECEDES_PROPERTIES_CREATABLES
- WITH_SEPARATED_COMMENTS
- EXCLUDE_COMMENTS
- UNWRAPPED_INTERVAL_VALUES
- PARAMETERIZABLE_TEXT_TYPES
- EXPRESSIONS_WITHOUT_NESTED_CTES
- RESPECT_IGNORE_NULLS_UNSUPPORTED_EXPRESSIONS
- SAFE_JSON_PATH_KEY_RE
- SENTINEL_LINE_BREAK
- pretty
- identify
- normalize
- pad
- unsupported_level
- max_unsupported
- leading_comma
- max_text_width
- comments
- dialect
- normalize_functions
- unsupported_messages
- generate
- preprocess
- unsupported
- sep
- seg
- sanitize_comment
- maybe_comment
- wrap
- no_identify
- normalize_func
- indent
- sql
- uncache_sql
- cache_sql
- characterset_sql
- column_parts
- column_sql
- columnposition_sql
- columndef_sql
- columnconstraint_sql
- autoincrementcolumnconstraint_sql
- compresscolumnconstraint_sql
- generatedasidentitycolumnconstraint_sql
- generatedasrowcolumnconstraint_sql
- periodforsystemtimeconstraint_sql
- notnullcolumnconstraint_sql
- primarykeycolumnconstraint_sql
- uniquecolumnconstraint_sql
- createable_sql
- create_sql
- sequenceproperties_sql
- clone_sql
- describe_sql
- heredoc_sql
- prepend_ctes
- with_sql
- cte_sql
- tablealias_sql
- bitstring_sql
- hexstring_sql
- bytestring_sql
- unicodestring_sql
- rawstring_sql
- datatypeparam_sql
- directory_sql
- delete_sql
- drop_sql
- set_operation
- set_operations
- fetch_sql
- limitoptions_sql
- filter_sql
- hint_sql
- indexparameters_sql
- index_sql
- identifier_sql
- hex_sql
- lowerhex_sql
- inputoutputformat_sql
- national_sql
- properties_sql
- root_properties
- properties
- with_properties
- locate_properties
- property_name
- property_sql
- likeproperty_sql
- fallbackproperty_sql
- journalproperty_sql
- freespaceproperty_sql
- checksumproperty_sql
- mergeblockratioproperty_sql
- datablocksizeproperty_sql
- blockcompressionproperty_sql
- isolatedloadingproperty_sql
- partitionboundspec_sql
- partitionedofproperty_sql
- lockingproperty_sql
- withdataproperty_sql
- withsystemversioningproperty_sql
- insert_sql
- introducer_sql
- kill_sql
- pseudotype_sql
- objectidentifier_sql
- onconflict_sql
- returning_sql
- rowformatdelimitedproperty_sql
- withtablehint_sql
- indextablehint_sql
- historicaldata_sql
- table_parts
- tablefromrows_sql
- tablesample_sql
- pivot_sql
- version_sql
- tuple_sql
- update_sql
- values_sql
- var_sql
- into_sql
- from_sql
- groupingsets_sql
- rollup_sql
- cube_sql
- group_sql
- having_sql
- connect_sql
- prior_sql
- join_sql
- lambda_sql
- lateral_op
- lateral_sql
- limit_sql
- offset_sql
- setitem_sql
- set_sql
- queryband_sql
- pragma_sql
- lock_sql
- literal_sql
- escape_str
- loaddata_sql
- null_sql
- boolean_sql
- order_sql
- withfill_sql
- cluster_sql
- distribute_sql
- sort_sql
- ordered_sql
- matchrecognizemeasure_sql
- matchrecognize_sql
- query_modifiers
- options_modifier
- for_modifiers
- queryoption_sql
- offset_limit_modifiers
- after_limit_modifiers
- select_sql
- schema_sql
- schema_columns_sql
- star_sql
- parameter_sql
- sessionparameter_sql
- placeholder_sql
- subquery_sql
- qualify_sql
- unnest_sql
- prewhere_sql
- where_sql
- window_sql
- partition_by_sql
- windowspec_sql
- withingroup_sql
- between_sql
- bracket_offset_expressions
- bracket_sql
- all_sql
- any_sql
- exists_sql
- case_sql
- constraint_sql
- nextvaluefor_sql
- trim_sql
- convert_concat_args
- concat_sql
- concatws_sql
- check_sql
- foreignkey_sql
- primarykey_sql
- if_sql
- matchagainst_sql
- jsonkeyvalue_sql
- jsonpath_sql
- json_path_part
- formatjson_sql
- formatphrase_sql
- jsonobject_sql
- jsonobjectagg_sql
- jsonarray_sql
- jsonarrayagg_sql
- jsoncolumndef_sql
- jsonschema_sql
- jsontable_sql
- openjsoncolumndef_sql
- openjson_sql
- in_sql
- in_unnest_op
- interval_sql
- return_sql
- reference_sql
- anonymous_sql
- paren_sql
- neg_sql
- not_sql
- alias_sql
- pivotalias_sql
- aliases_sql
- atindex_sql
- fromtimezone_sql
- add_sql
- and_sql
- or_sql
- xor_sql
- connector_sql
- bitwiseand_sql
- bitwiseleftshift_sql
- bitwisenot_sql
- bitwiseor_sql
- bitwiserightshift_sql
- bitwisexor_sql
- currentdate_sql
- collate_sql
- command_sql
- comment_sql
- mergetreettlaction_sql
- mergetreettl_sql
- transaction_sql
- commit_sql
- rollback_sql
- alterindex_sql
- alterdiststyle_sql
- altersortkey_sql
- renamecolumn_sql
- alterset_sql
- alter_sql
- add_column_sql
- droppartition_sql
- addconstraint_sql
- addpartition_sql
- distinct_sql
- ignorenulls_sql
- respectnulls_sql
- havingmax_sql
- intdiv_sql
- div_sql
- safedivide_sql
- overlaps_sql
- distance_sql
- dot_sql
- eq_sql
- propertyeq_sql
- escape_sql
- glob_sql
- gt_sql
- gte_sql
- is_sql
- like_sql
- ilike_sql
- similarto_sql
- lt_sql
- lte_sql
- mod_sql
- mul_sql
- neq_sql
- nullsafeeq_sql
- nullsafeneq_sql
- slice_sql
- sub_sql
- trycast_sql
- jsoncast_sql
- try_sql
- log_sql
- use_sql
- binary
- ceil_floor
- function_fallback_sql
- func
- format_args
- too_wide
- format_time
- expressions
- op_expressions
- naked_property
- tag_sql
- token_sql
- userdefinedfunction_sql
- joinhint_sql
- kwarg_sql
- when_sql
- whens_sql
- merge_sql
- tochar_sql
- tonumber_sql
- dictproperty_sql
- dictrange_sql
- dictsubproperty_sql
- duplicatekeyproperty_sql
- distributedbyproperty_sql
- oncluster_sql
- clusteredbyproperty_sql
- anyvalue_sql
- querytransform_sql
- indexconstraintoption_sql
- checkcolumnconstraint_sql
- indexcolumnconstraint_sql
- nvl2_sql
- comprehension_sql
- columnprefix_sql
- opclass_sql
- predict_sql
- generateembedding_sql
- featuresattime_sql
- vectorsearch_sql
- forin_sql
- refresh_sql
- toarray_sql
- tsordstotime_sql
- tsordstotimestamp_sql
- tsordstodatetime_sql
- tsordstodate_sql
- unixdate_sql
- lastday_sql
- dateadd_sql
- arrayany_sql
- struct_sql
- truncatetable_sql
- convert_sql
- copyparameter_sql
- credentials_sql
- copy_sql
- semicolon_sql
- datadeletionproperty_sql
- maskingpolicycolumnconstraint_sql
- gapfill_sql
- scope_resolution
- scoperesolution_sql
- parsejson_sql
- rand_sql
- changes_sql
- pad_sql
- summarize_sql
- explodinggenerateseries_sql
- arrayconcat_sql
- json_sql
- jsonvalue_sql
- conditionalinsert_sql
- multitableinserts_sql
- oncondition_sql
- jsonextractquote_sql
- jsonexists_sql
- arrayagg_sql
- apply_sql
- grant_sql
- revoke_sql
- grantprivilege_sql
- grantprincipal_sql
- columns_sql
- overlay_sql
- todouble_sql
- string_sql
- median_sql
- overflowtruncatebehavior_sql
- unixseconds_sql
- arraysize_sql
- attach_sql
- detach_sql
- attachoption_sql
- watermarkcolumnconstraint_sql
- encodeproperty_sql
- includeproperty_sql
- xmlelement_sql
- xmlkeyvalueoption_sql
- unpivotcolumns_sql
- analyzesample_sql
- analyzestatistics_sql
- analyzehistogram_sql
- analyzedelete_sql
- analyzelistchainedrows_sql
- analyzevalidate_sql
- analyze_sql
- xmltable_sql
- xmlnamespace_sql
- export_sql
- declare_sql
- declareitem_sql
- recursivewithsearch_sql
- parameterizedagg_sql
- anonymousaggfunc_sql
- combinedaggfunc_sql
- combinedparameterizedagg_sql
- get_put_sql
- translatecharacters_sql
- decodecase_sql
- semanticview_sql
- getextract_sql
- datefromunixdate_sql
- space_sql
- buildproperty_sql
- refreshtriggerproperty_sql
- sqlglot.dialects.mysql.MySQL.Generator
- INTERVAL_ALLOWS_PLURAL_FORM
- LOCKING_READS_SUPPORTED
- NULL_ORDERING_SUPPORTED
- JOIN_HINTS
- TABLE_HINTS
- DUPLICATE_KEY_UPDATE_WITH_SET
- QUERY_HINT_SEP
- VALUES_AS_TABLE
- NVL2_SUPPORTED
- JSON_TYPE_REQUIRED_FOR_EXTRACTION
- JSON_PATH_BRACKETED_KEY_SUPPORTED
- JSON_KEY_VALUE_PAIR_SEP
- SUPPORTS_TO_NUMBER
- PARSE_JSON_NAME
- PAD_FILL_PATTERN_IS_REQUIRED
- WRAP_DERIVED_VALUES
- SUPPORTS_MEDIAN
- UNSIGNED_TYPE_MAPPING
- TIMESTAMP_TYPE_MAPPING
- LIMIT_FETCH
- LIMIT_ONLY_LITERALS
- CHAR_CAST_MAPPING
- SIGNED_CAST_MAPPING
- computedcolumnconstraint_sql
- array_sql
- arraycontainsall_sql
- dpipe_sql
- extract_sql
- datatype_sql
- jsonarraycontains_sql
- cast_sql
- show_sql
- altercolumn_sql
- chr_sql
- timestamptrunc_sql
- converttimezone_sql
- attimezone_sql
- isascii_sql
- currentschema_sql