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 "L2_DISTANCE": exp.EuclideanDistance.from_arg_list, 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 UPDATE_STATEMENT_SUPPORTS_FROM = True 182 183 TYPE_MAPPING = { 184 **MySQL.Generator.TYPE_MAPPING, 185 exp.DataType.Type.TEXT: "STRING", 186 exp.DataType.Type.TIMESTAMP: "DATETIME", 187 exp.DataType.Type.TIMESTAMPTZ: "DATETIME", 188 } 189 190 PROPERTIES_LOCATION = { 191 **MySQL.Generator.PROPERTIES_LOCATION, 192 exp.UniqueKeyProperty: exp.Properties.Location.POST_SCHEMA, 193 exp.PartitionByRangeProperty: exp.Properties.Location.POST_SCHEMA, 194 exp.PartitionByListProperty: exp.Properties.Location.POST_SCHEMA, 195 exp.PartitionedByProperty: exp.Properties.Location.POST_SCHEMA, 196 exp.BuildProperty: exp.Properties.Location.POST_SCHEMA, 197 exp.RefreshTriggerProperty: exp.Properties.Location.POST_SCHEMA, 198 } 199 200 CAST_MAPPING = {} 201 TIMESTAMP_FUNC_TYPES = set() 202 203 TRANSFORMS = { 204 **MySQL.Generator.TRANSFORMS, 205 exp.AddMonths: rename_func("MONTHS_ADD"), 206 exp.ApproxDistinct: approx_count_distinct_sql, 207 exp.ArgMax: rename_func("MAX_BY"), 208 exp.ArgMin: rename_func("MIN_BY"), 209 exp.ArrayAgg: rename_func("COLLECT_LIST"), 210 exp.ArrayToString: rename_func("ARRAY_JOIN"), 211 exp.ArrayUniqueAgg: rename_func("COLLECT_SET"), 212 exp.CurrentDate: lambda self, _: self.func("CURRENT_DATE"), 213 exp.CurrentTimestamp: lambda self, _: self.func("NOW"), 214 exp.DateTrunc: lambda self, e: self.func("DATE_TRUNC", e.this, unit_to_str(e)), 215 exp.EuclideanDistance: rename_func("L2_DISTANCE"), 216 exp.GroupConcat: lambda self, e: self.func( 217 "GROUP_CONCAT", e.this, e.args.get("separator") or exp.Literal.string(",") 218 ), 219 exp.JSONExtractScalar: lambda self, e: self.func("JSON_EXTRACT", e.this, e.expression), 220 exp.Lag: _lag_lead_sql, 221 exp.Lead: _lag_lead_sql, 222 exp.Map: rename_func("ARRAY_MAP"), 223 exp.Property: property_sql, 224 exp.RegexpLike: rename_func("REGEXP"), 225 exp.RegexpSplit: rename_func("SPLIT_BY_STRING"), 226 exp.SchemaCommentProperty: lambda self, e: self.naked_property(e), 227 exp.Split: rename_func("SPLIT_BY_STRING"), 228 exp.StringToArray: rename_func("SPLIT_BY_STRING"), 229 exp.StrToUnix: lambda self, e: self.func("UNIX_TIMESTAMP", e.this, self.format_time(e)), 230 exp.TimeStrToDate: rename_func("TO_DATE"), 231 exp.TsOrDsAdd: lambda self, e: self.func("DATE_ADD", e.this, e.expression), 232 exp.TsOrDsToDate: lambda self, e: self.func("TO_DATE", e.this), 233 exp.TimeToUnix: rename_func("UNIX_TIMESTAMP"), 234 exp.TimestampTrunc: lambda self, e: self.func("DATE_TRUNC", e.this, unit_to_str(e)), 235 exp.UnixToStr: lambda self, e: self.func( 236 "FROM_UNIXTIME", e.this, time_format("doris")(self, e) 237 ), 238 exp.UnixToTime: rename_func("FROM_UNIXTIME"), 239 } 240 241 # https://github.com/apache/doris/blob/e4f41dbf1ec03f5937fdeba2ee1454a20254015b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisLexer.g4#L93 242 RESERVED_KEYWORDS = { 243 "account_lock", 244 "account_unlock", 245 "add", 246 "adddate", 247 "admin", 248 "after", 249 "agg_state", 250 "aggregate", 251 "alias", 252 "all", 253 "alter", 254 "analyze", 255 "analyzed", 256 "and", 257 "anti", 258 "append", 259 "array", 260 "array_range", 261 "as", 262 "asc", 263 "at", 264 "authors", 265 "auto", 266 "auto_increment", 267 "backend", 268 "backends", 269 "backup", 270 "begin", 271 "belong", 272 "between", 273 "bigint", 274 "bin", 275 "binary", 276 "binlog", 277 "bitand", 278 "bitmap", 279 "bitmap_union", 280 "bitor", 281 "bitxor", 282 "blob", 283 "boolean", 284 "brief", 285 "broker", 286 "buckets", 287 "build", 288 "builtin", 289 "bulk", 290 "by", 291 "cached", 292 "call", 293 "cancel", 294 "case", 295 "cast", 296 "catalog", 297 "catalogs", 298 "chain", 299 "char", 300 "character", 301 "charset", 302 "check", 303 "clean", 304 "cluster", 305 "clusters", 306 "collate", 307 "collation", 308 "collect", 309 "column", 310 "columns", 311 "comment", 312 "commit", 313 "committed", 314 "compact", 315 "complete", 316 "config", 317 "connection", 318 "connection_id", 319 "consistent", 320 "constraint", 321 "constraints", 322 "convert", 323 "copy", 324 "count", 325 "create", 326 "creation", 327 "cron", 328 "cross", 329 "cube", 330 "current", 331 "current_catalog", 332 "current_date", 333 "current_time", 334 "current_timestamp", 335 "current_user", 336 "data", 337 "database", 338 "databases", 339 "date", 340 "date_add", 341 "date_ceil", 342 "date_diff", 343 "date_floor", 344 "date_sub", 345 "dateadd", 346 "datediff", 347 "datetime", 348 "datetimev2", 349 "datev2", 350 "datetimev1", 351 "datev1", 352 "day", 353 "days_add", 354 "days_sub", 355 "decimal", 356 "decimalv2", 357 "decimalv3", 358 "decommission", 359 "default", 360 "deferred", 361 "delete", 362 "demand", 363 "desc", 364 "describe", 365 "diagnose", 366 "disk", 367 "distinct", 368 "distinctpc", 369 "distinctpcsa", 370 "distributed", 371 "distribution", 372 "div", 373 "do", 374 "doris_internal_table_id", 375 "double", 376 "drop", 377 "dropp", 378 "dual", 379 "duplicate", 380 "dynamic", 381 "else", 382 "enable", 383 "encryptkey", 384 "encryptkeys", 385 "end", 386 "ends", 387 "engine", 388 "engines", 389 "enter", 390 "errors", 391 "events", 392 "every", 393 "except", 394 "exclude", 395 "execute", 396 "exists", 397 "expired", 398 "explain", 399 "export", 400 "extended", 401 "external", 402 "extract", 403 "failed_login_attempts", 404 "false", 405 "fast", 406 "feature", 407 "fields", 408 "file", 409 "filter", 410 "first", 411 "float", 412 "follower", 413 "following", 414 "for", 415 "foreign", 416 "force", 417 "format", 418 "free", 419 "from", 420 "frontend", 421 "frontends", 422 "full", 423 "function", 424 "functions", 425 "generic", 426 "global", 427 "grant", 428 "grants", 429 "graph", 430 "group", 431 "grouping", 432 "groups", 433 "hash", 434 "having", 435 "hdfs", 436 "help", 437 "histogram", 438 "hll", 439 "hll_union", 440 "hostname", 441 "hour", 442 "hub", 443 "identified", 444 "if", 445 "ignore", 446 "immediate", 447 "in", 448 "incremental", 449 "index", 450 "indexes", 451 "infile", 452 "inner", 453 "insert", 454 "install", 455 "int", 456 "integer", 457 "intermediate", 458 "intersect", 459 "interval", 460 "into", 461 "inverted", 462 "ipv4", 463 "ipv6", 464 "is", 465 "is_not_null_pred", 466 "is_null_pred", 467 "isnull", 468 "isolation", 469 "job", 470 "jobs", 471 "join", 472 "json", 473 "jsonb", 474 "key", 475 "keys", 476 "kill", 477 "label", 478 "largeint", 479 "last", 480 "lateral", 481 "ldap", 482 "ldap_admin_password", 483 "left", 484 "less", 485 "level", 486 "like", 487 "limit", 488 "lines", 489 "link", 490 "list", 491 "load", 492 "local", 493 "localtime", 494 "localtimestamp", 495 "location", 496 "lock", 497 "logical", 498 "low_priority", 499 "manual", 500 "map", 501 "match", 502 "match_all", 503 "match_any", 504 "match_phrase", 505 "match_phrase_edge", 506 "match_phrase_prefix", 507 "match_regexp", 508 "materialized", 509 "max", 510 "maxvalue", 511 "memo", 512 "merge", 513 "migrate", 514 "migrations", 515 "min", 516 "minus", 517 "minute", 518 "modify", 519 "month", 520 "mtmv", 521 "name", 522 "names", 523 "natural", 524 "negative", 525 "never", 526 "next", 527 "ngram_bf", 528 "no", 529 "non_nullable", 530 "not", 531 "null", 532 "nulls", 533 "observer", 534 "of", 535 "offset", 536 "on", 537 "only", 538 "open", 539 "optimized", 540 "or", 541 "order", 542 "outer", 543 "outfile", 544 "over", 545 "overwrite", 546 "parameter", 547 "parsed", 548 "partition", 549 "partitions", 550 "password", 551 "password_expire", 552 "password_history", 553 "password_lock_time", 554 "password_reuse", 555 "path", 556 "pause", 557 "percent", 558 "period", 559 "permissive", 560 "physical", 561 "plan", 562 "process", 563 "plugin", 564 "plugins", 565 "policy", 566 "preceding", 567 "prepare", 568 "primary", 569 "proc", 570 "procedure", 571 "processlist", 572 "profile", 573 "properties", 574 "property", 575 "quantile_state", 576 "quantile_union", 577 "query", 578 "quota", 579 "random", 580 "range", 581 "read", 582 "real", 583 "rebalance", 584 "recover", 585 "recycle", 586 "refresh", 587 "references", 588 "regexp", 589 "release", 590 "rename", 591 "repair", 592 "repeatable", 593 "replace", 594 "replace_if_not_null", 595 "replica", 596 "repositories", 597 "repository", 598 "resource", 599 "resources", 600 "restore", 601 "restrictive", 602 "resume", 603 "returns", 604 "revoke", 605 "rewritten", 606 "right", 607 "rlike", 608 "role", 609 "roles", 610 "rollback", 611 "rollup", 612 "routine", 613 "row", 614 "rows", 615 "s3", 616 "sample", 617 "schedule", 618 "scheduler", 619 "schema", 620 "schemas", 621 "second", 622 "select", 623 "semi", 624 "sequence", 625 "serializable", 626 "session", 627 "set", 628 "sets", 629 "shape", 630 "show", 631 "signed", 632 "skew", 633 "smallint", 634 "snapshot", 635 "soname", 636 "split", 637 "sql_block_rule", 638 "start", 639 "starts", 640 "stats", 641 "status", 642 "stop", 643 "storage", 644 "stream", 645 "streaming", 646 "string", 647 "struct", 648 "subdate", 649 "sum", 650 "superuser", 651 "switch", 652 "sync", 653 "system", 654 "table", 655 "tables", 656 "tablesample", 657 "tablet", 658 "tablets", 659 "task", 660 "tasks", 661 "temporary", 662 "terminated", 663 "text", 664 "than", 665 "then", 666 "time", 667 "timestamp", 668 "timestampadd", 669 "timestampdiff", 670 "tinyint", 671 "to", 672 "transaction", 673 "trash", 674 "tree", 675 "triggers", 676 "trim", 677 "true", 678 "truncate", 679 "type", 680 "type_cast", 681 "types", 682 "unbounded", 683 "uncommitted", 684 "uninstall", 685 "union", 686 "unique", 687 "unlock", 688 "unsigned", 689 "update", 690 "use", 691 "user", 692 "using", 693 "value", 694 "values", 695 "varchar", 696 "variables", 697 "variant", 698 "vault", 699 "verbose", 700 "version", 701 "view", 702 "warnings", 703 "week", 704 "when", 705 "where", 706 "whitelist", 707 "with", 708 "work", 709 "workload", 710 "write", 711 "xor", 712 "year", 713 } 714 715 def uniquekeyproperty_sql( 716 self, expression: exp.UniqueKeyProperty, prefix: str = "UNIQUE KEY" 717 ) -> str: 718 create_stmt = expression.find_ancestor(exp.Create) 719 if create_stmt and create_stmt.args["properties"].find(exp.MaterializedProperty): 720 return super().uniquekeyproperty_sql(expression, prefix="KEY") 721 722 return super().uniquekeyproperty_sql(expression) 723 724 def partition_sql(self, expression: exp.Partition) -> str: 725 parent = expression.parent 726 if isinstance(parent, (exp.PartitionByRangeProperty, exp.PartitionByListProperty)): 727 return ", ".join(self.sql(e) for e in expression.expressions) 728 return super().partition_sql(expression) 729 730 def partitionrange_sql(self, expression: exp.PartitionRange) -> str: 731 name = self.sql(expression, "this") 732 values = expression.expressions 733 734 if len(values) != 1: 735 # Multiple values: use VALUES [ ... ) 736 if values and isinstance(values[0], list): 737 values_sql = ", ".join( 738 f"({', '.join(self.sql(v) for v in inner)})" for inner in values 739 ) 740 else: 741 values_sql = ", ".join(f"({self.sql(v)})" for v in values) 742 743 return f"PARTITION {name} VALUES [{values_sql})" 744 745 return f"PARTITION {name} VALUES LESS THAN ({self.sql(values[0])})" 746 747 def partitionbyrangepropertydynamic_sql( 748 self, expression: exp.PartitionByRangePropertyDynamic 749 ) -> str: 750 # Generates: FROM ("start") TO ("end") INTERVAL N UNIT 751 start = self.sql(expression, "start") 752 end = self.sql(expression, "end") 753 every = expression.args.get("every") 754 755 if every: 756 number = self.sql(every, "this") 757 interval = f"INTERVAL {number} {self.sql(every, 'unit')}" 758 else: 759 interval = "" 760 761 return f"FROM ({start}) TO ({end}) {interval}" 762 763 def partitionbyrangeproperty_sql(self, expression: exp.PartitionByRangeProperty) -> str: 764 partition_expressions = self.expressions( 765 expression, key="partition_expressions", indent=False 766 ) 767 create_sql = self.expressions(expression, key="create_expressions", indent=False) 768 return f"PARTITION BY RANGE ({partition_expressions}) ({create_sql})" 769 770 def partitionbylistproperty_sql(self, expression: exp.PartitionByListProperty) -> str: 771 partition_expressions = self.expressions( 772 expression, key="partition_expressions", indent=False 773 ) 774 create_sql = self.expressions(expression, key="create_expressions", indent=False) 775 return f"PARTITION BY LIST ({partition_expressions}) ({create_sql})" 776 777 def partitionlist_sql(self, expression: exp.PartitionList) -> str: 778 name = self.sql(expression, "this") 779 values = self.expressions(expression, indent=False) 780 return f"PARTITION {name} VALUES IN ({values})" 781 782 def partitionedbyproperty_sql(self, expression: exp.PartitionedByProperty) -> str: 783 node = expression.this 784 if isinstance(node, exp.Schema): 785 parts = ", ".join(self.sql(e) for e in node.expressions) 786 return f"PARTITION BY ({parts})" 787 return f"PARTITION BY ({self.sql(node)})" 788 789 def table_sql(self, expression: exp.Table, sep: str = " AS ") -> str: 790 """Override table_sql to avoid AS keyword in UPDATE and DELETE statements.""" 791 ancestor = expression.find_ancestor(exp.Update, exp.Delete, exp.Select) 792 if not isinstance(ancestor, exp.Select): 793 sep = " " 794 return super().table_sql(expression, sep=sep) 795 796 def alterrename_sql(self, expression: exp.AlterRename, include_to: bool = True) -> str: 797 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 "L2_DISTANCE": exp.EuclideanDistance.from_arg_list, 55 "MONTHS_ADD": exp.AddMonths.from_arg_list, 56 "REGEXP": exp.RegexpLike.from_arg_list, 57 "TO_DATE": exp.TsOrDsToDate.from_arg_list, 58 } 59 60 FUNCTION_PARSERS = MySQL.Parser.FUNCTION_PARSERS.copy() 61 FUNCTION_PARSERS.pop("GROUP_CONCAT") 62 63 NO_PAREN_FUNCTIONS = MySQL.Parser.NO_PAREN_FUNCTIONS.copy() 64 NO_PAREN_FUNCTIONS.pop(TokenType.CURRENT_DATE) 65 66 PROPERTY_PARSERS = { 67 **MySQL.Parser.PROPERTY_PARSERS, 68 "PROPERTIES": lambda self: self._parse_wrapped_properties(), 69 "UNIQUE": lambda self: self._parse_composite_key_property(exp.UniqueKeyProperty), 70 # Plain KEY without UNIQUE/DUPLICATE/AGGREGATE prefixes should be treated as UniqueKeyProperty with unique=False 71 "KEY": lambda self: self._parse_composite_key_property(exp.UniqueKeyProperty), 72 "PARTITION BY": lambda self: self._parse_partition_by_opt_range(), 73 "BUILD": lambda self: self._parse_build_property(), 74 "REFRESH": lambda self: self._parse_refresh_property(), 75 } 76 77 def _parse_partitioning_granularity_dynamic(self) -> exp.PartitionByRangePropertyDynamic: 78 self._match_text_seq("FROM") 79 start = self._parse_wrapped(self._parse_string) 80 self._match_text_seq("TO") 81 end = self._parse_wrapped(self._parse_string) 82 self._match_text_seq("INTERVAL") 83 number = self._parse_number() 84 unit = self._parse_var(any_token=True) 85 every = self.expression(exp.Interval, this=number, unit=unit) 86 return self.expression( 87 exp.PartitionByRangePropertyDynamic, start=start, end=end, every=every 88 ) 89 90 def _parse_partition_definition(self) -> exp.Partition: 91 self._match_text_seq("PARTITION") 92 93 name = self._parse_id_var() 94 self._match_text_seq("VALUES") 95 96 if self._match_text_seq("LESS", "THAN"): 97 values = self._parse_wrapped_csv(self._parse_expression) 98 if len(values) == 1 and values[0].name.upper() == "MAXVALUE": 99 values = [exp.var("MAXVALUE")] 100 101 part_range = self.expression(exp.PartitionRange, this=name, expressions=values) 102 return self.expression(exp.Partition, expressions=[part_range]) 103 104 self._match(TokenType.L_BRACKET) 105 values = self._parse_csv(lambda: self._parse_wrapped_csv(self._parse_expression)) 106 107 self._match(TokenType.R_BRACKET) 108 self._match(TokenType.R_PAREN) 109 110 part_range = self.expression(exp.PartitionRange, this=name, expressions=values) 111 return self.expression(exp.Partition, expressions=[part_range]) 112 113 def _parse_partition_definition_list(self) -> exp.Partition: 114 # PARTITION <name> VALUES IN (<value_csv>) 115 self._match_text_seq("PARTITION") 116 name = self._parse_id_var() 117 self._match_text_seq("VALUES", "IN") 118 values = self._parse_wrapped_csv(self._parse_expression) 119 part_list = self.expression(exp.PartitionList, this=name, expressions=values) 120 return self.expression(exp.Partition, expressions=[part_list]) 121 122 def _parse_partition_by_opt_range( 123 self, 124 ) -> exp.PartitionedByProperty | exp.PartitionByRangeProperty | exp.PartitionByListProperty: 125 if self._match_text_seq("LIST"): 126 return self.expression( 127 exp.PartitionByListProperty, 128 partition_expressions=self._parse_wrapped_id_vars(), 129 create_expressions=self._parse_wrapped_csv( 130 self._parse_partition_definition_list 131 ), 132 ) 133 134 if not self._match_text_seq("RANGE"): 135 return super()._parse_partitioned_by() 136 137 partition_expressions = self._parse_wrapped_id_vars() 138 self._match_l_paren() 139 140 if self._match_text_seq("FROM", advance=False): 141 create_expressions = self._parse_csv(self._parse_partitioning_granularity_dynamic) 142 elif self._match_text_seq("PARTITION", advance=False): 143 create_expressions = self._parse_csv(self._parse_partition_definition) 144 else: 145 create_expressions = None 146 147 self._match_r_paren() 148 149 return self.expression( 150 exp.PartitionByRangeProperty, 151 partition_expressions=partition_expressions, 152 create_expressions=create_expressions, 153 ) 154 155 def _parse_build_property(self) -> exp.BuildProperty: 156 return self.expression(exp.BuildProperty, this=self._parse_var(upper=True)) 157 158 def _parse_refresh_property(self) -> exp.RefreshTriggerProperty: 159 method = self._parse_var(upper=True) 160 161 self._match(TokenType.ON) 162 163 kind = self._match_texts(("MANUAL", "COMMIT", "SCHEDULE")) and self._prev.text.upper() 164 every = self._match_text_seq("EVERY") and self._parse_number() 165 unit = self._parse_var(any_token=True) if every else None 166 starts = self._match_text_seq("STARTS") and self._parse_string() 167 168 return self.expression( 169 exp.RefreshTriggerProperty, 170 method=method, 171 kind=kind, 172 every=every, 173 unit=unit, 174 starts=starts, 175 ) 176 177 class Generator(MySQL.Generator): 178 LAST_DAY_SUPPORTS_DATE_PART = False 179 VARCHAR_REQUIRES_SIZE = False 180 WITH_PROPERTIES_PREFIX = "PROPERTIES" 181 RENAME_TABLE_WITH_DB = False 182 UPDATE_STATEMENT_SUPPORTS_FROM = True 183 184 TYPE_MAPPING = { 185 **MySQL.Generator.TYPE_MAPPING, 186 exp.DataType.Type.TEXT: "STRING", 187 exp.DataType.Type.TIMESTAMP: "DATETIME", 188 exp.DataType.Type.TIMESTAMPTZ: "DATETIME", 189 } 190 191 PROPERTIES_LOCATION = { 192 **MySQL.Generator.PROPERTIES_LOCATION, 193 exp.UniqueKeyProperty: exp.Properties.Location.POST_SCHEMA, 194 exp.PartitionByRangeProperty: exp.Properties.Location.POST_SCHEMA, 195 exp.PartitionByListProperty: exp.Properties.Location.POST_SCHEMA, 196 exp.PartitionedByProperty: exp.Properties.Location.POST_SCHEMA, 197 exp.BuildProperty: exp.Properties.Location.POST_SCHEMA, 198 exp.RefreshTriggerProperty: exp.Properties.Location.POST_SCHEMA, 199 } 200 201 CAST_MAPPING = {} 202 TIMESTAMP_FUNC_TYPES = set() 203 204 TRANSFORMS = { 205 **MySQL.Generator.TRANSFORMS, 206 exp.AddMonths: rename_func("MONTHS_ADD"), 207 exp.ApproxDistinct: approx_count_distinct_sql, 208 exp.ArgMax: rename_func("MAX_BY"), 209 exp.ArgMin: rename_func("MIN_BY"), 210 exp.ArrayAgg: rename_func("COLLECT_LIST"), 211 exp.ArrayToString: rename_func("ARRAY_JOIN"), 212 exp.ArrayUniqueAgg: rename_func("COLLECT_SET"), 213 exp.CurrentDate: lambda self, _: self.func("CURRENT_DATE"), 214 exp.CurrentTimestamp: lambda self, _: self.func("NOW"), 215 exp.DateTrunc: lambda self, e: self.func("DATE_TRUNC", e.this, unit_to_str(e)), 216 exp.EuclideanDistance: rename_func("L2_DISTANCE"), 217 exp.GroupConcat: lambda self, e: self.func( 218 "GROUP_CONCAT", e.this, e.args.get("separator") or exp.Literal.string(",") 219 ), 220 exp.JSONExtractScalar: lambda self, e: self.func("JSON_EXTRACT", e.this, e.expression), 221 exp.Lag: _lag_lead_sql, 222 exp.Lead: _lag_lead_sql, 223 exp.Map: rename_func("ARRAY_MAP"), 224 exp.Property: property_sql, 225 exp.RegexpLike: rename_func("REGEXP"), 226 exp.RegexpSplit: rename_func("SPLIT_BY_STRING"), 227 exp.SchemaCommentProperty: lambda self, e: self.naked_property(e), 228 exp.Split: rename_func("SPLIT_BY_STRING"), 229 exp.StringToArray: rename_func("SPLIT_BY_STRING"), 230 exp.StrToUnix: lambda self, e: self.func("UNIX_TIMESTAMP", e.this, self.format_time(e)), 231 exp.TimeStrToDate: rename_func("TO_DATE"), 232 exp.TsOrDsAdd: lambda self, e: self.func("DATE_ADD", e.this, e.expression), 233 exp.TsOrDsToDate: lambda self, e: self.func("TO_DATE", e.this), 234 exp.TimeToUnix: rename_func("UNIX_TIMESTAMP"), 235 exp.TimestampTrunc: lambda self, e: self.func("DATE_TRUNC", e.this, unit_to_str(e)), 236 exp.UnixToStr: lambda self, e: self.func( 237 "FROM_UNIXTIME", e.this, time_format("doris")(self, e) 238 ), 239 exp.UnixToTime: rename_func("FROM_UNIXTIME"), 240 } 241 242 # https://github.com/apache/doris/blob/e4f41dbf1ec03f5937fdeba2ee1454a20254015b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisLexer.g4#L93 243 RESERVED_KEYWORDS = { 244 "account_lock", 245 "account_unlock", 246 "add", 247 "adddate", 248 "admin", 249 "after", 250 "agg_state", 251 "aggregate", 252 "alias", 253 "all", 254 "alter", 255 "analyze", 256 "analyzed", 257 "and", 258 "anti", 259 "append", 260 "array", 261 "array_range", 262 "as", 263 "asc", 264 "at", 265 "authors", 266 "auto", 267 "auto_increment", 268 "backend", 269 "backends", 270 "backup", 271 "begin", 272 "belong", 273 "between", 274 "bigint", 275 "bin", 276 "binary", 277 "binlog", 278 "bitand", 279 "bitmap", 280 "bitmap_union", 281 "bitor", 282 "bitxor", 283 "blob", 284 "boolean", 285 "brief", 286 "broker", 287 "buckets", 288 "build", 289 "builtin", 290 "bulk", 291 "by", 292 "cached", 293 "call", 294 "cancel", 295 "case", 296 "cast", 297 "catalog", 298 "catalogs", 299 "chain", 300 "char", 301 "character", 302 "charset", 303 "check", 304 "clean", 305 "cluster", 306 "clusters", 307 "collate", 308 "collation", 309 "collect", 310 "column", 311 "columns", 312 "comment", 313 "commit", 314 "committed", 315 "compact", 316 "complete", 317 "config", 318 "connection", 319 "connection_id", 320 "consistent", 321 "constraint", 322 "constraints", 323 "convert", 324 "copy", 325 "count", 326 "create", 327 "creation", 328 "cron", 329 "cross", 330 "cube", 331 "current", 332 "current_catalog", 333 "current_date", 334 "current_time", 335 "current_timestamp", 336 "current_user", 337 "data", 338 "database", 339 "databases", 340 "date", 341 "date_add", 342 "date_ceil", 343 "date_diff", 344 "date_floor", 345 "date_sub", 346 "dateadd", 347 "datediff", 348 "datetime", 349 "datetimev2", 350 "datev2", 351 "datetimev1", 352 "datev1", 353 "day", 354 "days_add", 355 "days_sub", 356 "decimal", 357 "decimalv2", 358 "decimalv3", 359 "decommission", 360 "default", 361 "deferred", 362 "delete", 363 "demand", 364 "desc", 365 "describe", 366 "diagnose", 367 "disk", 368 "distinct", 369 "distinctpc", 370 "distinctpcsa", 371 "distributed", 372 "distribution", 373 "div", 374 "do", 375 "doris_internal_table_id", 376 "double", 377 "drop", 378 "dropp", 379 "dual", 380 "duplicate", 381 "dynamic", 382 "else", 383 "enable", 384 "encryptkey", 385 "encryptkeys", 386 "end", 387 "ends", 388 "engine", 389 "engines", 390 "enter", 391 "errors", 392 "events", 393 "every", 394 "except", 395 "exclude", 396 "execute", 397 "exists", 398 "expired", 399 "explain", 400 "export", 401 "extended", 402 "external", 403 "extract", 404 "failed_login_attempts", 405 "false", 406 "fast", 407 "feature", 408 "fields", 409 "file", 410 "filter", 411 "first", 412 "float", 413 "follower", 414 "following", 415 "for", 416 "foreign", 417 "force", 418 "format", 419 "free", 420 "from", 421 "frontend", 422 "frontends", 423 "full", 424 "function", 425 "functions", 426 "generic", 427 "global", 428 "grant", 429 "grants", 430 "graph", 431 "group", 432 "grouping", 433 "groups", 434 "hash", 435 "having", 436 "hdfs", 437 "help", 438 "histogram", 439 "hll", 440 "hll_union", 441 "hostname", 442 "hour", 443 "hub", 444 "identified", 445 "if", 446 "ignore", 447 "immediate", 448 "in", 449 "incremental", 450 "index", 451 "indexes", 452 "infile", 453 "inner", 454 "insert", 455 "install", 456 "int", 457 "integer", 458 "intermediate", 459 "intersect", 460 "interval", 461 "into", 462 "inverted", 463 "ipv4", 464 "ipv6", 465 "is", 466 "is_not_null_pred", 467 "is_null_pred", 468 "isnull", 469 "isolation", 470 "job", 471 "jobs", 472 "join", 473 "json", 474 "jsonb", 475 "key", 476 "keys", 477 "kill", 478 "label", 479 "largeint", 480 "last", 481 "lateral", 482 "ldap", 483 "ldap_admin_password", 484 "left", 485 "less", 486 "level", 487 "like", 488 "limit", 489 "lines", 490 "link", 491 "list", 492 "load", 493 "local", 494 "localtime", 495 "localtimestamp", 496 "location", 497 "lock", 498 "logical", 499 "low_priority", 500 "manual", 501 "map", 502 "match", 503 "match_all", 504 "match_any", 505 "match_phrase", 506 "match_phrase_edge", 507 "match_phrase_prefix", 508 "match_regexp", 509 "materialized", 510 "max", 511 "maxvalue", 512 "memo", 513 "merge", 514 "migrate", 515 "migrations", 516 "min", 517 "minus", 518 "minute", 519 "modify", 520 "month", 521 "mtmv", 522 "name", 523 "names", 524 "natural", 525 "negative", 526 "never", 527 "next", 528 "ngram_bf", 529 "no", 530 "non_nullable", 531 "not", 532 "null", 533 "nulls", 534 "observer", 535 "of", 536 "offset", 537 "on", 538 "only", 539 "open", 540 "optimized", 541 "or", 542 "order", 543 "outer", 544 "outfile", 545 "over", 546 "overwrite", 547 "parameter", 548 "parsed", 549 "partition", 550 "partitions", 551 "password", 552 "password_expire", 553 "password_history", 554 "password_lock_time", 555 "password_reuse", 556 "path", 557 "pause", 558 "percent", 559 "period", 560 "permissive", 561 "physical", 562 "plan", 563 "process", 564 "plugin", 565 "plugins", 566 "policy", 567 "preceding", 568 "prepare", 569 "primary", 570 "proc", 571 "procedure", 572 "processlist", 573 "profile", 574 "properties", 575 "property", 576 "quantile_state", 577 "quantile_union", 578 "query", 579 "quota", 580 "random", 581 "range", 582 "read", 583 "real", 584 "rebalance", 585 "recover", 586 "recycle", 587 "refresh", 588 "references", 589 "regexp", 590 "release", 591 "rename", 592 "repair", 593 "repeatable", 594 "replace", 595 "replace_if_not_null", 596 "replica", 597 "repositories", 598 "repository", 599 "resource", 600 "resources", 601 "restore", 602 "restrictive", 603 "resume", 604 "returns", 605 "revoke", 606 "rewritten", 607 "right", 608 "rlike", 609 "role", 610 "roles", 611 "rollback", 612 "rollup", 613 "routine", 614 "row", 615 "rows", 616 "s3", 617 "sample", 618 "schedule", 619 "scheduler", 620 "schema", 621 "schemas", 622 "second", 623 "select", 624 "semi", 625 "sequence", 626 "serializable", 627 "session", 628 "set", 629 "sets", 630 "shape", 631 "show", 632 "signed", 633 "skew", 634 "smallint", 635 "snapshot", 636 "soname", 637 "split", 638 "sql_block_rule", 639 "start", 640 "starts", 641 "stats", 642 "status", 643 "stop", 644 "storage", 645 "stream", 646 "streaming", 647 "string", 648 "struct", 649 "subdate", 650 "sum", 651 "superuser", 652 "switch", 653 "sync", 654 "system", 655 "table", 656 "tables", 657 "tablesample", 658 "tablet", 659 "tablets", 660 "task", 661 "tasks", 662 "temporary", 663 "terminated", 664 "text", 665 "than", 666 "then", 667 "time", 668 "timestamp", 669 "timestampadd", 670 "timestampdiff", 671 "tinyint", 672 "to", 673 "transaction", 674 "trash", 675 "tree", 676 "triggers", 677 "trim", 678 "true", 679 "truncate", 680 "type", 681 "type_cast", 682 "types", 683 "unbounded", 684 "uncommitted", 685 "uninstall", 686 "union", 687 "unique", 688 "unlock", 689 "unsigned", 690 "update", 691 "use", 692 "user", 693 "using", 694 "value", 695 "values", 696 "varchar", 697 "variables", 698 "variant", 699 "vault", 700 "verbose", 701 "version", 702 "view", 703 "warnings", 704 "week", 705 "when", 706 "where", 707 "whitelist", 708 "with", 709 "work", 710 "workload", 711 "write", 712 "xor", 713 "year", 714 } 715 716 def uniquekeyproperty_sql( 717 self, expression: exp.UniqueKeyProperty, prefix: str = "UNIQUE KEY" 718 ) -> str: 719 create_stmt = expression.find_ancestor(exp.Create) 720 if create_stmt and create_stmt.args["properties"].find(exp.MaterializedProperty): 721 return super().uniquekeyproperty_sql(expression, prefix="KEY") 722 723 return super().uniquekeyproperty_sql(expression) 724 725 def partition_sql(self, expression: exp.Partition) -> str: 726 parent = expression.parent 727 if isinstance(parent, (exp.PartitionByRangeProperty, exp.PartitionByListProperty)): 728 return ", ".join(self.sql(e) for e in expression.expressions) 729 return super().partition_sql(expression) 730 731 def partitionrange_sql(self, expression: exp.PartitionRange) -> str: 732 name = self.sql(expression, "this") 733 values = expression.expressions 734 735 if len(values) != 1: 736 # Multiple values: use VALUES [ ... ) 737 if values and isinstance(values[0], list): 738 values_sql = ", ".join( 739 f"({', '.join(self.sql(v) for v in inner)})" for inner in values 740 ) 741 else: 742 values_sql = ", ".join(f"({self.sql(v)})" for v in values) 743 744 return f"PARTITION {name} VALUES [{values_sql})" 745 746 return f"PARTITION {name} VALUES LESS THAN ({self.sql(values[0])})" 747 748 def partitionbyrangepropertydynamic_sql( 749 self, expression: exp.PartitionByRangePropertyDynamic 750 ) -> str: 751 # Generates: FROM ("start") TO ("end") INTERVAL N UNIT 752 start = self.sql(expression, "start") 753 end = self.sql(expression, "end") 754 every = expression.args.get("every") 755 756 if every: 757 number = self.sql(every, "this") 758 interval = f"INTERVAL {number} {self.sql(every, 'unit')}" 759 else: 760 interval = "" 761 762 return f"FROM ({start}) TO ({end}) {interval}" 763 764 def partitionbyrangeproperty_sql(self, expression: exp.PartitionByRangeProperty) -> str: 765 partition_expressions = self.expressions( 766 expression, key="partition_expressions", indent=False 767 ) 768 create_sql = self.expressions(expression, key="create_expressions", indent=False) 769 return f"PARTITION BY RANGE ({partition_expressions}) ({create_sql})" 770 771 def partitionbylistproperty_sql(self, expression: exp.PartitionByListProperty) -> str: 772 partition_expressions = self.expressions( 773 expression, key="partition_expressions", indent=False 774 ) 775 create_sql = self.expressions(expression, key="create_expressions", indent=False) 776 return f"PARTITION BY LIST ({partition_expressions}) ({create_sql})" 777 778 def partitionlist_sql(self, expression: exp.PartitionList) -> str: 779 name = self.sql(expression, "this") 780 values = self.expressions(expression, indent=False) 781 return f"PARTITION {name} VALUES IN ({values})" 782 783 def partitionedbyproperty_sql(self, expression: exp.PartitionedByProperty) -> str: 784 node = expression.this 785 if isinstance(node, exp.Schema): 786 parts = ", ".join(self.sql(e) for e in node.expressions) 787 return f"PARTITION BY ({parts})" 788 return f"PARTITION BY ({self.sql(node)})" 789 790 def table_sql(self, expression: exp.Table, sep: str = " AS ") -> str: 791 """Override table_sql to avoid AS keyword in UPDATE and DELETE statements.""" 792 ancestor = expression.find_ancestor(exp.Update, exp.Delete, exp.Select) 793 if not isinstance(ancestor, exp.Select): 794 sep = " " 795 return super().table_sql(expression, sep=sep) 796 797 def alterrename_sql(self, expression: exp.AlterRename, include_to: bool = True) -> str: 798 return super().alterrename_sql(expression, include_to=False)
VALID_INTERVAL_UNITS: Set[str] =
{'MONTH', 'NSEC', 'MICROSEC', 'DAY OF YEAR', 'QTR', 'MSECONDS', 'WK', 'SECONDS', 'EPOCH', 'MINUTE', 'USECS', 'EPOCH_NANOSECONDS', 'NSECONDS', 'YEARS', 'MILLISECOND', 'MILLISECON', 'Y', 'HH', 'EPOCH_MICROSECONDS', 'HOUR_MINUTE', 'MICROSECOND', 'TIMEZONE_HOUR', 'CENTURY', 'HOUR_MICROSECOND', 'CENT', 'WY', 'M', 'MICROSECONDS', 'H', 'MM', 'YR', 'QUARTER', 'YY', 'CENTS', 'YEAR', 'WOY', 'DECADE', 'DOW', 'DAY_SECOND', 'W', 'DOY', 'WEEKDAY', 'DAYS', 'US', 'SEC', 'EPOCH_SECONDS', 'DOW_ISO', 'NS', 'YYYY', 'Q', 'MI', 'MINUTES', 'WEEKOFYEAR', 'NANOSEC', 'DAYOFMONTH', 'S', 'MILLISECS', 'DD', 'HOUR', 'MINUTE_MICROSECOND', 'MINS', 'DEC', 'SECOND', 'YRS', 'MS', 'YEAR_MONTH', 'MILLISECONDS', 'MILLISEC', 'WEEKOFYEARISO', 'SECS', 'MIN', 'WEEK_ISO', 'MONS', 'DY', 'DAYOFWEEKISO', 'EPOCH_NANOSECOND', 'DAYOFWEEK', 'EPOCH_SECOND', 'DAY_MINUTE', 'WEEKISO', 'MIL', 'TIMEZONE_MINUTE', 'MILLENIA', 'NANOSECOND', 'HOUR_SECOND', 'DW', 'DECADES', 'DW_ISO', 'NSECOND', 'DAY', 'DAY OF WEEK', 'MICROSECS', 'QUARTERS', 'MILS', 'USECOND', 'DAY_MICROSECOND', 'HR', 'D', 'MSECOND', 'USEC', 'USECONDS', 'CENTURIES', 'DECS', 'HRS', 'WEEK', 'MONTHS', 'C', 'MILLENNIUM', 'NANOSECS', 'WEEKOFYEAR_ISO', 'MINUTE_SECOND', 'TZH', 'SECOND_MICROSECOND', 'TZM', 'YYY', 'WEEKDAY_ISO', 'EPOCH_MICROSECOND', 'DAYOFWEEK_ISO', 'MSEC', 'DAYOFYEAR', 'HOURS', 'MSECS', 'MON', 'QTRS', 'EPOCH_MILLISECOND', 'EPOCH_MILLISECONDS', 'DAY_HOUR'}
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}}}
ESCAPED_SEQUENCES: Dict[str, str] =
{'\x07': '\\a', '\x08': '\\b', '\x0c': '\\f', '\n': '\\n', '\r': '\\r', '\t': '\\t', '\x0b': '\\v', '\\': '\\\\'}
Inherited Members
- sqlglot.dialects.mysql.MySQL
- PROMOTE_TO_INFERRED_DATETIME_TYPE
- IDENTIFIERS_CAN_START_WITH_DIGIT
- NORMALIZATION_STRATEGY
- DPIPE_IS_STRING_CONCAT
- SUPPORTS_USER_DEFINED_TYPES
- SUPPORTS_SEMI_ANTI_JOIN
- SAFE_DIVISION
- SAFE_TO_ELIMINATE_DOUBLE_NEGATION
- LEAST_GREATEST_IGNORES_NULLS
- EXPRESSION_METADATA
- TIME_MAPPING
- Tokenizer
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 "L2_DISTANCE": exp.EuclideanDistance.from_arg_list, 55 "MONTHS_ADD": exp.AddMonths.from_arg_list, 56 "REGEXP": exp.RegexpLike.from_arg_list, 57 "TO_DATE": exp.TsOrDsToDate.from_arg_list, 58 } 59 60 FUNCTION_PARSERS = MySQL.Parser.FUNCTION_PARSERS.copy() 61 FUNCTION_PARSERS.pop("GROUP_CONCAT") 62 63 NO_PAREN_FUNCTIONS = MySQL.Parser.NO_PAREN_FUNCTIONS.copy() 64 NO_PAREN_FUNCTIONS.pop(TokenType.CURRENT_DATE) 65 66 PROPERTY_PARSERS = { 67 **MySQL.Parser.PROPERTY_PARSERS, 68 "PROPERTIES": lambda self: self._parse_wrapped_properties(), 69 "UNIQUE": lambda self: self._parse_composite_key_property(exp.UniqueKeyProperty), 70 # Plain KEY without UNIQUE/DUPLICATE/AGGREGATE prefixes should be treated as UniqueKeyProperty with unique=False 71 "KEY": lambda self: self._parse_composite_key_property(exp.UniqueKeyProperty), 72 "PARTITION BY": lambda self: self._parse_partition_by_opt_range(), 73 "BUILD": lambda self: self._parse_build_property(), 74 "REFRESH": lambda self: self._parse_refresh_property(), 75 } 76 77 def _parse_partitioning_granularity_dynamic(self) -> exp.PartitionByRangePropertyDynamic: 78 self._match_text_seq("FROM") 79 start = self._parse_wrapped(self._parse_string) 80 self._match_text_seq("TO") 81 end = self._parse_wrapped(self._parse_string) 82 self._match_text_seq("INTERVAL") 83 number = self._parse_number() 84 unit = self._parse_var(any_token=True) 85 every = self.expression(exp.Interval, this=number, unit=unit) 86 return self.expression( 87 exp.PartitionByRangePropertyDynamic, start=start, end=end, every=every 88 ) 89 90 def _parse_partition_definition(self) -> exp.Partition: 91 self._match_text_seq("PARTITION") 92 93 name = self._parse_id_var() 94 self._match_text_seq("VALUES") 95 96 if self._match_text_seq("LESS", "THAN"): 97 values = self._parse_wrapped_csv(self._parse_expression) 98 if len(values) == 1 and values[0].name.upper() == "MAXVALUE": 99 values = [exp.var("MAXVALUE")] 100 101 part_range = self.expression(exp.PartitionRange, this=name, expressions=values) 102 return self.expression(exp.Partition, expressions=[part_range]) 103 104 self._match(TokenType.L_BRACKET) 105 values = self._parse_csv(lambda: self._parse_wrapped_csv(self._parse_expression)) 106 107 self._match(TokenType.R_BRACKET) 108 self._match(TokenType.R_PAREN) 109 110 part_range = self.expression(exp.PartitionRange, this=name, expressions=values) 111 return self.expression(exp.Partition, expressions=[part_range]) 112 113 def _parse_partition_definition_list(self) -> exp.Partition: 114 # PARTITION <name> VALUES IN (<value_csv>) 115 self._match_text_seq("PARTITION") 116 name = self._parse_id_var() 117 self._match_text_seq("VALUES", "IN") 118 values = self._parse_wrapped_csv(self._parse_expression) 119 part_list = self.expression(exp.PartitionList, this=name, expressions=values) 120 return self.expression(exp.Partition, expressions=[part_list]) 121 122 def _parse_partition_by_opt_range( 123 self, 124 ) -> exp.PartitionedByProperty | exp.PartitionByRangeProperty | exp.PartitionByListProperty: 125 if self._match_text_seq("LIST"): 126 return self.expression( 127 exp.PartitionByListProperty, 128 partition_expressions=self._parse_wrapped_id_vars(), 129 create_expressions=self._parse_wrapped_csv( 130 self._parse_partition_definition_list 131 ), 132 ) 133 134 if not self._match_text_seq("RANGE"): 135 return super()._parse_partitioned_by() 136 137 partition_expressions = self._parse_wrapped_id_vars() 138 self._match_l_paren() 139 140 if self._match_text_seq("FROM", advance=False): 141 create_expressions = self._parse_csv(self._parse_partitioning_granularity_dynamic) 142 elif self._match_text_seq("PARTITION", advance=False): 143 create_expressions = self._parse_csv(self._parse_partition_definition) 144 else: 145 create_expressions = None 146 147 self._match_r_paren() 148 149 return self.expression( 150 exp.PartitionByRangeProperty, 151 partition_expressions=partition_expressions, 152 create_expressions=create_expressions, 153 ) 154 155 def _parse_build_property(self) -> exp.BuildProperty: 156 return self.expression(exp.BuildProperty, this=self._parse_var(upper=True)) 157 158 def _parse_refresh_property(self) -> exp.RefreshTriggerProperty: 159 method = self._parse_var(upper=True) 160 161 self._match(TokenType.ON) 162 163 kind = self._match_texts(("MANUAL", "COMMIT", "SCHEDULE")) and self._prev.text.upper() 164 every = self._match_text_seq("EVERY") and self._parse_number() 165 unit = self._parse_var(any_token=True) if every else None 166 starts = self._match_text_seq("STARTS") and self._parse_string() 167 168 return self.expression( 169 exp.RefreshTriggerProperty, 170 method=method, 171 kind=kind, 172 every=every, 173 unit=unit, 174 starts=starts, 175 )
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 =
{'AI_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.AIAgg'>>, 'AI_CLASSIFY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.AIClassify'>>, 'AI_SUMMARIZE_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.AISummarizeAgg'>>, 'ABS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Abs'>>, 'ACOS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Acos'>>, 'ACOSH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Acosh'>>, '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_PERCENTILE_ACCUMULATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxPercentileAccumulate'>>, 'APPROX_PERCENTILE_COMBINE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxPercentileCombine'>>, 'APPROX_PERCENTILE_ESTIMATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxPercentileEstimate'>>, '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_K_ACCUMULATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxTopKAccumulate'>>, 'APPROX_TOP_K_COMBINE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxTopKCombine'>>, 'APPROX_TOP_K_ESTIMATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxTopKEstimate'>>, 'APPROX_TOP_SUM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxTopSum'>>, 'APPROXIMATE_SIMILARITY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproximateSimilarity'>>, 'APPROXIMATE_JACCARD_INDEX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproximateSimilarity'>>, '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_APPEND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayAppend'>>, '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_PREPEND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayPrepend'>>, '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'>>, 'ASIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Asin'>>, 'ASINH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Asinh'>>, 'ATAN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Atan'>>, 'ATAN2': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Atan2'>>, 'ATANH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Atanh'>>, 'AVG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Avg'>>, 'BASE64_DECODE_BINARY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Base64DecodeBinary'>>, 'BASE64_DECODE_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Base64DecodeString'>>, 'BASE64_ENCODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Base64Encode'>>, 'BIT_LENGTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitLength'>>, 'BITMAP_BIT_POSITION': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitmapBitPosition'>>, 'BITMAP_BUCKET_NUMBER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitmapBucketNumber'>>, 'BITMAP_CONSTRUCT_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitmapConstructAgg'>>, 'BITMAP_COUNT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitmapCount'>>, 'BITMAP_OR_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitmapOrAgg'>>, 'BITWISE_AND_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitwiseAndAgg'>>, 'BITWISE_COUNT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitwiseCount'>>, 'BITWISE_OR_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitwiseOrAgg'>>, 'BITWISE_XOR_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitwiseXorAgg'>>, 'BOOLAND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Booland'>>, 'BOOLNOT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Boolnot'>>, 'BOOLOR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Boolor'>>, 'BOOLXOR_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BoolxorAgg'>>, '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'>>, 'CHECK_JSON': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CheckJson'>>, 'CHECK_XML': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CheckXml'>>, 'CHR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Chr'>>, 'CHAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Chr'>>, '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'>>, 'COLLATION': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Collation'>>, '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'>>, 'COMPRESS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Compress'>>, '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'>>, 'COS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Cos'>>, 'COSH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Cosh'>>, 'COSINE_DISTANCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CosineDistance'>>, 'COT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Cot'>>, 'COTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Coth'>>, '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'>>, 'CSC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Csc'>>, 'CSCH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Csch'>>, 'CUME_DIST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CumeDist'>>, 'CURRENT_ACCOUNT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentAccount'>>, 'CURRENT_ACCOUNT_NAME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentAccountName'>>, 'CURRENT_AVAILABLE_ROLES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentAvailableRoles'>>, 'CURRENT_CATALOG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentCatalog'>>, 'CURRENT_CLIENT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentClient'>>, 'CURRENT_DATABASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentDatabase'>>, '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_IP_ADDRESS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentIpAddress'>>, 'CURRENT_ORGANIZATION_NAME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentOrganizationName'>>, 'CURRENT_ORGANIZATION_USER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentOrganizationUser'>>, 'CURRENT_REGION': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentRegion'>>, 'CURRENT_ROLE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentRole'>>, 'CURRENT_ROLE_TYPE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentRoleType'>>, 'CURRENT_SCHEMA': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentSchema'>>, 'CURRENT_SCHEMAS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentSchemas'>>, 'CURRENT_SECONDARY_ROLES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentSecondaryRoles'>>, 'CURRENT_SESSION': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentSession'>>, 'CURRENT_STATEMENT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentStatement'>>, '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_TIMEZONE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentTimezone'>>, 'CURRENT_TRANSACTION': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentTransaction'>>, 'CURRENT_USER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentUser'>>, 'CURRENT_VERSION': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentVersion'>>, 'CURRENT_WAREHOUSE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentWarehouse'>>, '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>>, 'DAYNAME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Dayname'>>, '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'>>, 'DECOMPRESS_BINARY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DecompressBinary'>>, 'DECOMPRESS_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DecompressString'>>, 'DECRYPT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Decrypt'>>, 'DECRYPT_RAW': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DecryptRaw'>>, 'DEGREES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Degrees'>>, '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'>>, 'DOT_PRODUCT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DotProduct'>>, 'ELT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Elt'>>, 'ENCODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Encode'>>, 'ENCRYPT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Encrypt'>>, 'ENCRYPT_RAW': <bound method Func.from_arg_list of <class 'sqlglot.expressions.EncryptRaw'>>, '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'>>, 'EQUAL_NULL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.EqualNull'>>, 'EUCLIDEAN_DISTANCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.EuclideanDistance'>>, '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'>>, 'FACTORIAL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Factorial'>>, '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'>>, 'GETBIT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Getbit'>>, 'GET_BIT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Getbit'>>, 'GREATEST': <function Parser.<lambda>>, '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'>>, 'GROUPING_ID': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GroupingId'>>, 'HASH_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.HashAgg'>>, 'HEX': <function build_hex>, 'HEX_DECODE_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.HexDecodeString'>>, 'HEX_ENCODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.HexEncode'>>, 'HLL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Hll'>>, 'HOUR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Hour'>>, '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'>>, 'IS_NULL_VALUE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.IsNullValue'>>, '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'>>, 'J_S_O_N_B_CONTAINS_ALL_TOP_KEYS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBContainsAllTopKeys'>>, 'J_S_O_N_B_CONTAINS_ANY_TOP_KEYS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBContainsAnyTopKeys'>>, 'J_S_O_N_B_DELETE_AT_PATH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBDeleteAtPath'>>, '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'>>, 'JSON_KEYS': <function Parser.<lambda>>, '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'>>, 'JAROWINKLER_SIMILARITY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JarowinklerSimilarity'>>, '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'>>, 'KURTOSIS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Kurtosis'>>, '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': <function Parser.<lambda>>, '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'>>, 'LOCALTIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Localtime'>>, 'LOCALTIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Localtimestamp'>>, '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'>>, 'M_D5_NUMBER_LOWER64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MD5NumberLower64'>>, 'M_D5_NUMBER_UPPER64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MD5NumberUpper64'>>, 'M_L_FORECAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MLForecast'>>, 'M_L_TRANSLATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MLTranslate'>>, 'MAKE_INTERVAL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MakeInterval'>>, 'MANHATTAN_DISTANCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ManhattanDistance'>>, 'MAP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Map'>>, 'MAP_CAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MapCat'>>, 'MAP_CONTAINS_KEY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MapContainsKey'>>, 'MAP_DELETE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MapDelete'>>, 'MAP_FROM_ENTRIES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MapFromEntries'>>, 'MAP_INSERT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MapInsert'>>, 'MAP_KEYS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MapKeys'>>, 'MAP_PICK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MapPick'>>, 'MAP_SIZE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MapSize'>>, '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'>>, 'MINHASH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Minhash'>>, 'MINHASH_COMBINE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MinhashCombine'>>, 'MINUTE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Minute'>>, 'MODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Mode'>>, 'MONTH': <function MySQL.Parser.<lambda>>, 'MONTHNAME': <function MySQL.Parser.<lambda>>, 'MONTHS_BETWEEN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MonthsBetween'>>, 'NET.HOST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.NetHost'>>, 'NEXT_DAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.NextDay'>>, 'NEXT_VALUE_FOR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.NextValueFor'>>, 'NORMAL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Normal'>>, '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_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ObjectAgg'>>, '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_IP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseIp'>>, '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'>>, 'PARSE_URL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseUrl'>>, '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'>>, 'PI': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Pi'>>, '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'>>, 'PREVIOUS_DAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.PreviousDay'>>, 'QUANTILE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Quantile'>>, 'QUARTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Quarter'>>, 'RADIANS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Radians'>>, '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'>>, 'RANDSTR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Randstr'>>, 'RANGE_BUCKET': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RangeBucket'>>, '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'>>, 'READ_PARQUET': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ReadParquet'>>, 'REDUCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Reduce'>>, 'REGEXP_COUNT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpCount'>>, '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_FULL_MATCH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpFullMatch'>>, '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'>>, 'REGR_AVGX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrAvgx'>>, 'REGR_AVGY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrAvgy'>>, 'REGR_COUNT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrCount'>>, 'REGR_INTERCEPT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrIntercept'>>, 'REGR_R2': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrR2'>>, 'REGR_SLOPE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrSlope'>>, 'REGR_SXX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrSxx'>>, 'REGR_SXY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrSxy'>>, 'REGR_SYY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrSyy'>>, 'REGR_VALX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrValx'>>, 'REGR_VALY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrValy'>>, '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'>>, 'RTRIMMED_LENGTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RtrimmedLength'>>, 'SHA': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SHA'>>, 'SHA1': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SHA'>>, 'S_H_A1_DIGEST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SHA1Digest'>>, 'SHA2': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SHA2'>>, 'S_H_A2_DIGEST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SHA2Digest'>>, 'SAFE_ADD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SafeAdd'>>, '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'>>, 'SAFE_MULTIPLY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SafeMultiply'>>, 'SAFE_NEGATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SafeNegate'>>, 'SAFE_SUBTRACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SafeSubtract'>>, 'SEARCH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Search'>>, 'SEARCH_IP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SearchIp'>>, 'SEC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sec'>>, 'SECH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sech'>>, 'SECOND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Second'>>, 'SESSION_USER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SessionUser'>>, 'SIGN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sign'>>, 'SIGNUM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sign'>>, 'SIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sin'>>, 'SINH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sinh'>>, 'SKEWNESS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Skewness'>>, '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'>>, 'SOUNDEX_P123': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SoundexP123'>>, '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'>>, 'SYSTIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Systimestamp'>>, 'TAN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Tan'>>, 'TANH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Tanh'>>, '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_SLICE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeSlice'>>, '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_LTZ_FROM_PARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampLtzFromParts'>>, 'TIMESTAMPLTZFROMPARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampLtzFromParts'>>, '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'>>, 'TIMESTAMP_TZ_FROM_PARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampTzFromParts'>>, 'TIMESTAMPTZFROMPARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampTzFromParts'>>, '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_BINARY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToBinary'>>, 'TO_BOOLEAN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToBoolean'>>, '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_DECFLOAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToDecfloat'>>, 'TO_DOUBLE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToDouble'>>, 'TO_FILE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToFile'>>, '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_BASE64_DECODE_BINARY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TryBase64DecodeBinary'>>, 'TRY_BASE64_DECODE_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TryBase64DecodeString'>>, 'TRY_CAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TryCast'>>, 'TRY_HEX_DECODE_BINARY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TryHexDecodeBinary'>>, 'TRY_HEX_DECODE_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TryHexDecodeString'>>, 'TRY_TO_DECFLOAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TryToDecfloat'>>, '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'>>, 'UNIFORM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Uniform'>>, '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'>>, 'UTC_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UtcDate'>>, 'UTC_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UtcTime'>>, 'UTC_TIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UtcTimestamp'>>, 'UUID': <function Parser.<lambda>>, 'GEN_RANDOM_UUID': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Uuid'>>, 'GENERATE_UUID': <function Parser.<lambda>>, '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>>, 'WIDTH_BUCKET': <bound method Func.from_arg_list of <class 'sqlglot.expressions.WidthBucket'>>, 'XMLELEMENT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.XMLElement'>>, 'XMLGET': <bound method Func.from_arg_list of <class 'sqlglot.expressions.XMLGet'>>, '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>>, 'YEAR_OF_WEEK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.YearOfWeek'>>, 'YEAROFWEEK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.YearOfWeek'>>, 'YEAR_OF_WEEK_ISO': <bound method Func.from_arg_list of <class 'sqlglot.expressions.YearOfWeekIso'>>, 'YEAROFWEEKISO': <bound method Func.from_arg_list of <class 'sqlglot.expressions.YearOfWeekIso'>>, 'ZIPF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Zipf'>>, '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>, 'BIT_AND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitwiseAndAgg'>>, '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'>>, 'BIT_COUNT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitwiseCount'>>, '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'>>, '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'>>, 'L2_DISTANCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.EuclideanDistance'>>, '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>>, 'CHAR': <function Parser.<lambda>>, 'CHR': <function Parser.<lambda>>, 'DECODE': <function Parser.<lambda>>, 'EXTRACT': <function Parser.<lambda>>, 'FLOOR': <function Parser.<lambda>>, 'GAP_FILL': <function Parser.<lambda>>, 'INITCAP': <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>>, 'VALUES': <function MySQL.Parser.<lambda>>, 'JSON_VALUE': <function MySQL.Parser.<lambda>>, 'SUBSTR': <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'>, <TokenType.CURRENT_ROLE: 'CURRENT_ROLE'>: <class 'sqlglot.expressions.CurrentRole'>}
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.PROCEDURE: 'PROCEDURE'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.FILTER: 'FILTER'>, <TokenType.ANTI: 'ANTI'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.DATETIME2: 'DATETIME2'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.ROWS: 'ROWS'>, <TokenType.ANALYZE: 'ANALYZE'>, <TokenType.UINT256: 'UINT256'>, <TokenType.NEXT: 'NEXT'>, <TokenType.EXPORT: 'EXPORT'>, <TokenType.GEOGRAPHYPOINT: 'GEOGRAPHYPOINT'>, <TokenType.SEMANTIC_VIEW: 'SEMANTIC_VIEW'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.MAP: 'MAP'>, <TokenType.TOP: 'TOP'>, <TokenType.YEAR: 'YEAR'>, <TokenType.GET: 'GET'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.RANGE: 'RANGE'>, <TokenType.SUPER: 'SUPER'>, <TokenType.BLOB: 'BLOB'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.SINK: 'SINK'>, <TokenType.INT: 'INT'>, <TokenType.TIME: 'TIME'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.NULL: 'NULL'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.PUT: 'PUT'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.XML: 'XML'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.CACHE: 'CACHE'>, <TokenType.KEEP: 'KEEP'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.ROLLUP: 'ROLLUP'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.NAMESPACE: 'NAMESPACE'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.BIGNUM: 'BIGNUM'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.SET: 'SET'>, <TokenType.CHAR: 'CHAR'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.INT128: 'INT128'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.DATE: 'DATE'>, <TokenType.MATCH: 'MATCH'>, <TokenType.CUBE: 'CUBE'>, <TokenType.ATTACH: 'ATTACH'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.KILL: 'KILL'>, <TokenType.ENUM: 'ENUM'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.BINARY: 'BINARY'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.CASE: 'CASE'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.NAME: 'NAME'>, <TokenType.OVER: 'OVER'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.DECIMAL64: 'DECIMAL64'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.DECFLOAT: 'DECFLOAT'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.SEMI: 'SEMI'>, <TokenType.LIMIT: 'LIMIT'>, <TokenType.SESSION: 'SESSION'>, <TokenType.LOAD: 'LOAD'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.DIV: 'DIV'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.ANY: 'ANY'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.JSON: 'JSON'>, <TokenType.DECIMAL128: 'DECIMAL128'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.WAREHOUSE: 'WAREHOUSE'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.INT256: 'INT256'>, <TokenType.UNIQUE: 'UNIQUE'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.LINESTRING: 'LINESTRING'>, <TokenType.POINT: 'POINT'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.SHOW: 'SHOW'>, <TokenType.UINT: 'UINT'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.CURRENT_ROLE: 'CURRENT_ROLE'>, <TokenType.APPLY: 'APPLY'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.INET: 'INET'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.FIRST: 'FIRST'>, <TokenType.NESTED: 'NESTED'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.ALL: 'ALL'>, <TokenType.TEXT: 'TEXT'>, <TokenType.DELETE: 'DELETE'>, <TokenType.DESC: 'DESC'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.STAGE: 'STAGE'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.ASC: 'ASC'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.ROW: 'ROW'>, <TokenType.MONEY: 'MONEY'>, <TokenType.UUID: 'UUID'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.REFERENCES: 'REFERENCES'>, <TokenType.MODEL: 'MODEL'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.TAG: 'TAG'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.SOURCE: 'SOURCE'>, <TokenType.TIME_NS: 'TIME_NS'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.DECIMAL256: 'DECIMAL256'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.LOCALTIME: 'LOCALTIME'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.FALSE: 'FALSE'>, <TokenType.SETTINGS: 'SETTINGS'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.MERGE: 'MERGE'>, <TokenType.DYNAMIC: 'DYNAMIC'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.COPY: 'COPY'>, <TokenType.TRUE: 'TRUE'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.RENAME: 'RENAME'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.MULTILINESTRING: 'MULTILINESTRING'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.SMALLDATETIME: 'SMALLDATETIME'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.END: 'END'>, <TokenType.NOTHING: 'NOTHING'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.FILE: 'FILE'>, <TokenType.VAR: 'VAR'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.FINAL: 'FINAL'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.TABLE: 'TABLE'>, <TokenType.IPV6: 'IPV6'>, <TokenType.STORAGE_INTEGRATION: 'STORAGE_INTEGRATION'>, <TokenType.VIEW: 'VIEW'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.SOME: 'SOME'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.POLYGON: 'POLYGON'>, <TokenType.CURRENT_SCHEMA: 'CURRENT_SCHEMA'>, <TokenType.LIST: 'LIST'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.DECIMAL32: 'DECIMAL32'>, <TokenType.MULTIPOLYGON: 'MULTIPOLYGON'>, <TokenType.JSONB: 'JSONB'>, <TokenType.BIT: 'BIT'>, <TokenType.ORDINALITY: 'ORDINALITY'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.LOCALTIMESTAMP: 'LOCALTIMESTAMP'>, <TokenType.FILE_FORMAT: 'FILE_FORMAT'>, <TokenType.DETACH: 'DETACH'>, <TokenType.IS: 'IS'>, <TokenType.UINT128: 'UINT128'>, <TokenType.IPV4: 'IPV4'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.UDOUBLE: 'UDOUBLE'>, <TokenType.FORMAT: 'FORMAT'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.DATE32: 'DATE32'>, <TokenType.RING: 'RING'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.STREAMLIT: 'STREAMLIT'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.VOID: 'VOID'>, <TokenType.INDEX: 'INDEX'>}
ID_VAR_TOKENS =
{<TokenType.PROCEDURE: 'PROCEDURE'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.ANTI: 'ANTI'>, <TokenType.FILTER: 'FILTER'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.DATETIME2: 'DATETIME2'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.ROWS: 'ROWS'>, <TokenType.CURRENT_CATALOG: 'CURRENT_CATALOG'>, <TokenType.ANALYZE: 'ANALYZE'>, <TokenType.UINT256: 'UINT256'>, <TokenType.NEXT: 'NEXT'>, <TokenType.EXPORT: 'EXPORT'>, <TokenType.GEOGRAPHYPOINT: 'GEOGRAPHYPOINT'>, <TokenType.SEMANTIC_VIEW: 'SEMANTIC_VIEW'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.MAP: 'MAP'>, <TokenType.TOP: 'TOP'>, <TokenType.YEAR: 'YEAR'>, <TokenType.GET: 'GET'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.FULL: 'FULL'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.RANGE: 'RANGE'>, <TokenType.WINDOW: 'WINDOW'>, <TokenType.SUPER: 'SUPER'>, <TokenType.BLOB: 'BLOB'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.SINK: 'SINK'>, <TokenType.INT: 'INT'>, <TokenType.TIME: 'TIME'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.NULL: 'NULL'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.SESSION_USER: 'SESSION_USER'>, <TokenType.PUT: 'PUT'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.XML: 'XML'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.CACHE: 'CACHE'>, <TokenType.KEEP: 'KEEP'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.ROLLUP: 'ROLLUP'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.NAMESPACE: 'NAMESPACE'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.BIGNUM: 'BIGNUM'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.SET: 'SET'>, <TokenType.CHAR: 'CHAR'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.INT128: 'INT128'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.DATE: 'DATE'>, <TokenType.MATCH: 'MATCH'>, <TokenType.CUBE: 'CUBE'>, <TokenType.ATTACH: 'ATTACH'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.KILL: 'KILL'>, <TokenType.ENUM: 'ENUM'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.BINARY: 'BINARY'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.CASE: 'CASE'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.NAME: 'NAME'>, <TokenType.OVER: 'OVER'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.DECIMAL64: 'DECIMAL64'>, <TokenType.SEMI: 'SEMI'>, <TokenType.DECFLOAT: 'DECFLOAT'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.LIMIT: 'LIMIT'>, <TokenType.SESSION: 'SESSION'>, <TokenType.LOAD: 'LOAD'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.DIV: 'DIV'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.ANY: 'ANY'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.JSON: 'JSON'>, <TokenType.DECIMAL128: 'DECIMAL128'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.WAREHOUSE: 'WAREHOUSE'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.INT256: 'INT256'>, <TokenType.UNIQUE: 'UNIQUE'>, <TokenType.RIGHT: 'RIGHT'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.LINESTRING: 'LINESTRING'>, <TokenType.POINT: 'POINT'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.SHOW: 'SHOW'>, <TokenType.UINT: 'UINT'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.CURRENT_ROLE: 'CURRENT_ROLE'>, <TokenType.APPLY: 'APPLY'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.INET: 'INET'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.FIRST: 'FIRST'>, <TokenType.NESTED: 'NESTED'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.ASOF: 'ASOF'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.ALL: 'ALL'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.TEXT: 'TEXT'>, <TokenType.DELETE: 'DELETE'>, <TokenType.DESC: 'DESC'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.STAGE: 'STAGE'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.ASC: 'ASC'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.ROW: 'ROW'>, <TokenType.MONEY: 'MONEY'>, <TokenType.UUID: 'UUID'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.REFERENCES: 'REFERENCES'>, <TokenType.MODEL: 'MODEL'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.TAG: 'TAG'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.SOURCE: 'SOURCE'>, <TokenType.TIME_NS: 'TIME_NS'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.DECIMAL256: 'DECIMAL256'>, <TokenType.LOCK: 'LOCK'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.LOCALTIME: 'LOCALTIME'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.FALSE: 'FALSE'>, <TokenType.SETTINGS: 'SETTINGS'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.MERGE: 'MERGE'>, <TokenType.DYNAMIC: 'DYNAMIC'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.COPY: 'COPY'>, <TokenType.TRUE: 'TRUE'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.RENAME: 'RENAME'>, <TokenType.LEFT: 'LEFT'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.MULTILINESTRING: 'MULTILINESTRING'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.SMALLDATETIME: 'SMALLDATETIME'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.END: 'END'>, <TokenType.NATURAL: 'NATURAL'>, <TokenType.NOTHING: 'NOTHING'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.FILE: 'FILE'>, <TokenType.VAR: 'VAR'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.FINAL: 'FINAL'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.TABLE: 'TABLE'>, <TokenType.IPV6: 'IPV6'>, <TokenType.STORAGE_INTEGRATION: 'STORAGE_INTEGRATION'>, <TokenType.VIEW: 'VIEW'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.SOME: 'SOME'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.POLYGON: 'POLYGON'>, <TokenType.CURRENT_SCHEMA: 'CURRENT_SCHEMA'>, <TokenType.LIST: 'LIST'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.DECIMAL32: 'DECIMAL32'>, <TokenType.MULTIPOLYGON: 'MULTIPOLYGON'>, <TokenType.JSONB: 'JSONB'>, <TokenType.BIT: 'BIT'>, <TokenType.ORDINALITY: 'ORDINALITY'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.LOCALTIMESTAMP: 'LOCALTIMESTAMP'>, <TokenType.FILE_FORMAT: 'FILE_FORMAT'>, <TokenType.DETACH: 'DETACH'>, <TokenType.IS: 'IS'>, <TokenType.UINT128: 'UINT128'>, <TokenType.IPV4: 'IPV4'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.UDOUBLE: 'UDOUBLE'>, <TokenType.FORMAT: 'FORMAT'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.DATE32: 'DATE32'>, <TokenType.RING: 'RING'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.USE: 'USE'>, <TokenType.STREAMLIT: 'STREAMLIT'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.VOID: 'VOID'>, <TokenType.INDEX: 'INDEX'>}
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
- 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
- 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
- SET_ASSIGNMENT_DELIMITERS
- 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
- ALTER_TABLE_PARTITIONS
- JOINS_HAVE_EQUAL_PRECEDENCE
- ZONE_AWARE_TIMESTAMP_CONSTRUCTOR
- MAP_KEYS_ARE_ARBITRARY_EXPRESSIONS
- JSON_EXTRACT_REQUIRES_JSON_EXPRESSION
- ADD_JOIN_ON_TRUE
- SUPPORTS_OMITTED_INTERVAL_SPAN_UNIT
- 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
177 class Generator(MySQL.Generator): 178 LAST_DAY_SUPPORTS_DATE_PART = False 179 VARCHAR_REQUIRES_SIZE = False 180 WITH_PROPERTIES_PREFIX = "PROPERTIES" 181 RENAME_TABLE_WITH_DB = False 182 UPDATE_STATEMENT_SUPPORTS_FROM = True 183 184 TYPE_MAPPING = { 185 **MySQL.Generator.TYPE_MAPPING, 186 exp.DataType.Type.TEXT: "STRING", 187 exp.DataType.Type.TIMESTAMP: "DATETIME", 188 exp.DataType.Type.TIMESTAMPTZ: "DATETIME", 189 } 190 191 PROPERTIES_LOCATION = { 192 **MySQL.Generator.PROPERTIES_LOCATION, 193 exp.UniqueKeyProperty: exp.Properties.Location.POST_SCHEMA, 194 exp.PartitionByRangeProperty: exp.Properties.Location.POST_SCHEMA, 195 exp.PartitionByListProperty: exp.Properties.Location.POST_SCHEMA, 196 exp.PartitionedByProperty: exp.Properties.Location.POST_SCHEMA, 197 exp.BuildProperty: exp.Properties.Location.POST_SCHEMA, 198 exp.RefreshTriggerProperty: exp.Properties.Location.POST_SCHEMA, 199 } 200 201 CAST_MAPPING = {} 202 TIMESTAMP_FUNC_TYPES = set() 203 204 TRANSFORMS = { 205 **MySQL.Generator.TRANSFORMS, 206 exp.AddMonths: rename_func("MONTHS_ADD"), 207 exp.ApproxDistinct: approx_count_distinct_sql, 208 exp.ArgMax: rename_func("MAX_BY"), 209 exp.ArgMin: rename_func("MIN_BY"), 210 exp.ArrayAgg: rename_func("COLLECT_LIST"), 211 exp.ArrayToString: rename_func("ARRAY_JOIN"), 212 exp.ArrayUniqueAgg: rename_func("COLLECT_SET"), 213 exp.CurrentDate: lambda self, _: self.func("CURRENT_DATE"), 214 exp.CurrentTimestamp: lambda self, _: self.func("NOW"), 215 exp.DateTrunc: lambda self, e: self.func("DATE_TRUNC", e.this, unit_to_str(e)), 216 exp.EuclideanDistance: rename_func("L2_DISTANCE"), 217 exp.GroupConcat: lambda self, e: self.func( 218 "GROUP_CONCAT", e.this, e.args.get("separator") or exp.Literal.string(",") 219 ), 220 exp.JSONExtractScalar: lambda self, e: self.func("JSON_EXTRACT", e.this, e.expression), 221 exp.Lag: _lag_lead_sql, 222 exp.Lead: _lag_lead_sql, 223 exp.Map: rename_func("ARRAY_MAP"), 224 exp.Property: property_sql, 225 exp.RegexpLike: rename_func("REGEXP"), 226 exp.RegexpSplit: rename_func("SPLIT_BY_STRING"), 227 exp.SchemaCommentProperty: lambda self, e: self.naked_property(e), 228 exp.Split: rename_func("SPLIT_BY_STRING"), 229 exp.StringToArray: rename_func("SPLIT_BY_STRING"), 230 exp.StrToUnix: lambda self, e: self.func("UNIX_TIMESTAMP", e.this, self.format_time(e)), 231 exp.TimeStrToDate: rename_func("TO_DATE"), 232 exp.TsOrDsAdd: lambda self, e: self.func("DATE_ADD", e.this, e.expression), 233 exp.TsOrDsToDate: lambda self, e: self.func("TO_DATE", e.this), 234 exp.TimeToUnix: rename_func("UNIX_TIMESTAMP"), 235 exp.TimestampTrunc: lambda self, e: self.func("DATE_TRUNC", e.this, unit_to_str(e)), 236 exp.UnixToStr: lambda self, e: self.func( 237 "FROM_UNIXTIME", e.this, time_format("doris")(self, e) 238 ), 239 exp.UnixToTime: rename_func("FROM_UNIXTIME"), 240 } 241 242 # https://github.com/apache/doris/blob/e4f41dbf1ec03f5937fdeba2ee1454a20254015b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisLexer.g4#L93 243 RESERVED_KEYWORDS = { 244 "account_lock", 245 "account_unlock", 246 "add", 247 "adddate", 248 "admin", 249 "after", 250 "agg_state", 251 "aggregate", 252 "alias", 253 "all", 254 "alter", 255 "analyze", 256 "analyzed", 257 "and", 258 "anti", 259 "append", 260 "array", 261 "array_range", 262 "as", 263 "asc", 264 "at", 265 "authors", 266 "auto", 267 "auto_increment", 268 "backend", 269 "backends", 270 "backup", 271 "begin", 272 "belong", 273 "between", 274 "bigint", 275 "bin", 276 "binary", 277 "binlog", 278 "bitand", 279 "bitmap", 280 "bitmap_union", 281 "bitor", 282 "bitxor", 283 "blob", 284 "boolean", 285 "brief", 286 "broker", 287 "buckets", 288 "build", 289 "builtin", 290 "bulk", 291 "by", 292 "cached", 293 "call", 294 "cancel", 295 "case", 296 "cast", 297 "catalog", 298 "catalogs", 299 "chain", 300 "char", 301 "character", 302 "charset", 303 "check", 304 "clean", 305 "cluster", 306 "clusters", 307 "collate", 308 "collation", 309 "collect", 310 "column", 311 "columns", 312 "comment", 313 "commit", 314 "committed", 315 "compact", 316 "complete", 317 "config", 318 "connection", 319 "connection_id", 320 "consistent", 321 "constraint", 322 "constraints", 323 "convert", 324 "copy", 325 "count", 326 "create", 327 "creation", 328 "cron", 329 "cross", 330 "cube", 331 "current", 332 "current_catalog", 333 "current_date", 334 "current_time", 335 "current_timestamp", 336 "current_user", 337 "data", 338 "database", 339 "databases", 340 "date", 341 "date_add", 342 "date_ceil", 343 "date_diff", 344 "date_floor", 345 "date_sub", 346 "dateadd", 347 "datediff", 348 "datetime", 349 "datetimev2", 350 "datev2", 351 "datetimev1", 352 "datev1", 353 "day", 354 "days_add", 355 "days_sub", 356 "decimal", 357 "decimalv2", 358 "decimalv3", 359 "decommission", 360 "default", 361 "deferred", 362 "delete", 363 "demand", 364 "desc", 365 "describe", 366 "diagnose", 367 "disk", 368 "distinct", 369 "distinctpc", 370 "distinctpcsa", 371 "distributed", 372 "distribution", 373 "div", 374 "do", 375 "doris_internal_table_id", 376 "double", 377 "drop", 378 "dropp", 379 "dual", 380 "duplicate", 381 "dynamic", 382 "else", 383 "enable", 384 "encryptkey", 385 "encryptkeys", 386 "end", 387 "ends", 388 "engine", 389 "engines", 390 "enter", 391 "errors", 392 "events", 393 "every", 394 "except", 395 "exclude", 396 "execute", 397 "exists", 398 "expired", 399 "explain", 400 "export", 401 "extended", 402 "external", 403 "extract", 404 "failed_login_attempts", 405 "false", 406 "fast", 407 "feature", 408 "fields", 409 "file", 410 "filter", 411 "first", 412 "float", 413 "follower", 414 "following", 415 "for", 416 "foreign", 417 "force", 418 "format", 419 "free", 420 "from", 421 "frontend", 422 "frontends", 423 "full", 424 "function", 425 "functions", 426 "generic", 427 "global", 428 "grant", 429 "grants", 430 "graph", 431 "group", 432 "grouping", 433 "groups", 434 "hash", 435 "having", 436 "hdfs", 437 "help", 438 "histogram", 439 "hll", 440 "hll_union", 441 "hostname", 442 "hour", 443 "hub", 444 "identified", 445 "if", 446 "ignore", 447 "immediate", 448 "in", 449 "incremental", 450 "index", 451 "indexes", 452 "infile", 453 "inner", 454 "insert", 455 "install", 456 "int", 457 "integer", 458 "intermediate", 459 "intersect", 460 "interval", 461 "into", 462 "inverted", 463 "ipv4", 464 "ipv6", 465 "is", 466 "is_not_null_pred", 467 "is_null_pred", 468 "isnull", 469 "isolation", 470 "job", 471 "jobs", 472 "join", 473 "json", 474 "jsonb", 475 "key", 476 "keys", 477 "kill", 478 "label", 479 "largeint", 480 "last", 481 "lateral", 482 "ldap", 483 "ldap_admin_password", 484 "left", 485 "less", 486 "level", 487 "like", 488 "limit", 489 "lines", 490 "link", 491 "list", 492 "load", 493 "local", 494 "localtime", 495 "localtimestamp", 496 "location", 497 "lock", 498 "logical", 499 "low_priority", 500 "manual", 501 "map", 502 "match", 503 "match_all", 504 "match_any", 505 "match_phrase", 506 "match_phrase_edge", 507 "match_phrase_prefix", 508 "match_regexp", 509 "materialized", 510 "max", 511 "maxvalue", 512 "memo", 513 "merge", 514 "migrate", 515 "migrations", 516 "min", 517 "minus", 518 "minute", 519 "modify", 520 "month", 521 "mtmv", 522 "name", 523 "names", 524 "natural", 525 "negative", 526 "never", 527 "next", 528 "ngram_bf", 529 "no", 530 "non_nullable", 531 "not", 532 "null", 533 "nulls", 534 "observer", 535 "of", 536 "offset", 537 "on", 538 "only", 539 "open", 540 "optimized", 541 "or", 542 "order", 543 "outer", 544 "outfile", 545 "over", 546 "overwrite", 547 "parameter", 548 "parsed", 549 "partition", 550 "partitions", 551 "password", 552 "password_expire", 553 "password_history", 554 "password_lock_time", 555 "password_reuse", 556 "path", 557 "pause", 558 "percent", 559 "period", 560 "permissive", 561 "physical", 562 "plan", 563 "process", 564 "plugin", 565 "plugins", 566 "policy", 567 "preceding", 568 "prepare", 569 "primary", 570 "proc", 571 "procedure", 572 "processlist", 573 "profile", 574 "properties", 575 "property", 576 "quantile_state", 577 "quantile_union", 578 "query", 579 "quota", 580 "random", 581 "range", 582 "read", 583 "real", 584 "rebalance", 585 "recover", 586 "recycle", 587 "refresh", 588 "references", 589 "regexp", 590 "release", 591 "rename", 592 "repair", 593 "repeatable", 594 "replace", 595 "replace_if_not_null", 596 "replica", 597 "repositories", 598 "repository", 599 "resource", 600 "resources", 601 "restore", 602 "restrictive", 603 "resume", 604 "returns", 605 "revoke", 606 "rewritten", 607 "right", 608 "rlike", 609 "role", 610 "roles", 611 "rollback", 612 "rollup", 613 "routine", 614 "row", 615 "rows", 616 "s3", 617 "sample", 618 "schedule", 619 "scheduler", 620 "schema", 621 "schemas", 622 "second", 623 "select", 624 "semi", 625 "sequence", 626 "serializable", 627 "session", 628 "set", 629 "sets", 630 "shape", 631 "show", 632 "signed", 633 "skew", 634 "smallint", 635 "snapshot", 636 "soname", 637 "split", 638 "sql_block_rule", 639 "start", 640 "starts", 641 "stats", 642 "status", 643 "stop", 644 "storage", 645 "stream", 646 "streaming", 647 "string", 648 "struct", 649 "subdate", 650 "sum", 651 "superuser", 652 "switch", 653 "sync", 654 "system", 655 "table", 656 "tables", 657 "tablesample", 658 "tablet", 659 "tablets", 660 "task", 661 "tasks", 662 "temporary", 663 "terminated", 664 "text", 665 "than", 666 "then", 667 "time", 668 "timestamp", 669 "timestampadd", 670 "timestampdiff", 671 "tinyint", 672 "to", 673 "transaction", 674 "trash", 675 "tree", 676 "triggers", 677 "trim", 678 "true", 679 "truncate", 680 "type", 681 "type_cast", 682 "types", 683 "unbounded", 684 "uncommitted", 685 "uninstall", 686 "union", 687 "unique", 688 "unlock", 689 "unsigned", 690 "update", 691 "use", 692 "user", 693 "using", 694 "value", 695 "values", 696 "varchar", 697 "variables", 698 "variant", 699 "vault", 700 "verbose", 701 "version", 702 "view", 703 "warnings", 704 "week", 705 "when", 706 "where", 707 "whitelist", 708 "with", 709 "work", 710 "workload", 711 "write", 712 "xor", 713 "year", 714 } 715 716 def uniquekeyproperty_sql( 717 self, expression: exp.UniqueKeyProperty, prefix: str = "UNIQUE KEY" 718 ) -> str: 719 create_stmt = expression.find_ancestor(exp.Create) 720 if create_stmt and create_stmt.args["properties"].find(exp.MaterializedProperty): 721 return super().uniquekeyproperty_sql(expression, prefix="KEY") 722 723 return super().uniquekeyproperty_sql(expression) 724 725 def partition_sql(self, expression: exp.Partition) -> str: 726 parent = expression.parent 727 if isinstance(parent, (exp.PartitionByRangeProperty, exp.PartitionByListProperty)): 728 return ", ".join(self.sql(e) for e in expression.expressions) 729 return super().partition_sql(expression) 730 731 def partitionrange_sql(self, expression: exp.PartitionRange) -> str: 732 name = self.sql(expression, "this") 733 values = expression.expressions 734 735 if len(values) != 1: 736 # Multiple values: use VALUES [ ... ) 737 if values and isinstance(values[0], list): 738 values_sql = ", ".join( 739 f"({', '.join(self.sql(v) for v in inner)})" for inner in values 740 ) 741 else: 742 values_sql = ", ".join(f"({self.sql(v)})" for v in values) 743 744 return f"PARTITION {name} VALUES [{values_sql})" 745 746 return f"PARTITION {name} VALUES LESS THAN ({self.sql(values[0])})" 747 748 def partitionbyrangepropertydynamic_sql( 749 self, expression: exp.PartitionByRangePropertyDynamic 750 ) -> str: 751 # Generates: FROM ("start") TO ("end") INTERVAL N UNIT 752 start = self.sql(expression, "start") 753 end = self.sql(expression, "end") 754 every = expression.args.get("every") 755 756 if every: 757 number = self.sql(every, "this") 758 interval = f"INTERVAL {number} {self.sql(every, 'unit')}" 759 else: 760 interval = "" 761 762 return f"FROM ({start}) TO ({end}) {interval}" 763 764 def partitionbyrangeproperty_sql(self, expression: exp.PartitionByRangeProperty) -> str: 765 partition_expressions = self.expressions( 766 expression, key="partition_expressions", indent=False 767 ) 768 create_sql = self.expressions(expression, key="create_expressions", indent=False) 769 return f"PARTITION BY RANGE ({partition_expressions}) ({create_sql})" 770 771 def partitionbylistproperty_sql(self, expression: exp.PartitionByListProperty) -> str: 772 partition_expressions = self.expressions( 773 expression, key="partition_expressions", indent=False 774 ) 775 create_sql = self.expressions(expression, key="create_expressions", indent=False) 776 return f"PARTITION BY LIST ({partition_expressions}) ({create_sql})" 777 778 def partitionlist_sql(self, expression: exp.PartitionList) -> str: 779 name = self.sql(expression, "this") 780 values = self.expressions(expression, indent=False) 781 return f"PARTITION {name} VALUES IN ({values})" 782 783 def partitionedbyproperty_sql(self, expression: exp.PartitionedByProperty) -> str: 784 node = expression.this 785 if isinstance(node, exp.Schema): 786 parts = ", ".join(self.sql(e) for e in node.expressions) 787 return f"PARTITION BY ({parts})" 788 return f"PARTITION BY ({self.sql(node)})" 789 790 def table_sql(self, expression: exp.Table, sep: str = " AS ") -> str: 791 """Override table_sql to avoid AS keyword in UPDATE and DELETE statements.""" 792 ancestor = expression.find_ancestor(exp.Update, exp.Delete, exp.Select) 793 if not isinstance(ancestor, exp.Select): 794 sep = " " 795 return super().table_sql(expression, sep=sep) 796 797 def alterrename_sql(self, expression: exp.AlterRename, include_to: bool = True) -> str: 798 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: Always quote except for specials cases. '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
WHEREclause. 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.Adjacent'>: <function Generator.<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.CurrentCatalog'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SessionUser'>: <function MySQL.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.JSONBContainsAnyTopKeys'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.JSONBContainsAllTopKeys'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.JSONBDeleteAtPath'>: <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.ExtendsLeft'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ExtendsRight'>: <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.ZeroFillColumnConstraint'>: <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.UppercaseColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.UtcDate'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.UtcTime'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.UtcTimestamp'>: <function rename_func.<locals>.<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.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.BitwiseAndAgg'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.BitwiseOrAgg'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.BitwiseXorAgg'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.BitwiseCount'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.Chr'>: <function MySQL.Generator.<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.EuclideanDistance'>: <function rename_func.<locals>.<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 =
{'work', 'decommission', 'cancel', 'date_sub', 'parameter', 'date_ceil', 'incremental', 'date', 'join', 'false', 'help', 'pause', 'function', 'call', 'match_regexp', 'bitmap', 'is_null_pred', 'week', 'binlog', 'trash', 'tablets', 'into', 'is_not_null_pred', 'signed', 'belong', 'true', 'match', 'sql_block_rule', 'ends', 'plan', 'period', 'json', 'match_any', 'lateral', 'between', 'constraints', 'map', 'aggregate', 'password_reuse', 'decimalv3', 'engines', 'quota', 'type_cast', 'view', 'name', 'character', 'location', 'union', 'timestampadd', 'xor', 'current_catalog', 'largeint', 'catalog', 'value', 'ldap_admin_password', 'select', 'begin', 'agg_state', 'engine', 'bitmap_union', 'append', 'dropp', 'timestamp', 'observer', 'nulls', 'stop', 'timestampdiff', 'workload', 'datediff', 'boolean', 'cast', 'distinctpcsa', 'enable', 'check', 'references', 'resource', 'format', 'year', 'alias', 'serializable', 'limit', 'fast', 'storage', 'grouping', 'values', 'roles', 'next', 'snapshot', 'char', 'intersect', 'diagnose', 'properties', 'datetimev2', 'like', 'collect', 'interval', 'preceding', 'bitxor', 'unbounded', 'enter', 'outfile', 'stats', 'asc', 'drop', 'text', 'less', 'mtmv', 'decimal', 'count', 'build', 'localtimestamp', 'export', 'in', 'dual', 'tree', 'sequence', 'builtin', 'clusters', 'file', 'ldap', 'hash', 'rows', 'free', 'follower', 'deferred', 'extract', 'broker', 'force', 'procedure', 'soname', 'task', 'system', 'backend', 'by', 'connection_id', 'collation', 'int', 'integer', 'tinyint', 'bitand', 'columns', 'localtime', 'external', 'collate', 'groups', 'time', 'feature', 'extended', 'min', 'data', 'show', 'expired', 'column', 'rollup', 'replica', 'rename', 'buckets', 'databases', 'auto_increment', 'end', 'or', 'intermediate', 'temporary', 'double', 'and', 'hdfs', 'order', 'ipv4', 'sample', 'row', 'cluster', 'full', 'lines', 'date_add', 'current_time', 'duplicate', 'lock', 'immediate', 'for', 'datev2', 'stream', 'left', 'auto', 'replace', 'whitelist', 'uncommitted', 'current', 'admin', 'prepare', 'smallint', 'optimized', 'if', 'match_phrase_edge', 'isolation', 'type', 'authors', 'status', 'filter', 'plugins', 'then', 'distribution', 'load', 'array_range', 'plugin', 'month', 'null', 'frontends', 'unique', 'hour', 'graph', 'constraint', 'physical', 'hll_union', 'describe', 'warnings', 'indexes', 'every', 'account_lock', 'days_sub', 'errors', 'match_phrase_prefix', 'migrations', 'write', 'list', 'schemas', 'revoke', 'role', 'schedule', 'refresh', 'regexp', 'password_expire', 'histogram', 'second', 'right', 'real', 'datev1', 'schema', 'functions', 'release', 'as', 'sync', 'encryptkey', 'bigint', 'modify', 'distributed', 'explain', 'set', 'delete', 'replace_if_not_null', 'restrictive', 'level', 'identified', 'database', 'hub', 'days_add', 'names', 'repository', 'first', 'version', 'all', 'negative', 'at', 'range', 'transaction', 'install', 'bitor', 'password_lock_time', 'split', 'except', 'day', 'insert', 'repair', 'repeatable', 'max', 'decimalv2', 'date_diff', 'recover', 'shape', 'minus', 'cube', 'match_all', 'failed_login_attempts', 'permissive', 's3', 'backends', 'committed', 'distinctpc', 'jsonb', 'overwrite', 'use', 'datetimev1', 'events', 'returns', 'sum', 'types', 'last', 'float', 'when', 'distinct', 'user', 'compact', 'skew', 'analyze', 'of', 'connection', 'tablesample', 'frontend', 'than', 'recycle', 'dateadd', 'processlist', 'merge', 'using', 'following', 'index', 'div', 'update', 'inner', 'never', 'keys', 'offset', 'rewritten', 'scheduler', 'varchar', 'complete', 'policy', 'with', 'ngram_bf', 'match_phrase', 'rebalance', 'encryptkeys', 'variables', 'maxvalue', 'on', 'vault', 'convert', 'anti', 'streaming', 'partition', 'materialized', 'global', 'random', 'foreign', 'backup', 'low_priority', 'migrate', 'account_unlock', 'natural', 'config', 'routine', 'quantile_union', 'path', 'creation', 'property', 'current_date', 'execute', 'unlock', 'to', 'parsed', 'do', 'truncate', 'non_nullable', 'not', 'restore', 'variant', 'alter', 'brief', 'session', 'unsigned', 'clean', 'exclude', 'group', 'job', 'jobs', 'isnull', 'blob', 'tasks', 'copy', 'binary', 'resources', 'rollback', 'table', 'struct', 'catalogs', 'no', 'password', 'read', 'link', 'else', 'ipv6', 'desc', 'percent', 'open', 'cross', 'after', 'create', 'sets', 'inverted', 'cached', 'chain', 'rlike', 'from', 'superuser', 'repositories', 'semi', 'disk', 'switch', 'bulk', 'primary', 'adddate', 'grants', 'partitions', 'demand', 'query', 'date_floor', 'local', 'key', 'is', 'tables', 'logical', 'dynamic', 'verbose', 'starts', 'generic', 'ignore', 'exists', 'having', 'outer', 'kill', 'hll', 'terminated', 'current_user', 'commit', 'fields', 'case', 'datetime', 'hostname', 'proc', 'resume', 'doris_internal_table_id', 'profile', 'trim', 'bin', 'process', 'add', 'charset', 'string', 'comment', 'default', 'label', 'infile', 'manual', 'quantile_state', 'only', 'triggers', 'analyzed', 'over', 'array', 'grant', 'start', 'cron', 'consistent', 'memo', 'tablet', 'where', 'subdate', 'password_history', 'minute', 'uninstall', 'current_timestamp'}
def
uniquekeyproperty_sql( self, expression: sqlglot.expressions.UniqueKeyProperty, prefix: str = 'UNIQUE KEY') -> str:
716 def uniquekeyproperty_sql( 717 self, expression: exp.UniqueKeyProperty, prefix: str = "UNIQUE KEY" 718 ) -> str: 719 create_stmt = expression.find_ancestor(exp.Create) 720 if create_stmt and create_stmt.args["properties"].find(exp.MaterializedProperty): 721 return super().uniquekeyproperty_sql(expression, prefix="KEY") 722 723 return super().uniquekeyproperty_sql(expression)
731 def partitionrange_sql(self, expression: exp.PartitionRange) -> str: 732 name = self.sql(expression, "this") 733 values = expression.expressions 734 735 if len(values) != 1: 736 # Multiple values: use VALUES [ ... ) 737 if values and isinstance(values[0], list): 738 values_sql = ", ".join( 739 f"({', '.join(self.sql(v) for v in inner)})" for inner in values 740 ) 741 else: 742 values_sql = ", ".join(f"({self.sql(v)})" for v in values) 743 744 return f"PARTITION {name} VALUES [{values_sql})" 745 746 return f"PARTITION {name} VALUES LESS THAN ({self.sql(values[0])})"
def
partitionbyrangepropertydynamic_sql( self, expression: sqlglot.expressions.PartitionByRangePropertyDynamic) -> str:
748 def partitionbyrangepropertydynamic_sql( 749 self, expression: exp.PartitionByRangePropertyDynamic 750 ) -> str: 751 # Generates: FROM ("start") TO ("end") INTERVAL N UNIT 752 start = self.sql(expression, "start") 753 end = self.sql(expression, "end") 754 every = expression.args.get("every") 755 756 if every: 757 number = self.sql(every, "this") 758 interval = f"INTERVAL {number} {self.sql(every, 'unit')}" 759 else: 760 interval = "" 761 762 return f"FROM ({start}) TO ({end}) {interval}"
def
partitionbyrangeproperty_sql(self, expression: sqlglot.expressions.PartitionByRangeProperty) -> str:
764 def partitionbyrangeproperty_sql(self, expression: exp.PartitionByRangeProperty) -> str: 765 partition_expressions = self.expressions( 766 expression, key="partition_expressions", indent=False 767 ) 768 create_sql = self.expressions(expression, key="create_expressions", indent=False) 769 return f"PARTITION BY RANGE ({partition_expressions}) ({create_sql})"
def
partitionbylistproperty_sql(self, expression: sqlglot.expressions.PartitionByListProperty) -> str:
771 def partitionbylistproperty_sql(self, expression: exp.PartitionByListProperty) -> str: 772 partition_expressions = self.expressions( 773 expression, key="partition_expressions", indent=False 774 ) 775 create_sql = self.expressions(expression, key="create_expressions", indent=False) 776 return f"PARTITION BY LIST ({partition_expressions}) ({create_sql})"
790 def table_sql(self, expression: exp.Table, sep: str = " AS ") -> str: 791 """Override table_sql to avoid AS keyword in UPDATE and DELETE statements.""" 792 ancestor = expression.find_ancestor(exp.Update, exp.Delete, exp.Select) 793 if not isinstance(ancestor, exp.Select): 794 sep = " " 795 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
- UNICODE_SUBSTITUTE
- 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
- MATCH_AGAINST_TABLE_PREFIX
- SET_ASSIGNMENT_REQUIRES_VARIABLE_KEYWORD
- 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
- pseudocolumn_sql
- columnposition_sql
- columndef_sql
- columnconstraint_sql
- autoincrementcolumnconstraint_sql
- compresscolumnconstraint_sql
- generatedasidentitycolumnconstraint_sql
- generatedasrowcolumnconstraint_sql
- periodforsystemtimeconstraint_sql
- notnullcolumnconstraint_sql
- primarykeycolumnconstraint_sql
- uniquecolumnconstraint_sql
- inoutcolumnconstraint_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
- booland_sql
- boolor_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
- strtotime_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
- altersession_sql
- add_column_sql
- droppartition_sql
- addconstraint_sql
- addpartition_sql
- distinct_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
- match_sql
- similarto_sql
- lt_sql
- lte_sql
- mod_sql
- mul_sql
- neq_sql
- nullsafeeq_sql
- nullsafeneq_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
- mltranslate_sql
- mlforecast_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
- slice_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
- install_sql
- get_put_sql
- translatecharacters_sql
- decodecase_sql
- semanticview_sql
- getextract_sql
- datefromunixdate_sql
- space_sql
- buildproperty_sql
- refreshtriggerproperty_sql
- modelattribute_sql
- directorystage_sql
- uuid_sql
- initcap_sql
- localtime_sql
- localtimestamp_sql
- weekstart_sql
- chr_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
- timestamptrunc_sql
- converttimezone_sql
- attimezone_sql
- isascii_sql
- ignorenulls_sql
- currentschema_sql