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