sqlglot.dialects.doris
1from __future__ import annotations 2 3from sqlglot import exp 4from sqlglot.dialects.dialect import ( 5 approx_count_distinct_sql, 6 build_timestamp_trunc, 7 property_sql, 8 rename_func, 9 time_format, 10 unit_to_str, 11) 12from sqlglot.dialects.mysql import MySQL 13from sqlglot.tokens import TokenType 14 15 16def _lag_lead_sql(self, expression: exp.Lag | exp.Lead) -> str: 17 return self.func( 18 "LAG" if isinstance(expression, exp.Lag) else "LEAD", 19 expression.this, 20 expression.args.get("offset") or exp.Literal.number(1), 21 expression.args.get("default") or exp.null(), 22 ) 23 24 25class Doris(MySQL): 26 DATE_FORMAT = "'yyyy-MM-dd'" 27 DATEINT_FORMAT = "'yyyyMMdd'" 28 TIME_FORMAT = "'yyyy-MM-dd HH:mm:ss'" 29 30 class Parser(MySQL.Parser): 31 FUNCTIONS = { 32 **MySQL.Parser.FUNCTIONS, 33 "COLLECT_SET": exp.ArrayUniqueAgg.from_arg_list, 34 "DATE_TRUNC": build_timestamp_trunc, 35 "MONTHS_ADD": exp.AddMonths.from_arg_list, 36 "REGEXP": exp.RegexpLike.from_arg_list, 37 "TO_DATE": exp.TsOrDsToDate.from_arg_list, 38 } 39 40 FUNCTION_PARSERS = MySQL.Parser.FUNCTION_PARSERS.copy() 41 FUNCTION_PARSERS.pop("GROUP_CONCAT") 42 43 PROPERTY_PARSERS = { 44 **MySQL.Parser.PROPERTY_PARSERS, 45 "PROPERTIES": lambda self: self._parse_wrapped_properties(), 46 "UNIQUE": lambda self: self._parse_composite_key_property(exp.UniqueKeyProperty), 47 "PARTITION BY": lambda self: self._parse_partition_by_opt_range(), 48 } 49 50 def _parse_partitioning_granularity_dynamic(self) -> exp.PartitionByRangePropertyDynamic: 51 self._match_text_seq("FROM") 52 start = self._parse_wrapped(self._parse_string) 53 self._match_text_seq("TO") 54 end = self._parse_wrapped(self._parse_string) 55 self._match_text_seq("INTERVAL") 56 number = self._parse_number() 57 unit = self._parse_var(any_token=True) 58 every = self.expression(exp.Interval, this=number, unit=unit) 59 return self.expression( 60 exp.PartitionByRangePropertyDynamic, start=start, end=end, every=every 61 ) 62 63 def _parse_partition_definition(self) -> exp.Partition: 64 self._match_text_seq("PARTITION") 65 66 name = self._parse_id_var() 67 self._match_text_seq("VALUES") 68 69 if self._match_text_seq("LESS", "THAN"): 70 values = self._parse_wrapped_csv(self._parse_expression) 71 if len(values) == 1 and values[0].name.upper() == "MAXVALUE": 72 values = [exp.var("MAXVALUE")] 73 74 part_range = self.expression(exp.PartitionRange, this=name, expressions=values) 75 return self.expression(exp.Partition, expressions=[part_range]) 76 77 self._match(TokenType.L_BRACKET) 78 values = self._parse_csv(lambda: self._parse_wrapped_csv(self._parse_expression)) 79 80 self._match(TokenType.R_BRACKET) 81 self._match(TokenType.R_PAREN) 82 83 part_range = self.expression(exp.PartitionRange, this=name, expressions=values) 84 return self.expression(exp.Partition, expressions=[part_range]) 85 86 def _parse_partition_by_opt_range( 87 self, 88 ) -> exp.PartitionedByProperty | exp.PartitionByRangeProperty: 89 if not self._match_text_seq("RANGE"): 90 return super()._parse_partitioned_by() 91 92 partition_expressions = self._parse_wrapped_id_vars() 93 self._match_l_paren() 94 95 if self._match_text_seq("FROM", advance=False): 96 create_expressions = self._parse_csv(self._parse_partitioning_granularity_dynamic) 97 elif self._match_text_seq("PARTITION", advance=False): 98 create_expressions = self._parse_csv(self._parse_partition_definition) 99 else: 100 create_expressions = None 101 102 self._match_r_paren() 103 104 return self.expression( 105 exp.PartitionByRangeProperty, 106 partition_expressions=partition_expressions, 107 create_expressions=create_expressions, 108 ) 109 110 class Generator(MySQL.Generator): 111 LAST_DAY_SUPPORTS_DATE_PART = False 112 VARCHAR_REQUIRES_SIZE = False 113 WITH_PROPERTIES_PREFIX = "PROPERTIES" 114 115 TYPE_MAPPING = { 116 **MySQL.Generator.TYPE_MAPPING, 117 exp.DataType.Type.TEXT: "STRING", 118 exp.DataType.Type.TIMESTAMP: "DATETIME", 119 exp.DataType.Type.TIMESTAMPTZ: "DATETIME", 120 } 121 122 PROPERTIES_LOCATION = { 123 **MySQL.Generator.PROPERTIES_LOCATION, 124 exp.UniqueKeyProperty: exp.Properties.Location.POST_SCHEMA, 125 exp.PartitionByRangeProperty: exp.Properties.Location.POST_SCHEMA, 126 } 127 128 CAST_MAPPING = {} 129 TIMESTAMP_FUNC_TYPES = set() 130 131 TRANSFORMS = { 132 **MySQL.Generator.TRANSFORMS, 133 exp.AddMonths: rename_func("MONTHS_ADD"), 134 exp.ApproxDistinct: approx_count_distinct_sql, 135 exp.ArgMax: rename_func("MAX_BY"), 136 exp.ArgMin: rename_func("MIN_BY"), 137 exp.ArrayAgg: rename_func("COLLECT_LIST"), 138 exp.ArrayToString: rename_func("ARRAY_JOIN"), 139 exp.ArrayUniqueAgg: rename_func("COLLECT_SET"), 140 exp.CurrentTimestamp: lambda self, _: self.func("NOW"), 141 exp.DateTrunc: lambda self, e: self.func("DATE_TRUNC", e.this, unit_to_str(e)), 142 exp.GroupConcat: lambda self, e: self.func( 143 "GROUP_CONCAT", e.this, e.args.get("separator") or exp.Literal.string(",") 144 ), 145 exp.JSONExtractScalar: lambda self, e: self.func("JSON_EXTRACT", e.this, e.expression), 146 exp.Lag: _lag_lead_sql, 147 exp.Lead: _lag_lead_sql, 148 exp.Map: rename_func("ARRAY_MAP"), 149 exp.Property: property_sql, 150 exp.RegexpLike: rename_func("REGEXP"), 151 exp.RegexpSplit: rename_func("SPLIT_BY_STRING"), 152 exp.SchemaCommentProperty: lambda self, e: self.naked_property(e), 153 exp.Split: rename_func("SPLIT_BY_STRING"), 154 exp.StringToArray: rename_func("SPLIT_BY_STRING"), 155 exp.StrToUnix: lambda self, e: self.func("UNIX_TIMESTAMP", e.this, self.format_time(e)), 156 exp.TimeStrToDate: rename_func("TO_DATE"), 157 exp.TsOrDsAdd: lambda self, e: self.func("DATE_ADD", e.this, e.expression), 158 exp.TsOrDsToDate: lambda self, e: self.func("TO_DATE", e.this), 159 exp.TimeToUnix: rename_func("UNIX_TIMESTAMP"), 160 exp.TimestampTrunc: lambda self, e: self.func("DATE_TRUNC", e.this, unit_to_str(e)), 161 exp.UnixToStr: lambda self, e: self.func( 162 "FROM_UNIXTIME", e.this, time_format("doris")(self, e) 163 ), 164 exp.UnixToTime: rename_func("FROM_UNIXTIME"), 165 } 166 167 # https://github.com/apache/doris/blob/e4f41dbf1ec03f5937fdeba2ee1454a20254015b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisLexer.g4#L93 168 RESERVED_KEYWORDS = { 169 "account_lock", 170 "account_unlock", 171 "add", 172 "adddate", 173 "admin", 174 "after", 175 "agg_state", 176 "aggregate", 177 "alias", 178 "all", 179 "alter", 180 "analyze", 181 "analyzed", 182 "and", 183 "anti", 184 "append", 185 "array", 186 "array_range", 187 "as", 188 "asc", 189 "at", 190 "authors", 191 "auto", 192 "auto_increment", 193 "backend", 194 "backends", 195 "backup", 196 "begin", 197 "belong", 198 "between", 199 "bigint", 200 "bin", 201 "binary", 202 "binlog", 203 "bitand", 204 "bitmap", 205 "bitmap_union", 206 "bitor", 207 "bitxor", 208 "blob", 209 "boolean", 210 "brief", 211 "broker", 212 "buckets", 213 "build", 214 "builtin", 215 "bulk", 216 "by", 217 "cached", 218 "call", 219 "cancel", 220 "case", 221 "cast", 222 "catalog", 223 "catalogs", 224 "chain", 225 "char", 226 "character", 227 "charset", 228 "check", 229 "clean", 230 "cluster", 231 "clusters", 232 "collate", 233 "collation", 234 "collect", 235 "column", 236 "columns", 237 "comment", 238 "commit", 239 "committed", 240 "compact", 241 "complete", 242 "config", 243 "connection", 244 "connection_id", 245 "consistent", 246 "constraint", 247 "constraints", 248 "convert", 249 "copy", 250 "count", 251 "create", 252 "creation", 253 "cron", 254 "cross", 255 "cube", 256 "current", 257 "current_catalog", 258 "current_date", 259 "current_time", 260 "current_timestamp", 261 "current_user", 262 "data", 263 "database", 264 "databases", 265 "date", 266 "date_add", 267 "date_ceil", 268 "date_diff", 269 "date_floor", 270 "date_sub", 271 "dateadd", 272 "datediff", 273 "datetime", 274 "datetimev2", 275 "datev2", 276 "datetimev1", 277 "datev1", 278 "day", 279 "days_add", 280 "days_sub", 281 "decimal", 282 "decimalv2", 283 "decimalv3", 284 "decommission", 285 "default", 286 "deferred", 287 "delete", 288 "demand", 289 "desc", 290 "describe", 291 "diagnose", 292 "disk", 293 "distinct", 294 "distinctpc", 295 "distinctpcsa", 296 "distributed", 297 "distribution", 298 "div", 299 "do", 300 "doris_internal_table_id", 301 "double", 302 "drop", 303 "dropp", 304 "dual", 305 "duplicate", 306 "dynamic", 307 "else", 308 "enable", 309 "encryptkey", 310 "encryptkeys", 311 "end", 312 "ends", 313 "engine", 314 "engines", 315 "enter", 316 "errors", 317 "events", 318 "every", 319 "except", 320 "exclude", 321 "execute", 322 "exists", 323 "expired", 324 "explain", 325 "export", 326 "extended", 327 "external", 328 "extract", 329 "failed_login_attempts", 330 "false", 331 "fast", 332 "feature", 333 "fields", 334 "file", 335 "filter", 336 "first", 337 "float", 338 "follower", 339 "following", 340 "for", 341 "foreign", 342 "force", 343 "format", 344 "free", 345 "from", 346 "frontend", 347 "frontends", 348 "full", 349 "function", 350 "functions", 351 "generic", 352 "global", 353 "grant", 354 "grants", 355 "graph", 356 "group", 357 "grouping", 358 "groups", 359 "hash", 360 "having", 361 "hdfs", 362 "help", 363 "histogram", 364 "hll", 365 "hll_union", 366 "hostname", 367 "hour", 368 "hub", 369 "identified", 370 "if", 371 "ignore", 372 "immediate", 373 "in", 374 "incremental", 375 "index", 376 "indexes", 377 "infile", 378 "inner", 379 "insert", 380 "install", 381 "int", 382 "integer", 383 "intermediate", 384 "intersect", 385 "interval", 386 "into", 387 "inverted", 388 "ipv4", 389 "ipv6", 390 "is", 391 "is_not_null_pred", 392 "is_null_pred", 393 "isnull", 394 "isolation", 395 "job", 396 "jobs", 397 "join", 398 "json", 399 "jsonb", 400 "key", 401 "keys", 402 "kill", 403 "label", 404 "largeint", 405 "last", 406 "lateral", 407 "ldap", 408 "ldap_admin_password", 409 "left", 410 "less", 411 "level", 412 "like", 413 "limit", 414 "lines", 415 "link", 416 "list", 417 "load", 418 "local", 419 "localtime", 420 "localtimestamp", 421 "location", 422 "lock", 423 "logical", 424 "low_priority", 425 "manual", 426 "map", 427 "match", 428 "match_all", 429 "match_any", 430 "match_phrase", 431 "match_phrase_edge", 432 "match_phrase_prefix", 433 "match_regexp", 434 "materialized", 435 "max", 436 "maxvalue", 437 "memo", 438 "merge", 439 "migrate", 440 "migrations", 441 "min", 442 "minus", 443 "minute", 444 "modify", 445 "month", 446 "mtmv", 447 "name", 448 "names", 449 "natural", 450 "negative", 451 "never", 452 "next", 453 "ngram_bf", 454 "no", 455 "non_nullable", 456 "not", 457 "null", 458 "nulls", 459 "observer", 460 "of", 461 "offset", 462 "on", 463 "only", 464 "open", 465 "optimized", 466 "or", 467 "order", 468 "outer", 469 "outfile", 470 "over", 471 "overwrite", 472 "parameter", 473 "parsed", 474 "partition", 475 "partitions", 476 "password", 477 "password_expire", 478 "password_history", 479 "password_lock_time", 480 "password_reuse", 481 "path", 482 "pause", 483 "percent", 484 "period", 485 "permissive", 486 "physical", 487 "plan", 488 "process", 489 "plugin", 490 "plugins", 491 "policy", 492 "preceding", 493 "prepare", 494 "primary", 495 "proc", 496 "procedure", 497 "processlist", 498 "profile", 499 "properties", 500 "property", 501 "quantile_state", 502 "quantile_union", 503 "query", 504 "quota", 505 "random", 506 "range", 507 "read", 508 "real", 509 "rebalance", 510 "recover", 511 "recycle", 512 "refresh", 513 "references", 514 "regexp", 515 "release", 516 "rename", 517 "repair", 518 "repeatable", 519 "replace", 520 "replace_if_not_null", 521 "replica", 522 "repositories", 523 "repository", 524 "resource", 525 "resources", 526 "restore", 527 "restrictive", 528 "resume", 529 "returns", 530 "revoke", 531 "rewritten", 532 "right", 533 "rlike", 534 "role", 535 "roles", 536 "rollback", 537 "rollup", 538 "routine", 539 "row", 540 "rows", 541 "s3", 542 "sample", 543 "schedule", 544 "scheduler", 545 "schema", 546 "schemas", 547 "second", 548 "select", 549 "semi", 550 "sequence", 551 "serializable", 552 "session", 553 "set", 554 "sets", 555 "shape", 556 "show", 557 "signed", 558 "skew", 559 "smallint", 560 "snapshot", 561 "soname", 562 "split", 563 "sql_block_rule", 564 "start", 565 "starts", 566 "stats", 567 "status", 568 "stop", 569 "storage", 570 "stream", 571 "streaming", 572 "string", 573 "struct", 574 "subdate", 575 "sum", 576 "superuser", 577 "switch", 578 "sync", 579 "system", 580 "table", 581 "tables", 582 "tablesample", 583 "tablet", 584 "tablets", 585 "task", 586 "tasks", 587 "temporary", 588 "terminated", 589 "text", 590 "than", 591 "then", 592 "time", 593 "timestamp", 594 "timestampadd", 595 "timestampdiff", 596 "tinyint", 597 "to", 598 "transaction", 599 "trash", 600 "tree", 601 "triggers", 602 "trim", 603 "true", 604 "truncate", 605 "type", 606 "type_cast", 607 "types", 608 "unbounded", 609 "uncommitted", 610 "uninstall", 611 "union", 612 "unique", 613 "unlock", 614 "unsigned", 615 "update", 616 "use", 617 "user", 618 "using", 619 "value", 620 "values", 621 "varchar", 622 "variables", 623 "variant", 624 "vault", 625 "verbose", 626 "version", 627 "view", 628 "warnings", 629 "week", 630 "when", 631 "where", 632 "whitelist", 633 "with", 634 "work", 635 "workload", 636 "write", 637 "xor", 638 "year", 639 } 640 641 def partition_sql(self, expression: exp.Partition) -> str: 642 parent = expression.parent 643 if isinstance(parent, exp.PartitionByRangeProperty): 644 return ", ".join(self.sql(e) for e in expression.expressions) 645 return super().partition_sql(expression) 646 647 def partitionrange_sql(self, expression: exp.PartitionRange) -> str: 648 name = self.sql(expression, "this") 649 values = expression.expressions 650 651 if len(values) != 1: 652 # Multiple values: use VALUES [ ... ) 653 if values and isinstance(values[0], list): 654 values_sql = ", ".join( 655 f"({', '.join(self.sql(v) for v in inner)})" for inner in values 656 ) 657 else: 658 values_sql = ", ".join(f"({self.sql(v)})" for v in values) 659 660 return f"PARTITION {name} VALUES [{values_sql})" 661 662 return f"PARTITION {name} VALUES LESS THAN ({self.sql(values[0])})" 663 664 def partitionbyrangepropertydynamic_sql(self, expression): 665 # Generates: FROM ("start") TO ("end") INTERVAL N UNIT 666 start = self.sql(expression, "start") 667 end = self.sql(expression, "end") 668 every = expression.args.get("every") 669 670 if every: 671 number = self.sql(every, "this") 672 interval = f"INTERVAL {number} {self.sql(every, 'unit')}" 673 else: 674 interval = "" 675 676 return f"FROM ({start}) TO ({end}) {interval}" 677 678 def partitionbyrangeproperty_sql(self, expression): 679 partition_expressions = ", ".join( 680 self.sql(e) for e in expression.args.get("partition_expressions") or [] 681 ) 682 create_expressions = expression.args.get("create_expressions") or [] 683 # Handle both static and dynamic partition definitions 684 create_sql = ", ".join(self.sql(e) for e in create_expressions) 685 return f"PARTITION BY RANGE ({partition_expressions}) ({create_sql})"
26class Doris(MySQL): 27 DATE_FORMAT = "'yyyy-MM-dd'" 28 DATEINT_FORMAT = "'yyyyMMdd'" 29 TIME_FORMAT = "'yyyy-MM-dd HH:mm:ss'" 30 31 class Parser(MySQL.Parser): 32 FUNCTIONS = { 33 **MySQL.Parser.FUNCTIONS, 34 "COLLECT_SET": exp.ArrayUniqueAgg.from_arg_list, 35 "DATE_TRUNC": build_timestamp_trunc, 36 "MONTHS_ADD": exp.AddMonths.from_arg_list, 37 "REGEXP": exp.RegexpLike.from_arg_list, 38 "TO_DATE": exp.TsOrDsToDate.from_arg_list, 39 } 40 41 FUNCTION_PARSERS = MySQL.Parser.FUNCTION_PARSERS.copy() 42 FUNCTION_PARSERS.pop("GROUP_CONCAT") 43 44 PROPERTY_PARSERS = { 45 **MySQL.Parser.PROPERTY_PARSERS, 46 "PROPERTIES": lambda self: self._parse_wrapped_properties(), 47 "UNIQUE": lambda self: self._parse_composite_key_property(exp.UniqueKeyProperty), 48 "PARTITION BY": lambda self: self._parse_partition_by_opt_range(), 49 } 50 51 def _parse_partitioning_granularity_dynamic(self) -> exp.PartitionByRangePropertyDynamic: 52 self._match_text_seq("FROM") 53 start = self._parse_wrapped(self._parse_string) 54 self._match_text_seq("TO") 55 end = self._parse_wrapped(self._parse_string) 56 self._match_text_seq("INTERVAL") 57 number = self._parse_number() 58 unit = self._parse_var(any_token=True) 59 every = self.expression(exp.Interval, this=number, unit=unit) 60 return self.expression( 61 exp.PartitionByRangePropertyDynamic, start=start, end=end, every=every 62 ) 63 64 def _parse_partition_definition(self) -> exp.Partition: 65 self._match_text_seq("PARTITION") 66 67 name = self._parse_id_var() 68 self._match_text_seq("VALUES") 69 70 if self._match_text_seq("LESS", "THAN"): 71 values = self._parse_wrapped_csv(self._parse_expression) 72 if len(values) == 1 and values[0].name.upper() == "MAXVALUE": 73 values = [exp.var("MAXVALUE")] 74 75 part_range = self.expression(exp.PartitionRange, this=name, expressions=values) 76 return self.expression(exp.Partition, expressions=[part_range]) 77 78 self._match(TokenType.L_BRACKET) 79 values = self._parse_csv(lambda: self._parse_wrapped_csv(self._parse_expression)) 80 81 self._match(TokenType.R_BRACKET) 82 self._match(TokenType.R_PAREN) 83 84 part_range = self.expression(exp.PartitionRange, this=name, expressions=values) 85 return self.expression(exp.Partition, expressions=[part_range]) 86 87 def _parse_partition_by_opt_range( 88 self, 89 ) -> exp.PartitionedByProperty | exp.PartitionByRangeProperty: 90 if not self._match_text_seq("RANGE"): 91 return super()._parse_partitioned_by() 92 93 partition_expressions = self._parse_wrapped_id_vars() 94 self._match_l_paren() 95 96 if self._match_text_seq("FROM", advance=False): 97 create_expressions = self._parse_csv(self._parse_partitioning_granularity_dynamic) 98 elif self._match_text_seq("PARTITION", advance=False): 99 create_expressions = self._parse_csv(self._parse_partition_definition) 100 else: 101 create_expressions = None 102 103 self._match_r_paren() 104 105 return self.expression( 106 exp.PartitionByRangeProperty, 107 partition_expressions=partition_expressions, 108 create_expressions=create_expressions, 109 ) 110 111 class Generator(MySQL.Generator): 112 LAST_DAY_SUPPORTS_DATE_PART = False 113 VARCHAR_REQUIRES_SIZE = False 114 WITH_PROPERTIES_PREFIX = "PROPERTIES" 115 116 TYPE_MAPPING = { 117 **MySQL.Generator.TYPE_MAPPING, 118 exp.DataType.Type.TEXT: "STRING", 119 exp.DataType.Type.TIMESTAMP: "DATETIME", 120 exp.DataType.Type.TIMESTAMPTZ: "DATETIME", 121 } 122 123 PROPERTIES_LOCATION = { 124 **MySQL.Generator.PROPERTIES_LOCATION, 125 exp.UniqueKeyProperty: exp.Properties.Location.POST_SCHEMA, 126 exp.PartitionByRangeProperty: exp.Properties.Location.POST_SCHEMA, 127 } 128 129 CAST_MAPPING = {} 130 TIMESTAMP_FUNC_TYPES = set() 131 132 TRANSFORMS = { 133 **MySQL.Generator.TRANSFORMS, 134 exp.AddMonths: rename_func("MONTHS_ADD"), 135 exp.ApproxDistinct: approx_count_distinct_sql, 136 exp.ArgMax: rename_func("MAX_BY"), 137 exp.ArgMin: rename_func("MIN_BY"), 138 exp.ArrayAgg: rename_func("COLLECT_LIST"), 139 exp.ArrayToString: rename_func("ARRAY_JOIN"), 140 exp.ArrayUniqueAgg: rename_func("COLLECT_SET"), 141 exp.CurrentTimestamp: lambda self, _: self.func("NOW"), 142 exp.DateTrunc: lambda self, e: self.func("DATE_TRUNC", e.this, unit_to_str(e)), 143 exp.GroupConcat: lambda self, e: self.func( 144 "GROUP_CONCAT", e.this, e.args.get("separator") or exp.Literal.string(",") 145 ), 146 exp.JSONExtractScalar: lambda self, e: self.func("JSON_EXTRACT", e.this, e.expression), 147 exp.Lag: _lag_lead_sql, 148 exp.Lead: _lag_lead_sql, 149 exp.Map: rename_func("ARRAY_MAP"), 150 exp.Property: property_sql, 151 exp.RegexpLike: rename_func("REGEXP"), 152 exp.RegexpSplit: rename_func("SPLIT_BY_STRING"), 153 exp.SchemaCommentProperty: lambda self, e: self.naked_property(e), 154 exp.Split: rename_func("SPLIT_BY_STRING"), 155 exp.StringToArray: rename_func("SPLIT_BY_STRING"), 156 exp.StrToUnix: lambda self, e: self.func("UNIX_TIMESTAMP", e.this, self.format_time(e)), 157 exp.TimeStrToDate: rename_func("TO_DATE"), 158 exp.TsOrDsAdd: lambda self, e: self.func("DATE_ADD", e.this, e.expression), 159 exp.TsOrDsToDate: lambda self, e: self.func("TO_DATE", e.this), 160 exp.TimeToUnix: rename_func("UNIX_TIMESTAMP"), 161 exp.TimestampTrunc: lambda self, e: self.func("DATE_TRUNC", e.this, unit_to_str(e)), 162 exp.UnixToStr: lambda self, e: self.func( 163 "FROM_UNIXTIME", e.this, time_format("doris")(self, e) 164 ), 165 exp.UnixToTime: rename_func("FROM_UNIXTIME"), 166 } 167 168 # https://github.com/apache/doris/blob/e4f41dbf1ec03f5937fdeba2ee1454a20254015b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisLexer.g4#L93 169 RESERVED_KEYWORDS = { 170 "account_lock", 171 "account_unlock", 172 "add", 173 "adddate", 174 "admin", 175 "after", 176 "agg_state", 177 "aggregate", 178 "alias", 179 "all", 180 "alter", 181 "analyze", 182 "analyzed", 183 "and", 184 "anti", 185 "append", 186 "array", 187 "array_range", 188 "as", 189 "asc", 190 "at", 191 "authors", 192 "auto", 193 "auto_increment", 194 "backend", 195 "backends", 196 "backup", 197 "begin", 198 "belong", 199 "between", 200 "bigint", 201 "bin", 202 "binary", 203 "binlog", 204 "bitand", 205 "bitmap", 206 "bitmap_union", 207 "bitor", 208 "bitxor", 209 "blob", 210 "boolean", 211 "brief", 212 "broker", 213 "buckets", 214 "build", 215 "builtin", 216 "bulk", 217 "by", 218 "cached", 219 "call", 220 "cancel", 221 "case", 222 "cast", 223 "catalog", 224 "catalogs", 225 "chain", 226 "char", 227 "character", 228 "charset", 229 "check", 230 "clean", 231 "cluster", 232 "clusters", 233 "collate", 234 "collation", 235 "collect", 236 "column", 237 "columns", 238 "comment", 239 "commit", 240 "committed", 241 "compact", 242 "complete", 243 "config", 244 "connection", 245 "connection_id", 246 "consistent", 247 "constraint", 248 "constraints", 249 "convert", 250 "copy", 251 "count", 252 "create", 253 "creation", 254 "cron", 255 "cross", 256 "cube", 257 "current", 258 "current_catalog", 259 "current_date", 260 "current_time", 261 "current_timestamp", 262 "current_user", 263 "data", 264 "database", 265 "databases", 266 "date", 267 "date_add", 268 "date_ceil", 269 "date_diff", 270 "date_floor", 271 "date_sub", 272 "dateadd", 273 "datediff", 274 "datetime", 275 "datetimev2", 276 "datev2", 277 "datetimev1", 278 "datev1", 279 "day", 280 "days_add", 281 "days_sub", 282 "decimal", 283 "decimalv2", 284 "decimalv3", 285 "decommission", 286 "default", 287 "deferred", 288 "delete", 289 "demand", 290 "desc", 291 "describe", 292 "diagnose", 293 "disk", 294 "distinct", 295 "distinctpc", 296 "distinctpcsa", 297 "distributed", 298 "distribution", 299 "div", 300 "do", 301 "doris_internal_table_id", 302 "double", 303 "drop", 304 "dropp", 305 "dual", 306 "duplicate", 307 "dynamic", 308 "else", 309 "enable", 310 "encryptkey", 311 "encryptkeys", 312 "end", 313 "ends", 314 "engine", 315 "engines", 316 "enter", 317 "errors", 318 "events", 319 "every", 320 "except", 321 "exclude", 322 "execute", 323 "exists", 324 "expired", 325 "explain", 326 "export", 327 "extended", 328 "external", 329 "extract", 330 "failed_login_attempts", 331 "false", 332 "fast", 333 "feature", 334 "fields", 335 "file", 336 "filter", 337 "first", 338 "float", 339 "follower", 340 "following", 341 "for", 342 "foreign", 343 "force", 344 "format", 345 "free", 346 "from", 347 "frontend", 348 "frontends", 349 "full", 350 "function", 351 "functions", 352 "generic", 353 "global", 354 "grant", 355 "grants", 356 "graph", 357 "group", 358 "grouping", 359 "groups", 360 "hash", 361 "having", 362 "hdfs", 363 "help", 364 "histogram", 365 "hll", 366 "hll_union", 367 "hostname", 368 "hour", 369 "hub", 370 "identified", 371 "if", 372 "ignore", 373 "immediate", 374 "in", 375 "incremental", 376 "index", 377 "indexes", 378 "infile", 379 "inner", 380 "insert", 381 "install", 382 "int", 383 "integer", 384 "intermediate", 385 "intersect", 386 "interval", 387 "into", 388 "inverted", 389 "ipv4", 390 "ipv6", 391 "is", 392 "is_not_null_pred", 393 "is_null_pred", 394 "isnull", 395 "isolation", 396 "job", 397 "jobs", 398 "join", 399 "json", 400 "jsonb", 401 "key", 402 "keys", 403 "kill", 404 "label", 405 "largeint", 406 "last", 407 "lateral", 408 "ldap", 409 "ldap_admin_password", 410 "left", 411 "less", 412 "level", 413 "like", 414 "limit", 415 "lines", 416 "link", 417 "list", 418 "load", 419 "local", 420 "localtime", 421 "localtimestamp", 422 "location", 423 "lock", 424 "logical", 425 "low_priority", 426 "manual", 427 "map", 428 "match", 429 "match_all", 430 "match_any", 431 "match_phrase", 432 "match_phrase_edge", 433 "match_phrase_prefix", 434 "match_regexp", 435 "materialized", 436 "max", 437 "maxvalue", 438 "memo", 439 "merge", 440 "migrate", 441 "migrations", 442 "min", 443 "minus", 444 "minute", 445 "modify", 446 "month", 447 "mtmv", 448 "name", 449 "names", 450 "natural", 451 "negative", 452 "never", 453 "next", 454 "ngram_bf", 455 "no", 456 "non_nullable", 457 "not", 458 "null", 459 "nulls", 460 "observer", 461 "of", 462 "offset", 463 "on", 464 "only", 465 "open", 466 "optimized", 467 "or", 468 "order", 469 "outer", 470 "outfile", 471 "over", 472 "overwrite", 473 "parameter", 474 "parsed", 475 "partition", 476 "partitions", 477 "password", 478 "password_expire", 479 "password_history", 480 "password_lock_time", 481 "password_reuse", 482 "path", 483 "pause", 484 "percent", 485 "period", 486 "permissive", 487 "physical", 488 "plan", 489 "process", 490 "plugin", 491 "plugins", 492 "policy", 493 "preceding", 494 "prepare", 495 "primary", 496 "proc", 497 "procedure", 498 "processlist", 499 "profile", 500 "properties", 501 "property", 502 "quantile_state", 503 "quantile_union", 504 "query", 505 "quota", 506 "random", 507 "range", 508 "read", 509 "real", 510 "rebalance", 511 "recover", 512 "recycle", 513 "refresh", 514 "references", 515 "regexp", 516 "release", 517 "rename", 518 "repair", 519 "repeatable", 520 "replace", 521 "replace_if_not_null", 522 "replica", 523 "repositories", 524 "repository", 525 "resource", 526 "resources", 527 "restore", 528 "restrictive", 529 "resume", 530 "returns", 531 "revoke", 532 "rewritten", 533 "right", 534 "rlike", 535 "role", 536 "roles", 537 "rollback", 538 "rollup", 539 "routine", 540 "row", 541 "rows", 542 "s3", 543 "sample", 544 "schedule", 545 "scheduler", 546 "schema", 547 "schemas", 548 "second", 549 "select", 550 "semi", 551 "sequence", 552 "serializable", 553 "session", 554 "set", 555 "sets", 556 "shape", 557 "show", 558 "signed", 559 "skew", 560 "smallint", 561 "snapshot", 562 "soname", 563 "split", 564 "sql_block_rule", 565 "start", 566 "starts", 567 "stats", 568 "status", 569 "stop", 570 "storage", 571 "stream", 572 "streaming", 573 "string", 574 "struct", 575 "subdate", 576 "sum", 577 "superuser", 578 "switch", 579 "sync", 580 "system", 581 "table", 582 "tables", 583 "tablesample", 584 "tablet", 585 "tablets", 586 "task", 587 "tasks", 588 "temporary", 589 "terminated", 590 "text", 591 "than", 592 "then", 593 "time", 594 "timestamp", 595 "timestampadd", 596 "timestampdiff", 597 "tinyint", 598 "to", 599 "transaction", 600 "trash", 601 "tree", 602 "triggers", 603 "trim", 604 "true", 605 "truncate", 606 "type", 607 "type_cast", 608 "types", 609 "unbounded", 610 "uncommitted", 611 "uninstall", 612 "union", 613 "unique", 614 "unlock", 615 "unsigned", 616 "update", 617 "use", 618 "user", 619 "using", 620 "value", 621 "values", 622 "varchar", 623 "variables", 624 "variant", 625 "vault", 626 "verbose", 627 "version", 628 "view", 629 "warnings", 630 "week", 631 "when", 632 "where", 633 "whitelist", 634 "with", 635 "work", 636 "workload", 637 "write", 638 "xor", 639 "year", 640 } 641 642 def partition_sql(self, expression: exp.Partition) -> str: 643 parent = expression.parent 644 if isinstance(parent, exp.PartitionByRangeProperty): 645 return ", ".join(self.sql(e) for e in expression.expressions) 646 return super().partition_sql(expression) 647 648 def partitionrange_sql(self, expression: exp.PartitionRange) -> str: 649 name = self.sql(expression, "this") 650 values = expression.expressions 651 652 if len(values) != 1: 653 # Multiple values: use VALUES [ ... ) 654 if values and isinstance(values[0], list): 655 values_sql = ", ".join( 656 f"({', '.join(self.sql(v) for v in inner)})" for inner in values 657 ) 658 else: 659 values_sql = ", ".join(f"({self.sql(v)})" for v in values) 660 661 return f"PARTITION {name} VALUES [{values_sql})" 662 663 return f"PARTITION {name} VALUES LESS THAN ({self.sql(values[0])})" 664 665 def partitionbyrangepropertydynamic_sql(self, expression): 666 # Generates: FROM ("start") TO ("end") INTERVAL N UNIT 667 start = self.sql(expression, "start") 668 end = self.sql(expression, "end") 669 every = expression.args.get("every") 670 671 if every: 672 number = self.sql(every, "this") 673 interval = f"INTERVAL {number} {self.sql(every, 'unit')}" 674 else: 675 interval = "" 676 677 return f"FROM ({start}) TO ({end}) {interval}" 678 679 def partitionbyrangeproperty_sql(self, expression): 680 partition_expressions = ", ".join( 681 self.sql(e) for e in expression.args.get("partition_expressions") or [] 682 ) 683 create_expressions = expression.args.get("create_expressions") or [] 684 # Handle both static and dynamic partition definitions 685 create_sql = ", ".join(self.sql(e) for e in create_expressions) 686 return f"PARTITION BY RANGE ({partition_expressions}) ({create_sql})"
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}}}
31 class Parser(MySQL.Parser): 32 FUNCTIONS = { 33 **MySQL.Parser.FUNCTIONS, 34 "COLLECT_SET": exp.ArrayUniqueAgg.from_arg_list, 35 "DATE_TRUNC": build_timestamp_trunc, 36 "MONTHS_ADD": exp.AddMonths.from_arg_list, 37 "REGEXP": exp.RegexpLike.from_arg_list, 38 "TO_DATE": exp.TsOrDsToDate.from_arg_list, 39 } 40 41 FUNCTION_PARSERS = MySQL.Parser.FUNCTION_PARSERS.copy() 42 FUNCTION_PARSERS.pop("GROUP_CONCAT") 43 44 PROPERTY_PARSERS = { 45 **MySQL.Parser.PROPERTY_PARSERS, 46 "PROPERTIES": lambda self: self._parse_wrapped_properties(), 47 "UNIQUE": lambda self: self._parse_composite_key_property(exp.UniqueKeyProperty), 48 "PARTITION BY": lambda self: self._parse_partition_by_opt_range(), 49 } 50 51 def _parse_partitioning_granularity_dynamic(self) -> exp.PartitionByRangePropertyDynamic: 52 self._match_text_seq("FROM") 53 start = self._parse_wrapped(self._parse_string) 54 self._match_text_seq("TO") 55 end = self._parse_wrapped(self._parse_string) 56 self._match_text_seq("INTERVAL") 57 number = self._parse_number() 58 unit = self._parse_var(any_token=True) 59 every = self.expression(exp.Interval, this=number, unit=unit) 60 return self.expression( 61 exp.PartitionByRangePropertyDynamic, start=start, end=end, every=every 62 ) 63 64 def _parse_partition_definition(self) -> exp.Partition: 65 self._match_text_seq("PARTITION") 66 67 name = self._parse_id_var() 68 self._match_text_seq("VALUES") 69 70 if self._match_text_seq("LESS", "THAN"): 71 values = self._parse_wrapped_csv(self._parse_expression) 72 if len(values) == 1 and values[0].name.upper() == "MAXVALUE": 73 values = [exp.var("MAXVALUE")] 74 75 part_range = self.expression(exp.PartitionRange, this=name, expressions=values) 76 return self.expression(exp.Partition, expressions=[part_range]) 77 78 self._match(TokenType.L_BRACKET) 79 values = self._parse_csv(lambda: self._parse_wrapped_csv(self._parse_expression)) 80 81 self._match(TokenType.R_BRACKET) 82 self._match(TokenType.R_PAREN) 83 84 part_range = self.expression(exp.PartitionRange, this=name, expressions=values) 85 return self.expression(exp.Partition, expressions=[part_range]) 86 87 def _parse_partition_by_opt_range( 88 self, 89 ) -> exp.PartitionedByProperty | exp.PartitionByRangeProperty: 90 if not self._match_text_seq("RANGE"): 91 return super()._parse_partitioned_by() 92 93 partition_expressions = self._parse_wrapped_id_vars() 94 self._match_l_paren() 95 96 if self._match_text_seq("FROM", advance=False): 97 create_expressions = self._parse_csv(self._parse_partitioning_granularity_dynamic) 98 elif self._match_text_seq("PARTITION", advance=False): 99 create_expressions = self._parse_csv(self._parse_partition_definition) 100 else: 101 create_expressions = None 102 103 self._match_r_paren() 104 105 return self.expression( 106 exp.PartitionByRangeProperty, 107 partition_expressions=partition_expressions, 108 create_expressions=create_expressions, 109 )
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'>>, '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>, '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_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_timestamp_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'>>, '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_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'>>, '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'>>, '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_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>>}
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.GEOGRAPHYPOINT: 'GEOGRAPHYPOINT'>, <TokenType.PUT: 'PUT'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.YEAR: 'YEAR'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.LIST: 'LIST'>, <TokenType.EXPORT: 'EXPORT'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.BLOB: 'BLOB'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.DIV: 'DIV'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.ANTI: 'ANTI'>, <TokenType.COPY: 'COPY'>, <TokenType.UINT: 'UINT'>, <TokenType.TOP: 'TOP'>, <TokenType.FALSE: 'FALSE'>, <TokenType.TIME: 'TIME'>, <TokenType.INT: 'INT'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.TRUE: 'TRUE'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.REFERENCES: 'REFERENCES'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.NAME: 'NAME'>, <TokenType.CURRENT_SCHEMA: 'CURRENT_SCHEMA'>, <TokenType.SOME: 'SOME'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.DATE32: 'DATE32'>, <TokenType.VAR: 'VAR'>, <TokenType.SOURCE: 'SOURCE'>, <TokenType.SEMANTIC_VIEW: 'SEMANTIC_VIEW'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.FILE_FORMAT: 'FILE_FORMAT'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.ATTACH: 'ATTACH'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.MERGE: 'MERGE'>, <TokenType.POINT: 'POINT'>, <TokenType.NAMESPACE: 'NAMESPACE'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.ASC: 'ASC'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.BIT: 'BIT'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.END: 'END'>, <TokenType.UUID: 'UUID'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.MODEL: 'MODEL'>, <TokenType.INDEX: 'INDEX'>, <TokenType.ANY: 'ANY'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.TAG: 'TAG'>, <TokenType.INT128: 'INT128'>, <TokenType.GET: 'GET'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.RANGE: 'RANGE'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.NULL: 'NULL'>, <TokenType.ENUM: 'ENUM'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.UINT128: 'UINT128'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.MONEY: 'MONEY'>, <TokenType.DYNAMIC: 'DYNAMIC'>, <TokenType.CUBE: 'CUBE'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.SHOW: 'SHOW'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.SETTINGS: 'SETTINGS'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.NESTED: 'NESTED'>, <TokenType.CHAR: 'CHAR'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.JSON: 'JSON'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.VOID: 'VOID'>, <TokenType.TABLE: 'TABLE'>, <TokenType.FINAL: 'FINAL'>, <TokenType.WAREHOUSE: 'WAREHOUSE'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.MULTILINESTRING: 'MULTILINESTRING'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.LINESTRING: 'LINESTRING'>, <TokenType.INT256: 'INT256'>, <TokenType.KILL: 'KILL'>, <TokenType.ROLLUP: 'ROLLUP'>, <TokenType.BINARY: 'BINARY'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.UINT256: 'UINT256'>, <TokenType.SINK: 'SINK'>, <TokenType.LIMIT: 'LIMIT'>, <TokenType.SMALLDATETIME: 'SMALLDATETIME'>, <TokenType.RING: 'RING'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.ROW: 'ROW'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.DECIMAL64: 'DECIMAL64'>, <TokenType.FORMAT: 'FORMAT'>, <TokenType.UNIQUE: 'UNIQUE'>, <TokenType.LOAD: 'LOAD'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.MULTIPOLYGON: 'MULTIPOLYGON'>, <TokenType.IS: 'IS'>, <TokenType.POLYGON: 'POLYGON'>, <TokenType.DECIMAL32: 'DECIMAL32'>, <TokenType.TEXT: 'TEXT'>, <TokenType.VIEW: 'VIEW'>, <TokenType.DECIMAL128: 'DECIMAL128'>, <TokenType.NOTHING: 'NOTHING'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.NEXT: 'NEXT'>, <TokenType.IPV6: 'IPV6'>, <TokenType.DELETE: 'DELETE'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.XML: 'XML'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.DESC: 'DESC'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.DETACH: 'DETACH'>, <TokenType.DATE: 'DATE'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.DECIMAL256: 'DECIMAL256'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.ALL: 'ALL'>, <TokenType.KEEP: 'KEEP'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.SEMI: 'SEMI'>, <TokenType.CASE: 'CASE'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.PROCEDURE: 'PROCEDURE'>, <TokenType.ORDINALITY: 'ORDINALITY'>, <TokenType.FILTER: 'FILTER'>, <TokenType.STORAGE_INTEGRATION: 'STORAGE_INTEGRATION'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.INET: 'INET'>, <TokenType.STREAMLIT: 'STREAMLIT'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.MAP: 'MAP'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.STAGE: 'STAGE'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.UDOUBLE: 'UDOUBLE'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.SET: 'SET'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.ROWS: 'ROWS'>, <TokenType.FIRST: 'FIRST'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.DATETIME2: 'DATETIME2'>, <TokenType.SUPER: 'SUPER'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.RENAME: 'RENAME'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.IPV4: 'IPV4'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.JSONB: 'JSONB'>, <TokenType.CACHE: 'CACHE'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.TRUNCATE: 'TRUNCATE'>}
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
- NO_PAREN_FUNCTIONS
- 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
111 class Generator(MySQL.Generator): 112 LAST_DAY_SUPPORTS_DATE_PART = False 113 VARCHAR_REQUIRES_SIZE = False 114 WITH_PROPERTIES_PREFIX = "PROPERTIES" 115 116 TYPE_MAPPING = { 117 **MySQL.Generator.TYPE_MAPPING, 118 exp.DataType.Type.TEXT: "STRING", 119 exp.DataType.Type.TIMESTAMP: "DATETIME", 120 exp.DataType.Type.TIMESTAMPTZ: "DATETIME", 121 } 122 123 PROPERTIES_LOCATION = { 124 **MySQL.Generator.PROPERTIES_LOCATION, 125 exp.UniqueKeyProperty: exp.Properties.Location.POST_SCHEMA, 126 exp.PartitionByRangeProperty: exp.Properties.Location.POST_SCHEMA, 127 } 128 129 CAST_MAPPING = {} 130 TIMESTAMP_FUNC_TYPES = set() 131 132 TRANSFORMS = { 133 **MySQL.Generator.TRANSFORMS, 134 exp.AddMonths: rename_func("MONTHS_ADD"), 135 exp.ApproxDistinct: approx_count_distinct_sql, 136 exp.ArgMax: rename_func("MAX_BY"), 137 exp.ArgMin: rename_func("MIN_BY"), 138 exp.ArrayAgg: rename_func("COLLECT_LIST"), 139 exp.ArrayToString: rename_func("ARRAY_JOIN"), 140 exp.ArrayUniqueAgg: rename_func("COLLECT_SET"), 141 exp.CurrentTimestamp: lambda self, _: self.func("NOW"), 142 exp.DateTrunc: lambda self, e: self.func("DATE_TRUNC", e.this, unit_to_str(e)), 143 exp.GroupConcat: lambda self, e: self.func( 144 "GROUP_CONCAT", e.this, e.args.get("separator") or exp.Literal.string(",") 145 ), 146 exp.JSONExtractScalar: lambda self, e: self.func("JSON_EXTRACT", e.this, e.expression), 147 exp.Lag: _lag_lead_sql, 148 exp.Lead: _lag_lead_sql, 149 exp.Map: rename_func("ARRAY_MAP"), 150 exp.Property: property_sql, 151 exp.RegexpLike: rename_func("REGEXP"), 152 exp.RegexpSplit: rename_func("SPLIT_BY_STRING"), 153 exp.SchemaCommentProperty: lambda self, e: self.naked_property(e), 154 exp.Split: rename_func("SPLIT_BY_STRING"), 155 exp.StringToArray: rename_func("SPLIT_BY_STRING"), 156 exp.StrToUnix: lambda self, e: self.func("UNIX_TIMESTAMP", e.this, self.format_time(e)), 157 exp.TimeStrToDate: rename_func("TO_DATE"), 158 exp.TsOrDsAdd: lambda self, e: self.func("DATE_ADD", e.this, e.expression), 159 exp.TsOrDsToDate: lambda self, e: self.func("TO_DATE", e.this), 160 exp.TimeToUnix: rename_func("UNIX_TIMESTAMP"), 161 exp.TimestampTrunc: lambda self, e: self.func("DATE_TRUNC", e.this, unit_to_str(e)), 162 exp.UnixToStr: lambda self, e: self.func( 163 "FROM_UNIXTIME", e.this, time_format("doris")(self, e) 164 ), 165 exp.UnixToTime: rename_func("FROM_UNIXTIME"), 166 } 167 168 # https://github.com/apache/doris/blob/e4f41dbf1ec03f5937fdeba2ee1454a20254015b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisLexer.g4#L93 169 RESERVED_KEYWORDS = { 170 "account_lock", 171 "account_unlock", 172 "add", 173 "adddate", 174 "admin", 175 "after", 176 "agg_state", 177 "aggregate", 178 "alias", 179 "all", 180 "alter", 181 "analyze", 182 "analyzed", 183 "and", 184 "anti", 185 "append", 186 "array", 187 "array_range", 188 "as", 189 "asc", 190 "at", 191 "authors", 192 "auto", 193 "auto_increment", 194 "backend", 195 "backends", 196 "backup", 197 "begin", 198 "belong", 199 "between", 200 "bigint", 201 "bin", 202 "binary", 203 "binlog", 204 "bitand", 205 "bitmap", 206 "bitmap_union", 207 "bitor", 208 "bitxor", 209 "blob", 210 "boolean", 211 "brief", 212 "broker", 213 "buckets", 214 "build", 215 "builtin", 216 "bulk", 217 "by", 218 "cached", 219 "call", 220 "cancel", 221 "case", 222 "cast", 223 "catalog", 224 "catalogs", 225 "chain", 226 "char", 227 "character", 228 "charset", 229 "check", 230 "clean", 231 "cluster", 232 "clusters", 233 "collate", 234 "collation", 235 "collect", 236 "column", 237 "columns", 238 "comment", 239 "commit", 240 "committed", 241 "compact", 242 "complete", 243 "config", 244 "connection", 245 "connection_id", 246 "consistent", 247 "constraint", 248 "constraints", 249 "convert", 250 "copy", 251 "count", 252 "create", 253 "creation", 254 "cron", 255 "cross", 256 "cube", 257 "current", 258 "current_catalog", 259 "current_date", 260 "current_time", 261 "current_timestamp", 262 "current_user", 263 "data", 264 "database", 265 "databases", 266 "date", 267 "date_add", 268 "date_ceil", 269 "date_diff", 270 "date_floor", 271 "date_sub", 272 "dateadd", 273 "datediff", 274 "datetime", 275 "datetimev2", 276 "datev2", 277 "datetimev1", 278 "datev1", 279 "day", 280 "days_add", 281 "days_sub", 282 "decimal", 283 "decimalv2", 284 "decimalv3", 285 "decommission", 286 "default", 287 "deferred", 288 "delete", 289 "demand", 290 "desc", 291 "describe", 292 "diagnose", 293 "disk", 294 "distinct", 295 "distinctpc", 296 "distinctpcsa", 297 "distributed", 298 "distribution", 299 "div", 300 "do", 301 "doris_internal_table_id", 302 "double", 303 "drop", 304 "dropp", 305 "dual", 306 "duplicate", 307 "dynamic", 308 "else", 309 "enable", 310 "encryptkey", 311 "encryptkeys", 312 "end", 313 "ends", 314 "engine", 315 "engines", 316 "enter", 317 "errors", 318 "events", 319 "every", 320 "except", 321 "exclude", 322 "execute", 323 "exists", 324 "expired", 325 "explain", 326 "export", 327 "extended", 328 "external", 329 "extract", 330 "failed_login_attempts", 331 "false", 332 "fast", 333 "feature", 334 "fields", 335 "file", 336 "filter", 337 "first", 338 "float", 339 "follower", 340 "following", 341 "for", 342 "foreign", 343 "force", 344 "format", 345 "free", 346 "from", 347 "frontend", 348 "frontends", 349 "full", 350 "function", 351 "functions", 352 "generic", 353 "global", 354 "grant", 355 "grants", 356 "graph", 357 "group", 358 "grouping", 359 "groups", 360 "hash", 361 "having", 362 "hdfs", 363 "help", 364 "histogram", 365 "hll", 366 "hll_union", 367 "hostname", 368 "hour", 369 "hub", 370 "identified", 371 "if", 372 "ignore", 373 "immediate", 374 "in", 375 "incremental", 376 "index", 377 "indexes", 378 "infile", 379 "inner", 380 "insert", 381 "install", 382 "int", 383 "integer", 384 "intermediate", 385 "intersect", 386 "interval", 387 "into", 388 "inverted", 389 "ipv4", 390 "ipv6", 391 "is", 392 "is_not_null_pred", 393 "is_null_pred", 394 "isnull", 395 "isolation", 396 "job", 397 "jobs", 398 "join", 399 "json", 400 "jsonb", 401 "key", 402 "keys", 403 "kill", 404 "label", 405 "largeint", 406 "last", 407 "lateral", 408 "ldap", 409 "ldap_admin_password", 410 "left", 411 "less", 412 "level", 413 "like", 414 "limit", 415 "lines", 416 "link", 417 "list", 418 "load", 419 "local", 420 "localtime", 421 "localtimestamp", 422 "location", 423 "lock", 424 "logical", 425 "low_priority", 426 "manual", 427 "map", 428 "match", 429 "match_all", 430 "match_any", 431 "match_phrase", 432 "match_phrase_edge", 433 "match_phrase_prefix", 434 "match_regexp", 435 "materialized", 436 "max", 437 "maxvalue", 438 "memo", 439 "merge", 440 "migrate", 441 "migrations", 442 "min", 443 "minus", 444 "minute", 445 "modify", 446 "month", 447 "mtmv", 448 "name", 449 "names", 450 "natural", 451 "negative", 452 "never", 453 "next", 454 "ngram_bf", 455 "no", 456 "non_nullable", 457 "not", 458 "null", 459 "nulls", 460 "observer", 461 "of", 462 "offset", 463 "on", 464 "only", 465 "open", 466 "optimized", 467 "or", 468 "order", 469 "outer", 470 "outfile", 471 "over", 472 "overwrite", 473 "parameter", 474 "parsed", 475 "partition", 476 "partitions", 477 "password", 478 "password_expire", 479 "password_history", 480 "password_lock_time", 481 "password_reuse", 482 "path", 483 "pause", 484 "percent", 485 "period", 486 "permissive", 487 "physical", 488 "plan", 489 "process", 490 "plugin", 491 "plugins", 492 "policy", 493 "preceding", 494 "prepare", 495 "primary", 496 "proc", 497 "procedure", 498 "processlist", 499 "profile", 500 "properties", 501 "property", 502 "quantile_state", 503 "quantile_union", 504 "query", 505 "quota", 506 "random", 507 "range", 508 "read", 509 "real", 510 "rebalance", 511 "recover", 512 "recycle", 513 "refresh", 514 "references", 515 "regexp", 516 "release", 517 "rename", 518 "repair", 519 "repeatable", 520 "replace", 521 "replace_if_not_null", 522 "replica", 523 "repositories", 524 "repository", 525 "resource", 526 "resources", 527 "restore", 528 "restrictive", 529 "resume", 530 "returns", 531 "revoke", 532 "rewritten", 533 "right", 534 "rlike", 535 "role", 536 "roles", 537 "rollback", 538 "rollup", 539 "routine", 540 "row", 541 "rows", 542 "s3", 543 "sample", 544 "schedule", 545 "scheduler", 546 "schema", 547 "schemas", 548 "second", 549 "select", 550 "semi", 551 "sequence", 552 "serializable", 553 "session", 554 "set", 555 "sets", 556 "shape", 557 "show", 558 "signed", 559 "skew", 560 "smallint", 561 "snapshot", 562 "soname", 563 "split", 564 "sql_block_rule", 565 "start", 566 "starts", 567 "stats", 568 "status", 569 "stop", 570 "storage", 571 "stream", 572 "streaming", 573 "string", 574 "struct", 575 "subdate", 576 "sum", 577 "superuser", 578 "switch", 579 "sync", 580 "system", 581 "table", 582 "tables", 583 "tablesample", 584 "tablet", 585 "tablets", 586 "task", 587 "tasks", 588 "temporary", 589 "terminated", 590 "text", 591 "than", 592 "then", 593 "time", 594 "timestamp", 595 "timestampadd", 596 "timestampdiff", 597 "tinyint", 598 "to", 599 "transaction", 600 "trash", 601 "tree", 602 "triggers", 603 "trim", 604 "true", 605 "truncate", 606 "type", 607 "type_cast", 608 "types", 609 "unbounded", 610 "uncommitted", 611 "uninstall", 612 "union", 613 "unique", 614 "unlock", 615 "unsigned", 616 "update", 617 "use", 618 "user", 619 "using", 620 "value", 621 "values", 622 "varchar", 623 "variables", 624 "variant", 625 "vault", 626 "verbose", 627 "version", 628 "view", 629 "warnings", 630 "week", 631 "when", 632 "where", 633 "whitelist", 634 "with", 635 "work", 636 "workload", 637 "write", 638 "xor", 639 "year", 640 } 641 642 def partition_sql(self, expression: exp.Partition) -> str: 643 parent = expression.parent 644 if isinstance(parent, exp.PartitionByRangeProperty): 645 return ", ".join(self.sql(e) for e in expression.expressions) 646 return super().partition_sql(expression) 647 648 def partitionrange_sql(self, expression: exp.PartitionRange) -> str: 649 name = self.sql(expression, "this") 650 values = expression.expressions 651 652 if len(values) != 1: 653 # Multiple values: use VALUES [ ... ) 654 if values and isinstance(values[0], list): 655 values_sql = ", ".join( 656 f"({', '.join(self.sql(v) for v in inner)})" for inner in values 657 ) 658 else: 659 values_sql = ", ".join(f"({self.sql(v)})" for v in values) 660 661 return f"PARTITION {name} VALUES [{values_sql})" 662 663 return f"PARTITION {name} VALUES LESS THAN ({self.sql(values[0])})" 664 665 def partitionbyrangepropertydynamic_sql(self, expression): 666 # Generates: FROM ("start") TO ("end") INTERVAL N UNIT 667 start = self.sql(expression, "start") 668 end = self.sql(expression, "end") 669 every = expression.args.get("every") 670 671 if every: 672 number = self.sql(every, "this") 673 interval = f"INTERVAL {number} {self.sql(every, 'unit')}" 674 else: 675 interval = "" 676 677 return f"FROM ({start}) TO ({end}) {interval}" 678 679 def partitionbyrangeproperty_sql(self, expression): 680 partition_expressions = ", ".join( 681 self.sql(e) for e in expression.args.get("partition_expressions") or [] 682 ) 683 create_expressions = expression.args.get("create_expressions") or [] 684 # Handle both static and dynamic partition definitions 685 create_sql = ", ".join(self.sql(e) for e in create_expressions) 686 return f"PARTITION BY RANGE ({partition_expressions}) ({create_sql})"
Generator converts a given syntax tree to the corresponding SQL string.
Arguments:
- pretty: Whether to format the produced SQL string. Default: False.
- identify: Determines when an identifier should be quoted. Possible values are: False (default): Never quote, except in cases where it's mandatory by the dialect. True or 'always': Always quote. 'safe': Only quote identifiers that are case insensitive.
- normalize: Whether to normalize identifiers to lowercase. Default: False.
- pad: The pad size in a formatted string. For example, this affects the indentation of a projection in a query, relative to its nesting level. Default: 2.
- indent: The indentation size in a formatted string. For example, this affects the
indentation of subqueries and filters under a
WHERE
clause. Default: 2. - normalize_functions: How to normalize function names. Possible values are: "upper" or True (default): Convert names to uppercase. "lower": Convert names to lowercase. False: Disables function name normalization.
- unsupported_level: Determines the generator's behavior when it encounters unsupported expressions. Default ErrorLevel.WARN.
- max_unsupported: Maximum number of unsupported messages to include in a raised UnsupportedError. This is only relevant if unsupported_level is ErrorLevel.RAISE. Default: 3
- leading_comma: Whether the comma is leading or trailing in select expressions. This is only relevant when generating in pretty mode. Default: False
- max_text_width: The max number of characters in a segment before creating new lines in pretty mode. The default is on the smaller end because the length only represents a segment and not the true line length. Default: 80
- comments: Whether to preserve comments in the output SQL code. Default: True
TYPE_MAPPING =
{<Type.DATETIME2: 'DATETIME2'>: 'DATETIME', <Type.NCHAR: 'NCHAR'>: 'CHAR', <Type.NVARCHAR: 'NVARCHAR'>: 'VARCHAR', <Type.INET: 'INET'>: 'INET', <Type.ROWVERSION: 'ROWVERSION'>: 'VARBINARY', <Type.SMALLDATETIME: 'SMALLDATETIME'>: 'DATETIME', <Type.UBIGINT: 'UBIGINT'>: 'BIGINT', <Type.UINT: 'UINT'>: 'INT', <Type.UMEDIUMINT: 'UMEDIUMINT'>: 'MEDIUMINT', <Type.USMALLINT: 'USMALLINT'>: 'SMALLINT', <Type.UTINYINT: 'UTINYINT'>: 'TINYINT', <Type.UDECIMAL: 'UDECIMAL'>: 'DECIMAL', <Type.UDOUBLE: 'UDOUBLE'>: 'DOUBLE', <Type.TIMESTAMP: 'TIMESTAMP'>: 'DATETIME', <Type.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>: 'DATETIME', <Type.TIMESTAMPTZ: 'TIMESTAMPTZ'>: 'DATETIME', <Type.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>: 'TIMESTAMP', <Type.TEXT: 'TEXT'>: 'STRING'}
PROPERTIES_LOCATION =
{<class 'sqlglot.expressions.AllowedValuesProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.AlgorithmProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.AutoIncrementProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.AutoRefreshProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.BackupProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.BlockCompressionProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.CharacterSetProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ChecksumProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.CollateProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.CopyGrantsProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.Cluster'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ClusteredByProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DistributedByProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DuplicateKeyProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DataBlocksizeProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.DataDeletionProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DefinerProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.DictRange'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DictProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DynamicProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.DistKeyProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DistStyleProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.EmptyProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.EncodeProperty'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.EngineProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.EnviromentProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ExecuteAsProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ExternalProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.FallbackProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.FileFormatProperty'>: <Location.POST_WITH: 'POST_WITH'>, <class 'sqlglot.expressions.FreespaceProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.GlobalProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.HeapProperty'>: <Location.POST_WITH: 'POST_WITH'>, <class 'sqlglot.expressions.InheritsProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.IcebergProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.IncludeProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.InputModelProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.IsolatedLoadingProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.JournalProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.LanguageProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.LikeProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.LocationProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.LockProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.LockingProperty'>: <Location.POST_ALIAS: 'POST_ALIAS'>, <class 'sqlglot.expressions.LogProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.MaterializedProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.MergeBlockRatioProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.NoPrimaryIndexProperty'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.OnProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.OnCommitProperty'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.Order'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.OutputModelProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.PartitionedByProperty'>: <Location.POST_WITH: 'POST_WITH'>, <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.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 no_paren_current_date_sql>, <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 =
{'roles', 'match_phrase_edge', 'hour', 'date_diff', 'backends', 'repository', 'stats', 'ignore', 'collect', 'type', 'procedure', 'keys', 'errors', 'restore', 'columns', 'parameter', 'never', 'negative', 'largeint', 'join', 'timestampadd', 'snapshot', 'next', 'write', 'text', 'null', 'local', 'ldap_admin_password', 'repositories', 'build', 'user', 'false', 'values', 'kill', 'low_priority', 'key', 'update', 'left', 'xor', 'partitions', 'restrictive', 'case', 'recover', 'primary', 'deferred', 'migrations', 'frontends', 'interval', 'terminated', 'unique', 'split', 'current_time', 'inverted', 'last', 'intersect', 'duplicate', 'tablet', 'enable', 'sample', 'encryptkey', 'collate', 'array', 'cached', 'date_floor', 'repair', 'real', 'data', 'password_history', 'database', 'grants', 'revoke', 'no', 'schema', 'match_phrase_prefix', 'random', 'migrate', 'blob', 'config', 'property', 'float', 'smallint', 'replace', 'sum', 'password_reuse', 'group', 'lateral', 'policy', 'subdate', 'backup', 'not', 'outer', 'feature', 'starts', 'indexes', 'isnull', 'release', 'sequence', 'union', 'decommission', 'regexp', 'uncommitted', 'location', 'sync', 'role', 'asc', 'commit', 'overwrite', 'match_all', 'references', 'less', 'load', 'diagnose', 'recycle', 'shape', 'process', 'distinctpc', 'read', 'schemas', 'functions', 'execute', 'hostname', 'help', 'datetimev2', 'every', 'non_nullable', 'switch', 'password_expire', 'compact', 'match_any', 'int', 'superuser', 'export', 'tinyint', 'account_unlock', 'first', 'truncate', 'select', 'external', 'optimized', 'end', 'analyzed', 'cancel', 'variables', 'binlog', 'doris_internal_table_id', 'period', 'verbose', 'modify', 'rollback', 'free', 'auto', 'frontend', 'tree', 'bigint', 'buckets', 'password', 'localtimestamp', 'refresh', 'complete', 'distribution', 'full', 'foreign', 'distinct', 'query', 'to', 'jobs', 'expired', 'percent', 'varchar', 'month', 'exclude', 'offset', 'set', 'plugins', 'all', 'add', 'comment', 'cross', 'datetime', 'stop', 'temporary', 'rollup', 'authors', 'bitmap', 'datev2', 'character', 'immediate', 'routine', 'cast', 'identified', 'is_not_null_pred', 'merge', 'ipv4', 'for', 'fields', 'lines', 'observer', 'whitelist', 'warnings', 'decimalv2', 'isolation', 'than', 'clusters', 'datev1', 'hub', 'range', 'ipv6', 'min', 'max', 'into', 'rows', 'manual', 'convert', 'create', 'tablets', 'connection', 'maxvalue', 'repeatable', 'ldap', 'grant', 'storage', 'describe', 'builtin', 'committed', 'intermediate', 'proc', 'bitor', 'fast', 'preceding', 'ends', 'semi', 'show', 'current_catalog', 'soname', 'consistent', 'match', 'start', 'vault', 'order', 'match_phrase', 'engines', 'memo', 'generic', 'count', 'failed_login_attempts', 'with', 'engine', 'mtmv', 'is', 'following', 'sets', 'lock', 'catalogs', 'force', 'returns', 'creation', 'backend', 'global', 'sql_block_rule', 'table', 'decimalv3', 'current_timestamp', 'hll', 'job', 'decimal', 'parsed', 'permissive', 'when', 'signed', 'filter', 'date_add', 'like', 'dateadd', 'and', 'adddate', 'resources', 'bitand', 'row', 'use', 'minute', 'desc', 'streaming', 'exists', 'default', 'distributed', 'jsonb', 'append', 'datetimev1', 'cluster', 'distinctpcsa', 'extract', 'name', 'dropp', 'skew', 'array_range', 'except', 'rewritten', 'quantile_union', 'after', 'constraints', 'install', 'inner', 'charset', 'is_null_pred', 'transaction', 'boolean', 'rlike', 'time', 'of', 'unsigned', 'enter', 'dual', 'column', 'properties', 'localtime', 'task', 'path', 'admin', 'type_cast', 'file', 'alter', 's3', 'cube', 'bitmap_union', 'prepare', 'days_sub', 'grouping', 'index', 'datediff', 'extended', 'over', 'trim', 'function', 'disk', 'or', 'resource', 'workload', 'link', 'schedule', 'physical', 'call', 'using', 'in', 'resume', 'databases', 'variant', 'unbounded', 'as', 'types', 'session', 'triggers', 'outfile', 'tablesample', 'delete', 'at', 'replace_if_not_null', 'quota', 'infile', 'div', 'rebalance', 'quantile_state', 'json', 'bin', 'only', 'view', 'true', 'else', 'clean', 'events', 'plugin', 'current_user', 'collation', 'belong', 'where', 'replica', 'logical', 'auto_increment', 'current', 'between', 'week', 'tables', 'work', 'chain', 'graph', 'brief', 'hll_union', 'begin', 'uninstall', 'unlock', 'serializable', 'timestamp', 'broker', 'trash', 'catalog', 'level', 'processlist', 'anti', 'status', 'aggregate', 'limit', 'timestampdiff', 'date', 'right', 'demand', 'on', 'if', 'from', 'rename', 'stream', 'connection_id', 'groups', 'label', 'format', 'hash', 'incremental', 'cron', 'by', 'current_date', 'match_regexp', 'partition', 'day', 'date_ceil', 'do', 'explain', 'list', 'pause', 'having', 'analyze', 'scheduler', 'year', 'map', 'agg_state', 'hdfs', 'minus', 'bulk', 'open', 'date_sub', 'account_lock', 'nulls', 'char', 'value', 'binary', 'insert', 'tasks', 'natural', 'histogram', 'materialized', 'check', 'encryptkeys', 'ngram_bf', 'version', 'drop', 'plan', 'string', 'then', 'alias', 'integer', 'profile', 'password_lock_time', 'copy', 'struct', 'names', 'dynamic', 'follower', 'system', 'days_add', 'second', 'double', 'constraint', 'bitxor'}
648 def partitionrange_sql(self, expression: exp.PartitionRange) -> str: 649 name = self.sql(expression, "this") 650 values = expression.expressions 651 652 if len(values) != 1: 653 # Multiple values: use VALUES [ ... ) 654 if values and isinstance(values[0], list): 655 values_sql = ", ".join( 656 f"({', '.join(self.sql(v) for v in inner)})" for inner in values 657 ) 658 else: 659 values_sql = ", ".join(f"({self.sql(v)})" for v in values) 660 661 return f"PARTITION {name} VALUES [{values_sql})" 662 663 return f"PARTITION {name} VALUES LESS THAN ({self.sql(values[0])})"
def
partitionbyrangepropertydynamic_sql(self, expression):
665 def partitionbyrangepropertydynamic_sql(self, expression): 666 # Generates: FROM ("start") TO ("end") INTERVAL N UNIT 667 start = self.sql(expression, "start") 668 end = self.sql(expression, "end") 669 every = expression.args.get("every") 670 671 if every: 672 number = self.sql(every, "this") 673 interval = f"INTERVAL {number} {self.sql(every, 'unit')}" 674 else: 675 interval = "" 676 677 return f"FROM ({start}) TO ({end}) {interval}"
def
partitionbyrangeproperty_sql(self, expression):
679 def partitionbyrangeproperty_sql(self, expression): 680 partition_expressions = ", ".join( 681 self.sql(e) for e in expression.args.get("partition_expressions") or [] 682 ) 683 create_expressions = expression.args.get("create_expressions") or [] 684 # Handle both static and dynamic partition definitions 685 create_sql = ", ".join(self.sql(e) for e in create_expressions) 686 return f"PARTITION BY RANGE ({partition_expressions}) ({create_sql})"
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
- RENAME_TABLE_WITH_DB
- 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
- table_sql
- 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
- 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
- alterrename_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
- 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