sqlglot.dialects.clickhouse
1from __future__ import annotations 2 3import typing as t 4 5from sqlglot import exp, generator, parser, tokens, transforms 6from sqlglot.dialects.dialect import ( 7 Dialect, 8 arg_max_or_min_no_count, 9 build_formatted_time, 10 date_delta_sql, 11 inline_array_sql, 12 json_extract_segments, 13 json_path_key_only_name, 14 no_pivot_sql, 15 build_json_extract_path, 16 rename_func, 17 var_map_sql, 18) 19from sqlglot.helper import is_int, seq_get 20from sqlglot.tokens import Token, TokenType 21 22 23def _build_date_format(args: t.List) -> exp.TimeToStr: 24 expr = build_formatted_time(exp.TimeToStr, "clickhouse")(args) 25 26 timezone = seq_get(args, 2) 27 if timezone: 28 expr.set("timezone", timezone) 29 30 return expr 31 32 33def _lower_func(sql: str) -> str: 34 index = sql.index("(") 35 return sql[:index].lower() + sql[index:] 36 37 38def _quantile_sql(self: ClickHouse.Generator, expression: exp.Quantile) -> str: 39 quantile = expression.args["quantile"] 40 args = f"({self.sql(expression, 'this')})" 41 42 if isinstance(quantile, exp.Array): 43 func = self.func("quantiles", *quantile) 44 else: 45 func = self.func("quantile", quantile) 46 47 return func + args 48 49 50def _build_count_if(args: t.List) -> exp.CountIf | exp.CombinedAggFunc: 51 if len(args) == 1: 52 return exp.CountIf(this=seq_get(args, 0)) 53 54 return exp.CombinedAggFunc(this="countIf", expressions=args, parts=("count", "If")) 55 56 57class ClickHouse(Dialect): 58 NORMALIZE_FUNCTIONS: bool | str = False 59 NULL_ORDERING = "nulls_are_last" 60 SUPPORTS_USER_DEFINED_TYPES = False 61 SAFE_DIVISION = True 62 LOG_BASE_FIRST: t.Optional[bool] = None 63 64 UNESCAPED_SEQUENCES = { 65 "\\0": "\0", 66 } 67 68 class Tokenizer(tokens.Tokenizer): 69 COMMENTS = ["--", "#", "#!", ("/*", "*/")] 70 IDENTIFIERS = ['"', "`"] 71 STRING_ESCAPES = ["'", "\\"] 72 BIT_STRINGS = [("0b", "")] 73 HEX_STRINGS = [("0x", ""), ("0X", "")] 74 HEREDOC_STRINGS = ["$"] 75 76 KEYWORDS = { 77 **tokens.Tokenizer.KEYWORDS, 78 "ATTACH": TokenType.COMMAND, 79 "DATE32": TokenType.DATE32, 80 "DATETIME64": TokenType.DATETIME64, 81 "DICTIONARY": TokenType.DICTIONARY, 82 "ENUM8": TokenType.ENUM8, 83 "ENUM16": TokenType.ENUM16, 84 "FINAL": TokenType.FINAL, 85 "FIXEDSTRING": TokenType.FIXEDSTRING, 86 "FLOAT32": TokenType.FLOAT, 87 "FLOAT64": TokenType.DOUBLE, 88 "GLOBAL": TokenType.GLOBAL, 89 "INT256": TokenType.INT256, 90 "LOWCARDINALITY": TokenType.LOWCARDINALITY, 91 "MAP": TokenType.MAP, 92 "NESTED": TokenType.NESTED, 93 "SAMPLE": TokenType.TABLE_SAMPLE, 94 "TUPLE": TokenType.STRUCT, 95 "UINT128": TokenType.UINT128, 96 "UINT16": TokenType.USMALLINT, 97 "UINT256": TokenType.UINT256, 98 "UINT32": TokenType.UINT, 99 "UINT64": TokenType.UBIGINT, 100 "UINT8": TokenType.UTINYINT, 101 "IPV4": TokenType.IPV4, 102 "IPV6": TokenType.IPV6, 103 "AGGREGATEFUNCTION": TokenType.AGGREGATEFUNCTION, 104 "SIMPLEAGGREGATEFUNCTION": TokenType.SIMPLEAGGREGATEFUNCTION, 105 "SYSTEM": TokenType.COMMAND, 106 "PREWHERE": TokenType.PREWHERE, 107 } 108 109 SINGLE_TOKENS = { 110 **tokens.Tokenizer.SINGLE_TOKENS, 111 "$": TokenType.HEREDOC_STRING, 112 } 113 114 class Parser(parser.Parser): 115 # Tested in ClickHouse's playground, it seems that the following two queries do the same thing 116 # * select x from t1 union all select x from t2 limit 1; 117 # * select x from t1 union all (select x from t2 limit 1); 118 MODIFIERS_ATTACHED_TO_UNION = False 119 INTERVAL_SPANS = False 120 121 FUNCTIONS = { 122 **parser.Parser.FUNCTIONS, 123 "ANY": exp.AnyValue.from_arg_list, 124 "ARRAYSUM": exp.ArraySum.from_arg_list, 125 "COUNTIF": _build_count_if, 126 "DATE_ADD": lambda args: exp.DateAdd( 127 this=seq_get(args, 2), expression=seq_get(args, 1), unit=seq_get(args, 0) 128 ), 129 "DATEADD": lambda args: exp.DateAdd( 130 this=seq_get(args, 2), expression=seq_get(args, 1), unit=seq_get(args, 0) 131 ), 132 "DATE_DIFF": lambda args: exp.DateDiff( 133 this=seq_get(args, 2), expression=seq_get(args, 1), unit=seq_get(args, 0) 134 ), 135 "DATEDIFF": lambda args: exp.DateDiff( 136 this=seq_get(args, 2), expression=seq_get(args, 1), unit=seq_get(args, 0) 137 ), 138 "DATE_FORMAT": _build_date_format, 139 "FORMATDATETIME": _build_date_format, 140 "JSONEXTRACTSTRING": build_json_extract_path( 141 exp.JSONExtractScalar, zero_based_indexing=False 142 ), 143 "MAP": parser.build_var_map, 144 "MATCH": exp.RegexpLike.from_arg_list, 145 "RANDCANONICAL": exp.Rand.from_arg_list, 146 "TUPLE": exp.Struct.from_arg_list, 147 "UNIQ": exp.ApproxDistinct.from_arg_list, 148 "XOR": lambda args: exp.Xor(expressions=args), 149 } 150 151 AGG_FUNCTIONS = { 152 "count", 153 "min", 154 "max", 155 "sum", 156 "avg", 157 "any", 158 "stddevPop", 159 "stddevSamp", 160 "varPop", 161 "varSamp", 162 "corr", 163 "covarPop", 164 "covarSamp", 165 "entropy", 166 "exponentialMovingAverage", 167 "intervalLengthSum", 168 "kolmogorovSmirnovTest", 169 "mannWhitneyUTest", 170 "median", 171 "rankCorr", 172 "sumKahan", 173 "studentTTest", 174 "welchTTest", 175 "anyHeavy", 176 "anyLast", 177 "boundingRatio", 178 "first_value", 179 "last_value", 180 "argMin", 181 "argMax", 182 "avgWeighted", 183 "topK", 184 "topKWeighted", 185 "deltaSum", 186 "deltaSumTimestamp", 187 "groupArray", 188 "groupArrayLast", 189 "groupUniqArray", 190 "groupArrayInsertAt", 191 "groupArrayMovingAvg", 192 "groupArrayMovingSum", 193 "groupArraySample", 194 "groupBitAnd", 195 "groupBitOr", 196 "groupBitXor", 197 "groupBitmap", 198 "groupBitmapAnd", 199 "groupBitmapOr", 200 "groupBitmapXor", 201 "sumWithOverflow", 202 "sumMap", 203 "minMap", 204 "maxMap", 205 "skewSamp", 206 "skewPop", 207 "kurtSamp", 208 "kurtPop", 209 "uniq", 210 "uniqExact", 211 "uniqCombined", 212 "uniqCombined64", 213 "uniqHLL12", 214 "uniqTheta", 215 "quantile", 216 "quantiles", 217 "quantileExact", 218 "quantilesExact", 219 "quantileExactLow", 220 "quantilesExactLow", 221 "quantileExactHigh", 222 "quantilesExactHigh", 223 "quantileExactWeighted", 224 "quantilesExactWeighted", 225 "quantileTiming", 226 "quantilesTiming", 227 "quantileTimingWeighted", 228 "quantilesTimingWeighted", 229 "quantileDeterministic", 230 "quantilesDeterministic", 231 "quantileTDigest", 232 "quantilesTDigest", 233 "quantileTDigestWeighted", 234 "quantilesTDigestWeighted", 235 "quantileBFloat16", 236 "quantilesBFloat16", 237 "quantileBFloat16Weighted", 238 "quantilesBFloat16Weighted", 239 "simpleLinearRegression", 240 "stochasticLinearRegression", 241 "stochasticLogisticRegression", 242 "categoricalInformationValue", 243 "contingency", 244 "cramersV", 245 "cramersVBiasCorrected", 246 "theilsU", 247 "maxIntersections", 248 "maxIntersectionsPosition", 249 "meanZTest", 250 "quantileInterpolatedWeighted", 251 "quantilesInterpolatedWeighted", 252 "quantileGK", 253 "quantilesGK", 254 "sparkBar", 255 "sumCount", 256 "largestTriangleThreeBuckets", 257 "histogram", 258 "sequenceMatch", 259 "sequenceCount", 260 "windowFunnel", 261 "retention", 262 "uniqUpTo", 263 "sequenceNextNode", 264 "exponentialTimeDecayedAvg", 265 } 266 267 AGG_FUNCTIONS_SUFFIXES = [ 268 "If", 269 "Array", 270 "ArrayIf", 271 "Map", 272 "SimpleState", 273 "State", 274 "Merge", 275 "MergeState", 276 "ForEach", 277 "Distinct", 278 "OrDefault", 279 "OrNull", 280 "Resample", 281 "ArgMin", 282 "ArgMax", 283 ] 284 285 FUNC_TOKENS = { 286 *parser.Parser.FUNC_TOKENS, 287 TokenType.SET, 288 } 289 290 AGG_FUNC_MAPPING = ( 291 lambda functions, suffixes: { 292 f"{f}{sfx}": (f, sfx) for sfx in (suffixes + [""]) for f in functions 293 } 294 )(AGG_FUNCTIONS, AGG_FUNCTIONS_SUFFIXES) 295 296 FUNCTIONS_WITH_ALIASED_ARGS = {*parser.Parser.FUNCTIONS_WITH_ALIASED_ARGS, "TUPLE"} 297 298 FUNCTION_PARSERS = { 299 **parser.Parser.FUNCTION_PARSERS, 300 "ARRAYJOIN": lambda self: self.expression(exp.Explode, this=self._parse_expression()), 301 "QUANTILE": lambda self: self._parse_quantile(), 302 } 303 304 FUNCTION_PARSERS.pop("MATCH") 305 306 NO_PAREN_FUNCTION_PARSERS = parser.Parser.NO_PAREN_FUNCTION_PARSERS.copy() 307 NO_PAREN_FUNCTION_PARSERS.pop("ANY") 308 309 RANGE_PARSERS = { 310 **parser.Parser.RANGE_PARSERS, 311 TokenType.GLOBAL: lambda self, this: self._match(TokenType.IN) 312 and self._parse_in(this, is_global=True), 313 } 314 315 # The PLACEHOLDER entry is popped because 1) it doesn't affect Clickhouse (it corresponds to 316 # the postgres-specific JSONBContains parser) and 2) it makes parsing the ternary op simpler. 317 COLUMN_OPERATORS = parser.Parser.COLUMN_OPERATORS.copy() 318 COLUMN_OPERATORS.pop(TokenType.PLACEHOLDER) 319 320 JOIN_KINDS = { 321 *parser.Parser.JOIN_KINDS, 322 TokenType.ANY, 323 TokenType.ASOF, 324 TokenType.ARRAY, 325 } 326 327 TABLE_ALIAS_TOKENS = parser.Parser.TABLE_ALIAS_TOKENS - { 328 TokenType.ANY, 329 TokenType.ARRAY, 330 TokenType.FINAL, 331 TokenType.FORMAT, 332 TokenType.SETTINGS, 333 } 334 335 ALIAS_TOKENS = parser.Parser.ALIAS_TOKENS - { 336 TokenType.FORMAT, 337 } 338 339 LOG_DEFAULTS_TO_LN = True 340 341 QUERY_MODIFIER_PARSERS = { 342 **parser.Parser.QUERY_MODIFIER_PARSERS, 343 TokenType.SETTINGS: lambda self: ( 344 "settings", 345 self._advance() or self._parse_csv(self._parse_conjunction), 346 ), 347 TokenType.FORMAT: lambda self: ("format", self._advance() or self._parse_id_var()), 348 } 349 350 CONSTRAINT_PARSERS = { 351 **parser.Parser.CONSTRAINT_PARSERS, 352 "INDEX": lambda self: self._parse_index_constraint(), 353 "CODEC": lambda self: self._parse_compress(), 354 } 355 356 ALTER_PARSERS = { 357 **parser.Parser.ALTER_PARSERS, 358 "REPLACE": lambda self: self._parse_alter_table_replace(), 359 } 360 361 SCHEMA_UNNAMED_CONSTRAINTS = { 362 *parser.Parser.SCHEMA_UNNAMED_CONSTRAINTS, 363 "INDEX", 364 } 365 366 def _parse_conjunction(self) -> t.Optional[exp.Expression]: 367 this = super()._parse_conjunction() 368 369 if self._match(TokenType.PLACEHOLDER): 370 return self.expression( 371 exp.If, 372 this=this, 373 true=self._parse_conjunction(), 374 false=self._match(TokenType.COLON) and self._parse_conjunction(), 375 ) 376 377 return this 378 379 def _parse_placeholder(self) -> t.Optional[exp.Expression]: 380 """ 381 Parse a placeholder expression like SELECT {abc: UInt32} or FROM {table: Identifier} 382 https://clickhouse.com/docs/en/sql-reference/syntax#defining-and-using-query-parameters 383 """ 384 if not self._match(TokenType.L_BRACE): 385 return None 386 387 this = self._parse_id_var() 388 self._match(TokenType.COLON) 389 kind = self._parse_types(check_func=False, allow_identifiers=False) or ( 390 self._match_text_seq("IDENTIFIER") and "Identifier" 391 ) 392 393 if not kind: 394 self.raise_error("Expecting a placeholder type or 'Identifier' for tables") 395 elif not self._match(TokenType.R_BRACE): 396 self.raise_error("Expecting }") 397 398 return self.expression(exp.Placeholder, this=this, kind=kind) 399 400 def _parse_in(self, this: t.Optional[exp.Expression], is_global: bool = False) -> exp.In: 401 this = super()._parse_in(this) 402 this.set("is_global", is_global) 403 return this 404 405 def _parse_table( 406 self, 407 schema: bool = False, 408 joins: bool = False, 409 alias_tokens: t.Optional[t.Collection[TokenType]] = None, 410 parse_bracket: bool = False, 411 is_db_reference: bool = False, 412 parse_partition: bool = False, 413 ) -> t.Optional[exp.Expression]: 414 this = super()._parse_table( 415 schema=schema, 416 joins=joins, 417 alias_tokens=alias_tokens, 418 parse_bracket=parse_bracket, 419 is_db_reference=is_db_reference, 420 ) 421 422 if self._match(TokenType.FINAL): 423 this = self.expression(exp.Final, this=this) 424 425 return this 426 427 def _parse_position(self, haystack_first: bool = False) -> exp.StrPosition: 428 return super()._parse_position(haystack_first=True) 429 430 # https://clickhouse.com/docs/en/sql-reference/statements/select/with/ 431 def _parse_cte(self) -> exp.CTE: 432 # WITH <identifier> AS <subquery expression> 433 cte: t.Optional[exp.CTE] = self._try_parse(super()._parse_cte) 434 435 if not cte: 436 # WITH <expression> AS <identifier> 437 cte = self.expression( 438 exp.CTE, 439 this=self._parse_conjunction(), 440 alias=self._parse_table_alias(), 441 scalar=True, 442 ) 443 444 return cte 445 446 def _parse_join_parts( 447 self, 448 ) -> t.Tuple[t.Optional[Token], t.Optional[Token], t.Optional[Token]]: 449 is_global = self._match(TokenType.GLOBAL) and self._prev 450 kind_pre = self._match_set(self.JOIN_KINDS, advance=False) and self._prev 451 452 if kind_pre: 453 kind = self._match_set(self.JOIN_KINDS) and self._prev 454 side = self._match_set(self.JOIN_SIDES) and self._prev 455 return is_global, side, kind 456 457 return ( 458 is_global, 459 self._match_set(self.JOIN_SIDES) and self._prev, 460 self._match_set(self.JOIN_KINDS) and self._prev, 461 ) 462 463 def _parse_join( 464 self, skip_join_token: bool = False, parse_bracket: bool = False 465 ) -> t.Optional[exp.Join]: 466 join = super()._parse_join(skip_join_token=skip_join_token, parse_bracket=True) 467 if join: 468 join.set("global", join.args.pop("method", None)) 469 470 return join 471 472 def _parse_function( 473 self, 474 functions: t.Optional[t.Dict[str, t.Callable]] = None, 475 anonymous: bool = False, 476 optional_parens: bool = True, 477 any_token: bool = False, 478 ) -> t.Optional[exp.Expression]: 479 expr = super()._parse_function( 480 functions=functions, 481 anonymous=anonymous, 482 optional_parens=optional_parens, 483 any_token=any_token, 484 ) 485 486 func = expr.this if isinstance(expr, exp.Window) else expr 487 488 # Aggregate functions can be split in 2 parts: <func_name><suffix> 489 parts = ( 490 self.AGG_FUNC_MAPPING.get(func.this) if isinstance(func, exp.Anonymous) else None 491 ) 492 493 if parts: 494 params = self._parse_func_params(func) 495 496 kwargs = { 497 "this": func.this, 498 "expressions": func.expressions, 499 } 500 if parts[1]: 501 kwargs["parts"] = parts 502 exp_class = exp.CombinedParameterizedAgg if params else exp.CombinedAggFunc 503 else: 504 exp_class = exp.ParameterizedAgg if params else exp.AnonymousAggFunc 505 506 kwargs["exp_class"] = exp_class 507 if params: 508 kwargs["params"] = params 509 510 func = self.expression(**kwargs) 511 512 if isinstance(expr, exp.Window): 513 # The window's func was parsed as Anonymous in base parser, fix its 514 # type to be CH style CombinedAnonymousAggFunc / AnonymousAggFunc 515 expr.set("this", func) 516 elif params: 517 # Params have blocked super()._parse_function() from parsing the following window 518 # (if that exists) as they're standing between the function call and the window spec 519 expr = self._parse_window(func) 520 else: 521 expr = func 522 523 return expr 524 525 def _parse_func_params( 526 self, this: t.Optional[exp.Func] = None 527 ) -> t.Optional[t.List[exp.Expression]]: 528 if self._match_pair(TokenType.R_PAREN, TokenType.L_PAREN): 529 return self._parse_csv(self._parse_lambda) 530 531 if self._match(TokenType.L_PAREN): 532 params = self._parse_csv(self._parse_lambda) 533 self._match_r_paren(this) 534 return params 535 536 return None 537 538 def _parse_quantile(self) -> exp.Quantile: 539 this = self._parse_lambda() 540 params = self._parse_func_params() 541 if params: 542 return self.expression(exp.Quantile, this=params[0], quantile=this) 543 return self.expression(exp.Quantile, this=this, quantile=exp.Literal.number(0.5)) 544 545 def _parse_wrapped_id_vars(self, optional: bool = False) -> t.List[exp.Expression]: 546 return super()._parse_wrapped_id_vars(optional=True) 547 548 def _parse_primary_key( 549 self, wrapped_optional: bool = False, in_props: bool = False 550 ) -> exp.PrimaryKeyColumnConstraint | exp.PrimaryKey: 551 return super()._parse_primary_key( 552 wrapped_optional=wrapped_optional or in_props, in_props=in_props 553 ) 554 555 def _parse_on_property(self) -> t.Optional[exp.Expression]: 556 index = self._index 557 if self._match_text_seq("CLUSTER"): 558 this = self._parse_id_var() 559 if this: 560 return self.expression(exp.OnCluster, this=this) 561 else: 562 self._retreat(index) 563 return None 564 565 def _parse_index_constraint( 566 self, kind: t.Optional[str] = None 567 ) -> exp.IndexColumnConstraint: 568 # INDEX name1 expr TYPE type1(args) GRANULARITY value 569 this = self._parse_id_var() 570 expression = self._parse_conjunction() 571 572 index_type = self._match_text_seq("TYPE") and ( 573 self._parse_function() or self._parse_var() 574 ) 575 576 granularity = self._match_text_seq("GRANULARITY") and self._parse_term() 577 578 return self.expression( 579 exp.IndexColumnConstraint, 580 this=this, 581 expression=expression, 582 index_type=index_type, 583 granularity=granularity, 584 ) 585 586 def _parse_partition(self) -> t.Optional[exp.Partition]: 587 # https://clickhouse.com/docs/en/sql-reference/statements/alter/partition#how-to-set-partition-expression 588 if not self._match(TokenType.PARTITION): 589 return None 590 591 if self._match_text_seq("ID"): 592 # Corresponds to the PARTITION ID <string_value> syntax 593 expressions: t.List[exp.Expression] = [ 594 self.expression(exp.PartitionId, this=self._parse_string()) 595 ] 596 else: 597 expressions = self._parse_expressions() 598 599 return self.expression(exp.Partition, expressions=expressions) 600 601 def _parse_alter_table_replace(self) -> t.Optional[exp.Expression]: 602 partition = self._parse_partition() 603 604 if not partition or not self._match(TokenType.FROM): 605 return None 606 607 return self.expression( 608 exp.ReplacePartition, expression=partition, source=self._parse_table_parts() 609 ) 610 611 class Generator(generator.Generator): 612 QUERY_HINTS = False 613 STRUCT_DELIMITER = ("(", ")") 614 NVL2_SUPPORTED = False 615 TABLESAMPLE_REQUIRES_PARENS = False 616 TABLESAMPLE_SIZE_IS_ROWS = False 617 TABLESAMPLE_KEYWORDS = "SAMPLE" 618 LAST_DAY_SUPPORTS_DATE_PART = False 619 CAN_IMPLEMENT_ARRAY_ANY = True 620 SUPPORTS_TO_NUMBER = False 621 622 STRING_TYPE_MAPPING = { 623 exp.DataType.Type.CHAR: "String", 624 exp.DataType.Type.LONGBLOB: "String", 625 exp.DataType.Type.LONGTEXT: "String", 626 exp.DataType.Type.MEDIUMBLOB: "String", 627 exp.DataType.Type.MEDIUMTEXT: "String", 628 exp.DataType.Type.TINYBLOB: "String", 629 exp.DataType.Type.TINYTEXT: "String", 630 exp.DataType.Type.TEXT: "String", 631 exp.DataType.Type.VARBINARY: "String", 632 exp.DataType.Type.VARCHAR: "String", 633 } 634 635 SUPPORTED_JSON_PATH_PARTS = { 636 exp.JSONPathKey, 637 exp.JSONPathRoot, 638 exp.JSONPathSubscript, 639 } 640 641 TYPE_MAPPING = { 642 **generator.Generator.TYPE_MAPPING, 643 **STRING_TYPE_MAPPING, 644 exp.DataType.Type.ARRAY: "Array", 645 exp.DataType.Type.BIGINT: "Int64", 646 exp.DataType.Type.DATE32: "Date32", 647 exp.DataType.Type.DATETIME64: "DateTime64", 648 exp.DataType.Type.DOUBLE: "Float64", 649 exp.DataType.Type.ENUM: "Enum", 650 exp.DataType.Type.ENUM8: "Enum8", 651 exp.DataType.Type.ENUM16: "Enum16", 652 exp.DataType.Type.FIXEDSTRING: "FixedString", 653 exp.DataType.Type.FLOAT: "Float32", 654 exp.DataType.Type.INT: "Int32", 655 exp.DataType.Type.MEDIUMINT: "Int32", 656 exp.DataType.Type.INT128: "Int128", 657 exp.DataType.Type.INT256: "Int256", 658 exp.DataType.Type.LOWCARDINALITY: "LowCardinality", 659 exp.DataType.Type.MAP: "Map", 660 exp.DataType.Type.NESTED: "Nested", 661 exp.DataType.Type.NULLABLE: "Nullable", 662 exp.DataType.Type.SMALLINT: "Int16", 663 exp.DataType.Type.STRUCT: "Tuple", 664 exp.DataType.Type.TINYINT: "Int8", 665 exp.DataType.Type.UBIGINT: "UInt64", 666 exp.DataType.Type.UINT: "UInt32", 667 exp.DataType.Type.UINT128: "UInt128", 668 exp.DataType.Type.UINT256: "UInt256", 669 exp.DataType.Type.USMALLINT: "UInt16", 670 exp.DataType.Type.UTINYINT: "UInt8", 671 exp.DataType.Type.IPV4: "IPv4", 672 exp.DataType.Type.IPV6: "IPv6", 673 exp.DataType.Type.AGGREGATEFUNCTION: "AggregateFunction", 674 exp.DataType.Type.SIMPLEAGGREGATEFUNCTION: "SimpleAggregateFunction", 675 } 676 677 TRANSFORMS = { 678 **generator.Generator.TRANSFORMS, 679 exp.AnyValue: rename_func("any"), 680 exp.ApproxDistinct: rename_func("uniq"), 681 exp.ArrayFilter: lambda self, e: self.func("arrayFilter", e.expression, e.this), 682 exp.ArraySize: rename_func("LENGTH"), 683 exp.ArraySum: rename_func("arraySum"), 684 exp.ArgMax: arg_max_or_min_no_count("argMax"), 685 exp.ArgMin: arg_max_or_min_no_count("argMin"), 686 exp.Array: inline_array_sql, 687 exp.CastToStrType: rename_func("CAST"), 688 exp.CountIf: rename_func("countIf"), 689 exp.CompressColumnConstraint: lambda self, 690 e: f"CODEC({self.expressions(e, key='this', flat=True)})", 691 exp.ComputedColumnConstraint: lambda self, 692 e: f"{'MATERIALIZED' if e.args.get('persisted') else 'ALIAS'} {self.sql(e, 'this')}", 693 exp.CurrentDate: lambda self, e: self.func("CURRENT_DATE"), 694 exp.DateAdd: date_delta_sql("DATE_ADD"), 695 exp.DateDiff: date_delta_sql("DATE_DIFF"), 696 exp.Explode: rename_func("arrayJoin"), 697 exp.Final: lambda self, e: f"{self.sql(e, 'this')} FINAL", 698 exp.IsNan: rename_func("isNaN"), 699 exp.JSONExtract: json_extract_segments("JSONExtractString", quoted_index=False), 700 exp.JSONExtractScalar: json_extract_segments("JSONExtractString", quoted_index=False), 701 exp.JSONPathKey: json_path_key_only_name, 702 exp.JSONPathRoot: lambda *_: "", 703 exp.Map: lambda self, e: _lower_func(var_map_sql(self, e)), 704 exp.Nullif: rename_func("nullIf"), 705 exp.PartitionedByProperty: lambda self, e: f"PARTITION BY {self.sql(e, 'this')}", 706 exp.Pivot: no_pivot_sql, 707 exp.Quantile: _quantile_sql, 708 exp.RegexpLike: lambda self, e: self.func("match", e.this, e.expression), 709 exp.Rand: rename_func("randCanonical"), 710 exp.Select: transforms.preprocess([transforms.eliminate_qualify]), 711 exp.StartsWith: rename_func("startsWith"), 712 exp.StrPosition: lambda self, e: self.func( 713 "position", e.this, e.args.get("substr"), e.args.get("position") 714 ), 715 exp.TimeToStr: lambda self, e: self.func( 716 "DATE_FORMAT", e.this, self.format_time(e), e.args.get("timezone") 717 ), 718 exp.VarMap: lambda self, e: _lower_func(var_map_sql(self, e)), 719 exp.Xor: lambda self, e: self.func("xor", e.this, e.expression, *e.expressions), 720 } 721 722 PROPERTIES_LOCATION = { 723 **generator.Generator.PROPERTIES_LOCATION, 724 exp.VolatileProperty: exp.Properties.Location.UNSUPPORTED, 725 exp.PartitionedByProperty: exp.Properties.Location.POST_SCHEMA, 726 exp.OnCluster: exp.Properties.Location.POST_NAME, 727 } 728 729 JOIN_HINTS = False 730 TABLE_HINTS = False 731 EXPLICIT_UNION = True 732 GROUPINGS_SEP = "" 733 OUTER_UNION_MODIFIERS = False 734 735 # there's no list in docs, but it can be found in Clickhouse code 736 # see `ClickHouse/src/Parsers/ParserCreate*.cpp` 737 ON_CLUSTER_TARGETS = { 738 "DATABASE", 739 "TABLE", 740 "VIEW", 741 "DICTIONARY", 742 "INDEX", 743 "FUNCTION", 744 "NAMED COLLECTION", 745 } 746 747 def _jsonpathsubscript_sql(self, expression: exp.JSONPathSubscript) -> str: 748 this = self.json_path_part(expression.this) 749 return str(int(this) + 1) if is_int(this) else this 750 751 def likeproperty_sql(self, expression: exp.LikeProperty) -> str: 752 return f"AS {self.sql(expression, 'this')}" 753 754 def _any_to_has( 755 self, 756 expression: exp.EQ | exp.NEQ, 757 default: t.Callable[[t.Any], str], 758 prefix: str = "", 759 ) -> str: 760 if isinstance(expression.left, exp.Any): 761 arr = expression.left 762 this = expression.right 763 elif isinstance(expression.right, exp.Any): 764 arr = expression.right 765 this = expression.left 766 else: 767 return default(expression) 768 769 return prefix + self.func("has", arr.this.unnest(), this) 770 771 def eq_sql(self, expression: exp.EQ) -> str: 772 return self._any_to_has(expression, super().eq_sql) 773 774 def neq_sql(self, expression: exp.NEQ) -> str: 775 return self._any_to_has(expression, super().neq_sql, "NOT ") 776 777 def regexpilike_sql(self, expression: exp.RegexpILike) -> str: 778 # Manually add a flag to make the search case-insensitive 779 regex = self.func("CONCAT", "'(?i)'", expression.expression) 780 return self.func("match", expression.this, regex) 781 782 def datatype_sql(self, expression: exp.DataType) -> str: 783 # String is the standard ClickHouse type, every other variant is just an alias. 784 # Additionally, any supplied length parameter will be ignored. 785 # 786 # https://clickhouse.com/docs/en/sql-reference/data-types/string 787 if expression.this in self.STRING_TYPE_MAPPING: 788 return "String" 789 790 return super().datatype_sql(expression) 791 792 def cte_sql(self, expression: exp.CTE) -> str: 793 if expression.args.get("scalar"): 794 this = self.sql(expression, "this") 795 alias = self.sql(expression, "alias") 796 return f"{this} AS {alias}" 797 798 return super().cte_sql(expression) 799 800 def after_limit_modifiers(self, expression: exp.Expression) -> t.List[str]: 801 return super().after_limit_modifiers(expression) + [ 802 ( 803 self.seg("SETTINGS ") + self.expressions(expression, key="settings", flat=True) 804 if expression.args.get("settings") 805 else "" 806 ), 807 ( 808 self.seg("FORMAT ") + self.sql(expression, "format") 809 if expression.args.get("format") 810 else "" 811 ), 812 ] 813 814 def parameterizedagg_sql(self, expression: exp.ParameterizedAgg) -> str: 815 params = self.expressions(expression, key="params", flat=True) 816 return self.func(expression.name, *expression.expressions) + f"({params})" 817 818 def anonymousaggfunc_sql(self, expression: exp.AnonymousAggFunc) -> str: 819 return self.func(expression.name, *expression.expressions) 820 821 def combinedaggfunc_sql(self, expression: exp.CombinedAggFunc) -> str: 822 return self.anonymousaggfunc_sql(expression) 823 824 def combinedparameterizedagg_sql(self, expression: exp.CombinedParameterizedAgg) -> str: 825 return self.parameterizedagg_sql(expression) 826 827 def placeholder_sql(self, expression: exp.Placeholder) -> str: 828 return f"{{{expression.name}: {self.sql(expression, 'kind')}}}" 829 830 def oncluster_sql(self, expression: exp.OnCluster) -> str: 831 return f"ON CLUSTER {self.sql(expression, 'this')}" 832 833 def createable_sql(self, expression: exp.Create, locations: t.DefaultDict) -> str: 834 if expression.kind in self.ON_CLUSTER_TARGETS and locations.get( 835 exp.Properties.Location.POST_NAME 836 ): 837 this_name = self.sql(expression.this, "this") 838 this_properties = " ".join( 839 [self.sql(prop) for prop in locations[exp.Properties.Location.POST_NAME]] 840 ) 841 this_schema = self.schema_columns_sql(expression.this) 842 return f"{this_name}{self.sep()}{this_properties}{self.sep()}{this_schema}" 843 844 return super().createable_sql(expression, locations) 845 846 def prewhere_sql(self, expression: exp.PreWhere) -> str: 847 this = self.indent(self.sql(expression, "this")) 848 return f"{self.seg('PREWHERE')}{self.sep()}{this}" 849 850 def indexcolumnconstraint_sql(self, expression: exp.IndexColumnConstraint) -> str: 851 this = self.sql(expression, "this") 852 this = f" {this}" if this else "" 853 expr = self.sql(expression, "expression") 854 expr = f" {expr}" if expr else "" 855 index_type = self.sql(expression, "index_type") 856 index_type = f" TYPE {index_type}" if index_type else "" 857 granularity = self.sql(expression, "granularity") 858 granularity = f" GRANULARITY {granularity}" if granularity else "" 859 860 return f"INDEX{this}{expr}{index_type}{granularity}" 861 862 def partition_sql(self, expression: exp.Partition) -> str: 863 return f"PARTITION {self.expressions(expression, flat=True)}" 864 865 def partitionid_sql(self, expression: exp.PartitionId) -> str: 866 return f"ID {self.sql(expression.this)}" 867 868 def replacepartition_sql(self, expression: exp.ReplacePartition) -> str: 869 return ( 870 f"REPLACE {self.sql(expression.expression)} FROM {self.sql(expression, 'source')}" 871 )
58class ClickHouse(Dialect): 59 NORMALIZE_FUNCTIONS: bool | str = False 60 NULL_ORDERING = "nulls_are_last" 61 SUPPORTS_USER_DEFINED_TYPES = False 62 SAFE_DIVISION = True 63 LOG_BASE_FIRST: t.Optional[bool] = None 64 65 UNESCAPED_SEQUENCES = { 66 "\\0": "\0", 67 } 68 69 class Tokenizer(tokens.Tokenizer): 70 COMMENTS = ["--", "#", "#!", ("/*", "*/")] 71 IDENTIFIERS = ['"', "`"] 72 STRING_ESCAPES = ["'", "\\"] 73 BIT_STRINGS = [("0b", "")] 74 HEX_STRINGS = [("0x", ""), ("0X", "")] 75 HEREDOC_STRINGS = ["$"] 76 77 KEYWORDS = { 78 **tokens.Tokenizer.KEYWORDS, 79 "ATTACH": TokenType.COMMAND, 80 "DATE32": TokenType.DATE32, 81 "DATETIME64": TokenType.DATETIME64, 82 "DICTIONARY": TokenType.DICTIONARY, 83 "ENUM8": TokenType.ENUM8, 84 "ENUM16": TokenType.ENUM16, 85 "FINAL": TokenType.FINAL, 86 "FIXEDSTRING": TokenType.FIXEDSTRING, 87 "FLOAT32": TokenType.FLOAT, 88 "FLOAT64": TokenType.DOUBLE, 89 "GLOBAL": TokenType.GLOBAL, 90 "INT256": TokenType.INT256, 91 "LOWCARDINALITY": TokenType.LOWCARDINALITY, 92 "MAP": TokenType.MAP, 93 "NESTED": TokenType.NESTED, 94 "SAMPLE": TokenType.TABLE_SAMPLE, 95 "TUPLE": TokenType.STRUCT, 96 "UINT128": TokenType.UINT128, 97 "UINT16": TokenType.USMALLINT, 98 "UINT256": TokenType.UINT256, 99 "UINT32": TokenType.UINT, 100 "UINT64": TokenType.UBIGINT, 101 "UINT8": TokenType.UTINYINT, 102 "IPV4": TokenType.IPV4, 103 "IPV6": TokenType.IPV6, 104 "AGGREGATEFUNCTION": TokenType.AGGREGATEFUNCTION, 105 "SIMPLEAGGREGATEFUNCTION": TokenType.SIMPLEAGGREGATEFUNCTION, 106 "SYSTEM": TokenType.COMMAND, 107 "PREWHERE": TokenType.PREWHERE, 108 } 109 110 SINGLE_TOKENS = { 111 **tokens.Tokenizer.SINGLE_TOKENS, 112 "$": TokenType.HEREDOC_STRING, 113 } 114 115 class Parser(parser.Parser): 116 # Tested in ClickHouse's playground, it seems that the following two queries do the same thing 117 # * select x from t1 union all select x from t2 limit 1; 118 # * select x from t1 union all (select x from t2 limit 1); 119 MODIFIERS_ATTACHED_TO_UNION = False 120 INTERVAL_SPANS = False 121 122 FUNCTIONS = { 123 **parser.Parser.FUNCTIONS, 124 "ANY": exp.AnyValue.from_arg_list, 125 "ARRAYSUM": exp.ArraySum.from_arg_list, 126 "COUNTIF": _build_count_if, 127 "DATE_ADD": lambda args: exp.DateAdd( 128 this=seq_get(args, 2), expression=seq_get(args, 1), unit=seq_get(args, 0) 129 ), 130 "DATEADD": lambda args: exp.DateAdd( 131 this=seq_get(args, 2), expression=seq_get(args, 1), unit=seq_get(args, 0) 132 ), 133 "DATE_DIFF": lambda args: exp.DateDiff( 134 this=seq_get(args, 2), expression=seq_get(args, 1), unit=seq_get(args, 0) 135 ), 136 "DATEDIFF": lambda args: exp.DateDiff( 137 this=seq_get(args, 2), expression=seq_get(args, 1), unit=seq_get(args, 0) 138 ), 139 "DATE_FORMAT": _build_date_format, 140 "FORMATDATETIME": _build_date_format, 141 "JSONEXTRACTSTRING": build_json_extract_path( 142 exp.JSONExtractScalar, zero_based_indexing=False 143 ), 144 "MAP": parser.build_var_map, 145 "MATCH": exp.RegexpLike.from_arg_list, 146 "RANDCANONICAL": exp.Rand.from_arg_list, 147 "TUPLE": exp.Struct.from_arg_list, 148 "UNIQ": exp.ApproxDistinct.from_arg_list, 149 "XOR": lambda args: exp.Xor(expressions=args), 150 } 151 152 AGG_FUNCTIONS = { 153 "count", 154 "min", 155 "max", 156 "sum", 157 "avg", 158 "any", 159 "stddevPop", 160 "stddevSamp", 161 "varPop", 162 "varSamp", 163 "corr", 164 "covarPop", 165 "covarSamp", 166 "entropy", 167 "exponentialMovingAverage", 168 "intervalLengthSum", 169 "kolmogorovSmirnovTest", 170 "mannWhitneyUTest", 171 "median", 172 "rankCorr", 173 "sumKahan", 174 "studentTTest", 175 "welchTTest", 176 "anyHeavy", 177 "anyLast", 178 "boundingRatio", 179 "first_value", 180 "last_value", 181 "argMin", 182 "argMax", 183 "avgWeighted", 184 "topK", 185 "topKWeighted", 186 "deltaSum", 187 "deltaSumTimestamp", 188 "groupArray", 189 "groupArrayLast", 190 "groupUniqArray", 191 "groupArrayInsertAt", 192 "groupArrayMovingAvg", 193 "groupArrayMovingSum", 194 "groupArraySample", 195 "groupBitAnd", 196 "groupBitOr", 197 "groupBitXor", 198 "groupBitmap", 199 "groupBitmapAnd", 200 "groupBitmapOr", 201 "groupBitmapXor", 202 "sumWithOverflow", 203 "sumMap", 204 "minMap", 205 "maxMap", 206 "skewSamp", 207 "skewPop", 208 "kurtSamp", 209 "kurtPop", 210 "uniq", 211 "uniqExact", 212 "uniqCombined", 213 "uniqCombined64", 214 "uniqHLL12", 215 "uniqTheta", 216 "quantile", 217 "quantiles", 218 "quantileExact", 219 "quantilesExact", 220 "quantileExactLow", 221 "quantilesExactLow", 222 "quantileExactHigh", 223 "quantilesExactHigh", 224 "quantileExactWeighted", 225 "quantilesExactWeighted", 226 "quantileTiming", 227 "quantilesTiming", 228 "quantileTimingWeighted", 229 "quantilesTimingWeighted", 230 "quantileDeterministic", 231 "quantilesDeterministic", 232 "quantileTDigest", 233 "quantilesTDigest", 234 "quantileTDigestWeighted", 235 "quantilesTDigestWeighted", 236 "quantileBFloat16", 237 "quantilesBFloat16", 238 "quantileBFloat16Weighted", 239 "quantilesBFloat16Weighted", 240 "simpleLinearRegression", 241 "stochasticLinearRegression", 242 "stochasticLogisticRegression", 243 "categoricalInformationValue", 244 "contingency", 245 "cramersV", 246 "cramersVBiasCorrected", 247 "theilsU", 248 "maxIntersections", 249 "maxIntersectionsPosition", 250 "meanZTest", 251 "quantileInterpolatedWeighted", 252 "quantilesInterpolatedWeighted", 253 "quantileGK", 254 "quantilesGK", 255 "sparkBar", 256 "sumCount", 257 "largestTriangleThreeBuckets", 258 "histogram", 259 "sequenceMatch", 260 "sequenceCount", 261 "windowFunnel", 262 "retention", 263 "uniqUpTo", 264 "sequenceNextNode", 265 "exponentialTimeDecayedAvg", 266 } 267 268 AGG_FUNCTIONS_SUFFIXES = [ 269 "If", 270 "Array", 271 "ArrayIf", 272 "Map", 273 "SimpleState", 274 "State", 275 "Merge", 276 "MergeState", 277 "ForEach", 278 "Distinct", 279 "OrDefault", 280 "OrNull", 281 "Resample", 282 "ArgMin", 283 "ArgMax", 284 ] 285 286 FUNC_TOKENS = { 287 *parser.Parser.FUNC_TOKENS, 288 TokenType.SET, 289 } 290 291 AGG_FUNC_MAPPING = ( 292 lambda functions, suffixes: { 293 f"{f}{sfx}": (f, sfx) for sfx in (suffixes + [""]) for f in functions 294 } 295 )(AGG_FUNCTIONS, AGG_FUNCTIONS_SUFFIXES) 296 297 FUNCTIONS_WITH_ALIASED_ARGS = {*parser.Parser.FUNCTIONS_WITH_ALIASED_ARGS, "TUPLE"} 298 299 FUNCTION_PARSERS = { 300 **parser.Parser.FUNCTION_PARSERS, 301 "ARRAYJOIN": lambda self: self.expression(exp.Explode, this=self._parse_expression()), 302 "QUANTILE": lambda self: self._parse_quantile(), 303 } 304 305 FUNCTION_PARSERS.pop("MATCH") 306 307 NO_PAREN_FUNCTION_PARSERS = parser.Parser.NO_PAREN_FUNCTION_PARSERS.copy() 308 NO_PAREN_FUNCTION_PARSERS.pop("ANY") 309 310 RANGE_PARSERS = { 311 **parser.Parser.RANGE_PARSERS, 312 TokenType.GLOBAL: lambda self, this: self._match(TokenType.IN) 313 and self._parse_in(this, is_global=True), 314 } 315 316 # The PLACEHOLDER entry is popped because 1) it doesn't affect Clickhouse (it corresponds to 317 # the postgres-specific JSONBContains parser) and 2) it makes parsing the ternary op simpler. 318 COLUMN_OPERATORS = parser.Parser.COLUMN_OPERATORS.copy() 319 COLUMN_OPERATORS.pop(TokenType.PLACEHOLDER) 320 321 JOIN_KINDS = { 322 *parser.Parser.JOIN_KINDS, 323 TokenType.ANY, 324 TokenType.ASOF, 325 TokenType.ARRAY, 326 } 327 328 TABLE_ALIAS_TOKENS = parser.Parser.TABLE_ALIAS_TOKENS - { 329 TokenType.ANY, 330 TokenType.ARRAY, 331 TokenType.FINAL, 332 TokenType.FORMAT, 333 TokenType.SETTINGS, 334 } 335 336 ALIAS_TOKENS = parser.Parser.ALIAS_TOKENS - { 337 TokenType.FORMAT, 338 } 339 340 LOG_DEFAULTS_TO_LN = True 341 342 QUERY_MODIFIER_PARSERS = { 343 **parser.Parser.QUERY_MODIFIER_PARSERS, 344 TokenType.SETTINGS: lambda self: ( 345 "settings", 346 self._advance() or self._parse_csv(self._parse_conjunction), 347 ), 348 TokenType.FORMAT: lambda self: ("format", self._advance() or self._parse_id_var()), 349 } 350 351 CONSTRAINT_PARSERS = { 352 **parser.Parser.CONSTRAINT_PARSERS, 353 "INDEX": lambda self: self._parse_index_constraint(), 354 "CODEC": lambda self: self._parse_compress(), 355 } 356 357 ALTER_PARSERS = { 358 **parser.Parser.ALTER_PARSERS, 359 "REPLACE": lambda self: self._parse_alter_table_replace(), 360 } 361 362 SCHEMA_UNNAMED_CONSTRAINTS = { 363 *parser.Parser.SCHEMA_UNNAMED_CONSTRAINTS, 364 "INDEX", 365 } 366 367 def _parse_conjunction(self) -> t.Optional[exp.Expression]: 368 this = super()._parse_conjunction() 369 370 if self._match(TokenType.PLACEHOLDER): 371 return self.expression( 372 exp.If, 373 this=this, 374 true=self._parse_conjunction(), 375 false=self._match(TokenType.COLON) and self._parse_conjunction(), 376 ) 377 378 return this 379 380 def _parse_placeholder(self) -> t.Optional[exp.Expression]: 381 """ 382 Parse a placeholder expression like SELECT {abc: UInt32} or FROM {table: Identifier} 383 https://clickhouse.com/docs/en/sql-reference/syntax#defining-and-using-query-parameters 384 """ 385 if not self._match(TokenType.L_BRACE): 386 return None 387 388 this = self._parse_id_var() 389 self._match(TokenType.COLON) 390 kind = self._parse_types(check_func=False, allow_identifiers=False) or ( 391 self._match_text_seq("IDENTIFIER") and "Identifier" 392 ) 393 394 if not kind: 395 self.raise_error("Expecting a placeholder type or 'Identifier' for tables") 396 elif not self._match(TokenType.R_BRACE): 397 self.raise_error("Expecting }") 398 399 return self.expression(exp.Placeholder, this=this, kind=kind) 400 401 def _parse_in(self, this: t.Optional[exp.Expression], is_global: bool = False) -> exp.In: 402 this = super()._parse_in(this) 403 this.set("is_global", is_global) 404 return this 405 406 def _parse_table( 407 self, 408 schema: bool = False, 409 joins: bool = False, 410 alias_tokens: t.Optional[t.Collection[TokenType]] = None, 411 parse_bracket: bool = False, 412 is_db_reference: bool = False, 413 parse_partition: bool = False, 414 ) -> t.Optional[exp.Expression]: 415 this = super()._parse_table( 416 schema=schema, 417 joins=joins, 418 alias_tokens=alias_tokens, 419 parse_bracket=parse_bracket, 420 is_db_reference=is_db_reference, 421 ) 422 423 if self._match(TokenType.FINAL): 424 this = self.expression(exp.Final, this=this) 425 426 return this 427 428 def _parse_position(self, haystack_first: bool = False) -> exp.StrPosition: 429 return super()._parse_position(haystack_first=True) 430 431 # https://clickhouse.com/docs/en/sql-reference/statements/select/with/ 432 def _parse_cte(self) -> exp.CTE: 433 # WITH <identifier> AS <subquery expression> 434 cte: t.Optional[exp.CTE] = self._try_parse(super()._parse_cte) 435 436 if not cte: 437 # WITH <expression> AS <identifier> 438 cte = self.expression( 439 exp.CTE, 440 this=self._parse_conjunction(), 441 alias=self._parse_table_alias(), 442 scalar=True, 443 ) 444 445 return cte 446 447 def _parse_join_parts( 448 self, 449 ) -> t.Tuple[t.Optional[Token], t.Optional[Token], t.Optional[Token]]: 450 is_global = self._match(TokenType.GLOBAL) and self._prev 451 kind_pre = self._match_set(self.JOIN_KINDS, advance=False) and self._prev 452 453 if kind_pre: 454 kind = self._match_set(self.JOIN_KINDS) and self._prev 455 side = self._match_set(self.JOIN_SIDES) and self._prev 456 return is_global, side, kind 457 458 return ( 459 is_global, 460 self._match_set(self.JOIN_SIDES) and self._prev, 461 self._match_set(self.JOIN_KINDS) and self._prev, 462 ) 463 464 def _parse_join( 465 self, skip_join_token: bool = False, parse_bracket: bool = False 466 ) -> t.Optional[exp.Join]: 467 join = super()._parse_join(skip_join_token=skip_join_token, parse_bracket=True) 468 if join: 469 join.set("global", join.args.pop("method", None)) 470 471 return join 472 473 def _parse_function( 474 self, 475 functions: t.Optional[t.Dict[str, t.Callable]] = None, 476 anonymous: bool = False, 477 optional_parens: bool = True, 478 any_token: bool = False, 479 ) -> t.Optional[exp.Expression]: 480 expr = super()._parse_function( 481 functions=functions, 482 anonymous=anonymous, 483 optional_parens=optional_parens, 484 any_token=any_token, 485 ) 486 487 func = expr.this if isinstance(expr, exp.Window) else expr 488 489 # Aggregate functions can be split in 2 parts: <func_name><suffix> 490 parts = ( 491 self.AGG_FUNC_MAPPING.get(func.this) if isinstance(func, exp.Anonymous) else None 492 ) 493 494 if parts: 495 params = self._parse_func_params(func) 496 497 kwargs = { 498 "this": func.this, 499 "expressions": func.expressions, 500 } 501 if parts[1]: 502 kwargs["parts"] = parts 503 exp_class = exp.CombinedParameterizedAgg if params else exp.CombinedAggFunc 504 else: 505 exp_class = exp.ParameterizedAgg if params else exp.AnonymousAggFunc 506 507 kwargs["exp_class"] = exp_class 508 if params: 509 kwargs["params"] = params 510 511 func = self.expression(**kwargs) 512 513 if isinstance(expr, exp.Window): 514 # The window's func was parsed as Anonymous in base parser, fix its 515 # type to be CH style CombinedAnonymousAggFunc / AnonymousAggFunc 516 expr.set("this", func) 517 elif params: 518 # Params have blocked super()._parse_function() from parsing the following window 519 # (if that exists) as they're standing between the function call and the window spec 520 expr = self._parse_window(func) 521 else: 522 expr = func 523 524 return expr 525 526 def _parse_func_params( 527 self, this: t.Optional[exp.Func] = None 528 ) -> t.Optional[t.List[exp.Expression]]: 529 if self._match_pair(TokenType.R_PAREN, TokenType.L_PAREN): 530 return self._parse_csv(self._parse_lambda) 531 532 if self._match(TokenType.L_PAREN): 533 params = self._parse_csv(self._parse_lambda) 534 self._match_r_paren(this) 535 return params 536 537 return None 538 539 def _parse_quantile(self) -> exp.Quantile: 540 this = self._parse_lambda() 541 params = self._parse_func_params() 542 if params: 543 return self.expression(exp.Quantile, this=params[0], quantile=this) 544 return self.expression(exp.Quantile, this=this, quantile=exp.Literal.number(0.5)) 545 546 def _parse_wrapped_id_vars(self, optional: bool = False) -> t.List[exp.Expression]: 547 return super()._parse_wrapped_id_vars(optional=True) 548 549 def _parse_primary_key( 550 self, wrapped_optional: bool = False, in_props: bool = False 551 ) -> exp.PrimaryKeyColumnConstraint | exp.PrimaryKey: 552 return super()._parse_primary_key( 553 wrapped_optional=wrapped_optional or in_props, in_props=in_props 554 ) 555 556 def _parse_on_property(self) -> t.Optional[exp.Expression]: 557 index = self._index 558 if self._match_text_seq("CLUSTER"): 559 this = self._parse_id_var() 560 if this: 561 return self.expression(exp.OnCluster, this=this) 562 else: 563 self._retreat(index) 564 return None 565 566 def _parse_index_constraint( 567 self, kind: t.Optional[str] = None 568 ) -> exp.IndexColumnConstraint: 569 # INDEX name1 expr TYPE type1(args) GRANULARITY value 570 this = self._parse_id_var() 571 expression = self._parse_conjunction() 572 573 index_type = self._match_text_seq("TYPE") and ( 574 self._parse_function() or self._parse_var() 575 ) 576 577 granularity = self._match_text_seq("GRANULARITY") and self._parse_term() 578 579 return self.expression( 580 exp.IndexColumnConstraint, 581 this=this, 582 expression=expression, 583 index_type=index_type, 584 granularity=granularity, 585 ) 586 587 def _parse_partition(self) -> t.Optional[exp.Partition]: 588 # https://clickhouse.com/docs/en/sql-reference/statements/alter/partition#how-to-set-partition-expression 589 if not self._match(TokenType.PARTITION): 590 return None 591 592 if self._match_text_seq("ID"): 593 # Corresponds to the PARTITION ID <string_value> syntax 594 expressions: t.List[exp.Expression] = [ 595 self.expression(exp.PartitionId, this=self._parse_string()) 596 ] 597 else: 598 expressions = self._parse_expressions() 599 600 return self.expression(exp.Partition, expressions=expressions) 601 602 def _parse_alter_table_replace(self) -> t.Optional[exp.Expression]: 603 partition = self._parse_partition() 604 605 if not partition or not self._match(TokenType.FROM): 606 return None 607 608 return self.expression( 609 exp.ReplacePartition, expression=partition, source=self._parse_table_parts() 610 ) 611 612 class Generator(generator.Generator): 613 QUERY_HINTS = False 614 STRUCT_DELIMITER = ("(", ")") 615 NVL2_SUPPORTED = False 616 TABLESAMPLE_REQUIRES_PARENS = False 617 TABLESAMPLE_SIZE_IS_ROWS = False 618 TABLESAMPLE_KEYWORDS = "SAMPLE" 619 LAST_DAY_SUPPORTS_DATE_PART = False 620 CAN_IMPLEMENT_ARRAY_ANY = True 621 SUPPORTS_TO_NUMBER = False 622 623 STRING_TYPE_MAPPING = { 624 exp.DataType.Type.CHAR: "String", 625 exp.DataType.Type.LONGBLOB: "String", 626 exp.DataType.Type.LONGTEXT: "String", 627 exp.DataType.Type.MEDIUMBLOB: "String", 628 exp.DataType.Type.MEDIUMTEXT: "String", 629 exp.DataType.Type.TINYBLOB: "String", 630 exp.DataType.Type.TINYTEXT: "String", 631 exp.DataType.Type.TEXT: "String", 632 exp.DataType.Type.VARBINARY: "String", 633 exp.DataType.Type.VARCHAR: "String", 634 } 635 636 SUPPORTED_JSON_PATH_PARTS = { 637 exp.JSONPathKey, 638 exp.JSONPathRoot, 639 exp.JSONPathSubscript, 640 } 641 642 TYPE_MAPPING = { 643 **generator.Generator.TYPE_MAPPING, 644 **STRING_TYPE_MAPPING, 645 exp.DataType.Type.ARRAY: "Array", 646 exp.DataType.Type.BIGINT: "Int64", 647 exp.DataType.Type.DATE32: "Date32", 648 exp.DataType.Type.DATETIME64: "DateTime64", 649 exp.DataType.Type.DOUBLE: "Float64", 650 exp.DataType.Type.ENUM: "Enum", 651 exp.DataType.Type.ENUM8: "Enum8", 652 exp.DataType.Type.ENUM16: "Enum16", 653 exp.DataType.Type.FIXEDSTRING: "FixedString", 654 exp.DataType.Type.FLOAT: "Float32", 655 exp.DataType.Type.INT: "Int32", 656 exp.DataType.Type.MEDIUMINT: "Int32", 657 exp.DataType.Type.INT128: "Int128", 658 exp.DataType.Type.INT256: "Int256", 659 exp.DataType.Type.LOWCARDINALITY: "LowCardinality", 660 exp.DataType.Type.MAP: "Map", 661 exp.DataType.Type.NESTED: "Nested", 662 exp.DataType.Type.NULLABLE: "Nullable", 663 exp.DataType.Type.SMALLINT: "Int16", 664 exp.DataType.Type.STRUCT: "Tuple", 665 exp.DataType.Type.TINYINT: "Int8", 666 exp.DataType.Type.UBIGINT: "UInt64", 667 exp.DataType.Type.UINT: "UInt32", 668 exp.DataType.Type.UINT128: "UInt128", 669 exp.DataType.Type.UINT256: "UInt256", 670 exp.DataType.Type.USMALLINT: "UInt16", 671 exp.DataType.Type.UTINYINT: "UInt8", 672 exp.DataType.Type.IPV4: "IPv4", 673 exp.DataType.Type.IPV6: "IPv6", 674 exp.DataType.Type.AGGREGATEFUNCTION: "AggregateFunction", 675 exp.DataType.Type.SIMPLEAGGREGATEFUNCTION: "SimpleAggregateFunction", 676 } 677 678 TRANSFORMS = { 679 **generator.Generator.TRANSFORMS, 680 exp.AnyValue: rename_func("any"), 681 exp.ApproxDistinct: rename_func("uniq"), 682 exp.ArrayFilter: lambda self, e: self.func("arrayFilter", e.expression, e.this), 683 exp.ArraySize: rename_func("LENGTH"), 684 exp.ArraySum: rename_func("arraySum"), 685 exp.ArgMax: arg_max_or_min_no_count("argMax"), 686 exp.ArgMin: arg_max_or_min_no_count("argMin"), 687 exp.Array: inline_array_sql, 688 exp.CastToStrType: rename_func("CAST"), 689 exp.CountIf: rename_func("countIf"), 690 exp.CompressColumnConstraint: lambda self, 691 e: f"CODEC({self.expressions(e, key='this', flat=True)})", 692 exp.ComputedColumnConstraint: lambda self, 693 e: f"{'MATERIALIZED' if e.args.get('persisted') else 'ALIAS'} {self.sql(e, 'this')}", 694 exp.CurrentDate: lambda self, e: self.func("CURRENT_DATE"), 695 exp.DateAdd: date_delta_sql("DATE_ADD"), 696 exp.DateDiff: date_delta_sql("DATE_DIFF"), 697 exp.Explode: rename_func("arrayJoin"), 698 exp.Final: lambda self, e: f"{self.sql(e, 'this')} FINAL", 699 exp.IsNan: rename_func("isNaN"), 700 exp.JSONExtract: json_extract_segments("JSONExtractString", quoted_index=False), 701 exp.JSONExtractScalar: json_extract_segments("JSONExtractString", quoted_index=False), 702 exp.JSONPathKey: json_path_key_only_name, 703 exp.JSONPathRoot: lambda *_: "", 704 exp.Map: lambda self, e: _lower_func(var_map_sql(self, e)), 705 exp.Nullif: rename_func("nullIf"), 706 exp.PartitionedByProperty: lambda self, e: f"PARTITION BY {self.sql(e, 'this')}", 707 exp.Pivot: no_pivot_sql, 708 exp.Quantile: _quantile_sql, 709 exp.RegexpLike: lambda self, e: self.func("match", e.this, e.expression), 710 exp.Rand: rename_func("randCanonical"), 711 exp.Select: transforms.preprocess([transforms.eliminate_qualify]), 712 exp.StartsWith: rename_func("startsWith"), 713 exp.StrPosition: lambda self, e: self.func( 714 "position", e.this, e.args.get("substr"), e.args.get("position") 715 ), 716 exp.TimeToStr: lambda self, e: self.func( 717 "DATE_FORMAT", e.this, self.format_time(e), e.args.get("timezone") 718 ), 719 exp.VarMap: lambda self, e: _lower_func(var_map_sql(self, e)), 720 exp.Xor: lambda self, e: self.func("xor", e.this, e.expression, *e.expressions), 721 } 722 723 PROPERTIES_LOCATION = { 724 **generator.Generator.PROPERTIES_LOCATION, 725 exp.VolatileProperty: exp.Properties.Location.UNSUPPORTED, 726 exp.PartitionedByProperty: exp.Properties.Location.POST_SCHEMA, 727 exp.OnCluster: exp.Properties.Location.POST_NAME, 728 } 729 730 JOIN_HINTS = False 731 TABLE_HINTS = False 732 EXPLICIT_UNION = True 733 GROUPINGS_SEP = "" 734 OUTER_UNION_MODIFIERS = False 735 736 # there's no list in docs, but it can be found in Clickhouse code 737 # see `ClickHouse/src/Parsers/ParserCreate*.cpp` 738 ON_CLUSTER_TARGETS = { 739 "DATABASE", 740 "TABLE", 741 "VIEW", 742 "DICTIONARY", 743 "INDEX", 744 "FUNCTION", 745 "NAMED COLLECTION", 746 } 747 748 def _jsonpathsubscript_sql(self, expression: exp.JSONPathSubscript) -> str: 749 this = self.json_path_part(expression.this) 750 return str(int(this) + 1) if is_int(this) else this 751 752 def likeproperty_sql(self, expression: exp.LikeProperty) -> str: 753 return f"AS {self.sql(expression, 'this')}" 754 755 def _any_to_has( 756 self, 757 expression: exp.EQ | exp.NEQ, 758 default: t.Callable[[t.Any], str], 759 prefix: str = "", 760 ) -> str: 761 if isinstance(expression.left, exp.Any): 762 arr = expression.left 763 this = expression.right 764 elif isinstance(expression.right, exp.Any): 765 arr = expression.right 766 this = expression.left 767 else: 768 return default(expression) 769 770 return prefix + self.func("has", arr.this.unnest(), this) 771 772 def eq_sql(self, expression: exp.EQ) -> str: 773 return self._any_to_has(expression, super().eq_sql) 774 775 def neq_sql(self, expression: exp.NEQ) -> str: 776 return self._any_to_has(expression, super().neq_sql, "NOT ") 777 778 def regexpilike_sql(self, expression: exp.RegexpILike) -> str: 779 # Manually add a flag to make the search case-insensitive 780 regex = self.func("CONCAT", "'(?i)'", expression.expression) 781 return self.func("match", expression.this, regex) 782 783 def datatype_sql(self, expression: exp.DataType) -> str: 784 # String is the standard ClickHouse type, every other variant is just an alias. 785 # Additionally, any supplied length parameter will be ignored. 786 # 787 # https://clickhouse.com/docs/en/sql-reference/data-types/string 788 if expression.this in self.STRING_TYPE_MAPPING: 789 return "String" 790 791 return super().datatype_sql(expression) 792 793 def cte_sql(self, expression: exp.CTE) -> str: 794 if expression.args.get("scalar"): 795 this = self.sql(expression, "this") 796 alias = self.sql(expression, "alias") 797 return f"{this} AS {alias}" 798 799 return super().cte_sql(expression) 800 801 def after_limit_modifiers(self, expression: exp.Expression) -> t.List[str]: 802 return super().after_limit_modifiers(expression) + [ 803 ( 804 self.seg("SETTINGS ") + self.expressions(expression, key="settings", flat=True) 805 if expression.args.get("settings") 806 else "" 807 ), 808 ( 809 self.seg("FORMAT ") + self.sql(expression, "format") 810 if expression.args.get("format") 811 else "" 812 ), 813 ] 814 815 def parameterizedagg_sql(self, expression: exp.ParameterizedAgg) -> str: 816 params = self.expressions(expression, key="params", flat=True) 817 return self.func(expression.name, *expression.expressions) + f"({params})" 818 819 def anonymousaggfunc_sql(self, expression: exp.AnonymousAggFunc) -> str: 820 return self.func(expression.name, *expression.expressions) 821 822 def combinedaggfunc_sql(self, expression: exp.CombinedAggFunc) -> str: 823 return self.anonymousaggfunc_sql(expression) 824 825 def combinedparameterizedagg_sql(self, expression: exp.CombinedParameterizedAgg) -> str: 826 return self.parameterizedagg_sql(expression) 827 828 def placeholder_sql(self, expression: exp.Placeholder) -> str: 829 return f"{{{expression.name}: {self.sql(expression, 'kind')}}}" 830 831 def oncluster_sql(self, expression: exp.OnCluster) -> str: 832 return f"ON CLUSTER {self.sql(expression, 'this')}" 833 834 def createable_sql(self, expression: exp.Create, locations: t.DefaultDict) -> str: 835 if expression.kind in self.ON_CLUSTER_TARGETS and locations.get( 836 exp.Properties.Location.POST_NAME 837 ): 838 this_name = self.sql(expression.this, "this") 839 this_properties = " ".join( 840 [self.sql(prop) for prop in locations[exp.Properties.Location.POST_NAME]] 841 ) 842 this_schema = self.schema_columns_sql(expression.this) 843 return f"{this_name}{self.sep()}{this_properties}{self.sep()}{this_schema}" 844 845 return super().createable_sql(expression, locations) 846 847 def prewhere_sql(self, expression: exp.PreWhere) -> str: 848 this = self.indent(self.sql(expression, "this")) 849 return f"{self.seg('PREWHERE')}{self.sep()}{this}" 850 851 def indexcolumnconstraint_sql(self, expression: exp.IndexColumnConstraint) -> str: 852 this = self.sql(expression, "this") 853 this = f" {this}" if this else "" 854 expr = self.sql(expression, "expression") 855 expr = f" {expr}" if expr else "" 856 index_type = self.sql(expression, "index_type") 857 index_type = f" TYPE {index_type}" if index_type else "" 858 granularity = self.sql(expression, "granularity") 859 granularity = f" GRANULARITY {granularity}" if granularity else "" 860 861 return f"INDEX{this}{expr}{index_type}{granularity}" 862 863 def partition_sql(self, expression: exp.Partition) -> str: 864 return f"PARTITION {self.expressions(expression, flat=True)}" 865 866 def partitionid_sql(self, expression: exp.PartitionId) -> str: 867 return f"ID {self.sql(expression.this)}" 868 869 def replacepartition_sql(self, expression: exp.ReplacePartition) -> str: 870 return ( 871 f"REPLACE {self.sql(expression.expression)} FROM {self.sql(expression, 'source')}" 872 )
NORMALIZE_FUNCTIONS: bool | str =
False
Determines how function names are going to be normalized.
Possible values:
"upper" or True: Convert names to uppercase. "lower": Convert names to lowercase. False: Disables function name normalization.
NULL_ORDERING =
'nulls_are_last'
Default NULL
ordering method to use if not explicitly set.
Possible values: "nulls_are_small"
, "nulls_are_large"
, "nulls_are_last"
LOG_BASE_FIRST: Optional[bool] =
None
Whether the base comes first in the LOG
function.
Possible values: True
, False
, None
(two arguments are not supported by LOG
)
UNESCAPED_SEQUENCES =
{'\\a': '\x07', '\\b': '\x08', '\\f': '\x0c', '\\n': '\n', '\\r': '\r', '\\t': '\t', '\\v': '\x0b', '\\\\': '\\', '\\0': '\x00'}
Mapping of an escaped sequence (\n
) to its unescaped version (
).
tokenizer_class =
<class 'ClickHouse.Tokenizer'>
parser_class =
<class 'ClickHouse.Parser'>
generator_class =
<class 'ClickHouse.Generator'>
ESCAPED_SEQUENCES: Dict[str, str] =
{'\x07': '\\a', '\x08': '\\b', '\x0c': '\\f', '\n': '\\n', '\r': '\\r', '\t': '\\t', '\x0b': '\\v', '\\': '\\\\', '\x00': '\\0'}
Inherited Members
- sqlglot.dialects.dialect.Dialect
- Dialect
- INDEX_OFFSET
- WEEK_OFFSET
- UNNEST_COLUMN_ONLY
- ALIAS_POST_TABLESAMPLE
- TABLESAMPLE_SIZE_IS_PERCENT
- NORMALIZATION_STRATEGY
- IDENTIFIERS_CAN_START_WITH_DIGIT
- DPIPE_IS_STRING_CONCAT
- STRICT_STRING_CONCAT
- SUPPORTS_SEMI_ANTI_JOIN
- TYPED_DIVISION
- CONCAT_COALESCE
- DATE_FORMAT
- DATEINT_FORMAT
- TIME_FORMAT
- TIME_MAPPING
- FORMAT_MAPPING
- PSEUDOCOLUMNS
- PREFER_CTE_ALIAS_COLUMN
- COPY_PARAMS_ARE_CSV
- get_or_raise
- format_time
- normalize_identifier
- case_sensitive
- can_identify
- quote_identifier
- to_json_path
- parse
- parse_into
- generate
- transpile
- tokenize
- tokenizer
- parser
- generator
69 class Tokenizer(tokens.Tokenizer): 70 COMMENTS = ["--", "#", "#!", ("/*", "*/")] 71 IDENTIFIERS = ['"', "`"] 72 STRING_ESCAPES = ["'", "\\"] 73 BIT_STRINGS = [("0b", "")] 74 HEX_STRINGS = [("0x", ""), ("0X", "")] 75 HEREDOC_STRINGS = ["$"] 76 77 KEYWORDS = { 78 **tokens.Tokenizer.KEYWORDS, 79 "ATTACH": TokenType.COMMAND, 80 "DATE32": TokenType.DATE32, 81 "DATETIME64": TokenType.DATETIME64, 82 "DICTIONARY": TokenType.DICTIONARY, 83 "ENUM8": TokenType.ENUM8, 84 "ENUM16": TokenType.ENUM16, 85 "FINAL": TokenType.FINAL, 86 "FIXEDSTRING": TokenType.FIXEDSTRING, 87 "FLOAT32": TokenType.FLOAT, 88 "FLOAT64": TokenType.DOUBLE, 89 "GLOBAL": TokenType.GLOBAL, 90 "INT256": TokenType.INT256, 91 "LOWCARDINALITY": TokenType.LOWCARDINALITY, 92 "MAP": TokenType.MAP, 93 "NESTED": TokenType.NESTED, 94 "SAMPLE": TokenType.TABLE_SAMPLE, 95 "TUPLE": TokenType.STRUCT, 96 "UINT128": TokenType.UINT128, 97 "UINT16": TokenType.USMALLINT, 98 "UINT256": TokenType.UINT256, 99 "UINT32": TokenType.UINT, 100 "UINT64": TokenType.UBIGINT, 101 "UINT8": TokenType.UTINYINT, 102 "IPV4": TokenType.IPV4, 103 "IPV6": TokenType.IPV6, 104 "AGGREGATEFUNCTION": TokenType.AGGREGATEFUNCTION, 105 "SIMPLEAGGREGATEFUNCTION": TokenType.SIMPLEAGGREGATEFUNCTION, 106 "SYSTEM": TokenType.COMMAND, 107 "PREWHERE": TokenType.PREWHERE, 108 } 109 110 SINGLE_TOKENS = { 111 **tokens.Tokenizer.SINGLE_TOKENS, 112 "$": TokenType.HEREDOC_STRING, 113 }
KEYWORDS =
{'{%': <TokenType.BLOCK_START: 'BLOCK_START'>, '{%+': <TokenType.BLOCK_START: 'BLOCK_START'>, '{%-': <TokenType.BLOCK_START: 'BLOCK_START'>, '%}': <TokenType.BLOCK_END: 'BLOCK_END'>, '+%}': <TokenType.BLOCK_END: 'BLOCK_END'>, '-%}': <TokenType.BLOCK_END: 'BLOCK_END'>, '{{+': <TokenType.BLOCK_START: 'BLOCK_START'>, '{{-': <TokenType.BLOCK_START: 'BLOCK_START'>, '+}}': <TokenType.BLOCK_END: 'BLOCK_END'>, '-}}': <TokenType.BLOCK_END: 'BLOCK_END'>, '/*+': <TokenType.HINT: 'HINT'>, '==': <TokenType.EQ: 'EQ'>, '::': <TokenType.DCOLON: 'DCOLON'>, '||': <TokenType.DPIPE: 'DPIPE'>, '>=': <TokenType.GTE: 'GTE'>, '<=': <TokenType.LTE: 'LTE'>, '<>': <TokenType.NEQ: 'NEQ'>, '!=': <TokenType.NEQ: 'NEQ'>, ':=': <TokenType.COLON_EQ: 'COLON_EQ'>, '<=>': <TokenType.NULLSAFE_EQ: 'NULLSAFE_EQ'>, '->': <TokenType.ARROW: 'ARROW'>, '->>': <TokenType.DARROW: 'DARROW'>, '=>': <TokenType.FARROW: 'FARROW'>, '#>': <TokenType.HASH_ARROW: 'HASH_ARROW'>, '#>>': <TokenType.DHASH_ARROW: 'DHASH_ARROW'>, '<->': <TokenType.LR_ARROW: 'LR_ARROW'>, '&&': <TokenType.DAMP: 'DAMP'>, '??': <TokenType.DQMARK: 'DQMARK'>, 'ALL': <TokenType.ALL: 'ALL'>, 'ALWAYS': <TokenType.ALWAYS: 'ALWAYS'>, 'AND': <TokenType.AND: 'AND'>, 'ANTI': <TokenType.ANTI: 'ANTI'>, 'ANY': <TokenType.ANY: 'ANY'>, 'ASC': <TokenType.ASC: 'ASC'>, 'AS': <TokenType.ALIAS: 'ALIAS'>, 'ASOF': <TokenType.ASOF: 'ASOF'>, 'AUTOINCREMENT': <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, 'AUTO_INCREMENT': <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, 'BEGIN': <TokenType.BEGIN: 'BEGIN'>, 'BETWEEN': <TokenType.BETWEEN: 'BETWEEN'>, 'CACHE': <TokenType.CACHE: 'CACHE'>, 'UNCACHE': <TokenType.UNCACHE: 'UNCACHE'>, 'CASE': <TokenType.CASE: 'CASE'>, 'CHARACTER SET': <TokenType.CHARACTER_SET: 'CHARACTER_SET'>, 'CLUSTER BY': <TokenType.CLUSTER_BY: 'CLUSTER_BY'>, 'COLLATE': <TokenType.COLLATE: 'COLLATE'>, 'COLUMN': <TokenType.COLUMN: 'COLUMN'>, 'COMMIT': <TokenType.COMMIT: 'COMMIT'>, 'CONNECT BY': <TokenType.CONNECT_BY: 'CONNECT_BY'>, 'CONSTRAINT': <TokenType.CONSTRAINT: 'CONSTRAINT'>, 'COPY': <TokenType.COPY: 'COPY'>, 'CREATE': <TokenType.CREATE: 'CREATE'>, 'CROSS': <TokenType.CROSS: 'CROSS'>, 'CUBE': <TokenType.CUBE: 'CUBE'>, 'CURRENT_DATE': <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, 'CURRENT_TIME': <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, 'CURRENT_TIMESTAMP': <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, 'CURRENT_USER': <TokenType.CURRENT_USER: 'CURRENT_USER'>, 'DATABASE': <TokenType.DATABASE: 'DATABASE'>, 'DEFAULT': <TokenType.DEFAULT: 'DEFAULT'>, 'DELETE': <TokenType.DELETE: 'DELETE'>, 'DESC': <TokenType.DESC: 'DESC'>, 'DESCRIBE': <TokenType.DESCRIBE: 'DESCRIBE'>, 'DISTINCT': <TokenType.DISTINCT: 'DISTINCT'>, 'DISTRIBUTE BY': <TokenType.DISTRIBUTE_BY: 'DISTRIBUTE_BY'>, 'DIV': <TokenType.DIV: 'DIV'>, 'DROP': <TokenType.DROP: 'DROP'>, 'ELSE': <TokenType.ELSE: 'ELSE'>, 'END': <TokenType.END: 'END'>, 'ENUM': <TokenType.ENUM: 'ENUM'>, 'ESCAPE': <TokenType.ESCAPE: 'ESCAPE'>, 'EXCEPT': <TokenType.EXCEPT: 'EXCEPT'>, 'EXECUTE': <TokenType.EXECUTE: 'EXECUTE'>, 'EXISTS': <TokenType.EXISTS: 'EXISTS'>, 'FALSE': <TokenType.FALSE: 'FALSE'>, 'FETCH': <TokenType.FETCH: 'FETCH'>, 'FILTER': <TokenType.FILTER: 'FILTER'>, 'FIRST': <TokenType.FIRST: 'FIRST'>, 'FULL': <TokenType.FULL: 'FULL'>, 'FUNCTION': <TokenType.FUNCTION: 'FUNCTION'>, 'FOR': <TokenType.FOR: 'FOR'>, 'FOREIGN KEY': <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, 'FORMAT': <TokenType.FORMAT: 'FORMAT'>, 'FROM': <TokenType.FROM: 'FROM'>, 'GEOGRAPHY': <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, 'GEOMETRY': <TokenType.GEOMETRY: 'GEOMETRY'>, 'GLOB': <TokenType.GLOB: 'GLOB'>, 'GROUP BY': <TokenType.GROUP_BY: 'GROUP_BY'>, 'GROUPING SETS': <TokenType.GROUPING_SETS: 'GROUPING_SETS'>, 'HAVING': <TokenType.HAVING: 'HAVING'>, 'ILIKE': <TokenType.ILIKE: 'ILIKE'>, 'IN': <TokenType.IN: 'IN'>, 'INDEX': <TokenType.INDEX: 'INDEX'>, 'INET': <TokenType.INET: 'INET'>, 'INNER': <TokenType.INNER: 'INNER'>, 'INSERT': <TokenType.INSERT: 'INSERT'>, 'INTERVAL': <TokenType.INTERVAL: 'INTERVAL'>, 'INTERSECT': <TokenType.INTERSECT: 'INTERSECT'>, 'INTO': <TokenType.INTO: 'INTO'>, 'IS': <TokenType.IS: 'IS'>, 'ISNULL': <TokenType.ISNULL: 'ISNULL'>, 'JOIN': <TokenType.JOIN: 'JOIN'>, 'KEEP': <TokenType.KEEP: 'KEEP'>, 'KILL': <TokenType.KILL: 'KILL'>, 'LATERAL': <TokenType.LATERAL: 'LATERAL'>, 'LEFT': <TokenType.LEFT: 'LEFT'>, 'LIKE': <TokenType.LIKE: 'LIKE'>, 'LIMIT': <TokenType.LIMIT: 'LIMIT'>, 'LOAD': <TokenType.LOAD: 'LOAD'>, 'LOCK': <TokenType.LOCK: 'LOCK'>, 'MERGE': <TokenType.MERGE: 'MERGE'>, 'NATURAL': <TokenType.NATURAL: 'NATURAL'>, 'NEXT': <TokenType.NEXT: 'NEXT'>, 'NOT': <TokenType.NOT: 'NOT'>, 'NOTNULL': <TokenType.NOTNULL: 'NOTNULL'>, 'NULL': <TokenType.NULL: 'NULL'>, 'OBJECT': <TokenType.OBJECT: 'OBJECT'>, 'OFFSET': <TokenType.OFFSET: 'OFFSET'>, 'ON': <TokenType.ON: 'ON'>, 'OR': <TokenType.OR: 'OR'>, 'XOR': <TokenType.XOR: 'XOR'>, 'ORDER BY': <TokenType.ORDER_BY: 'ORDER_BY'>, 'ORDINALITY': <TokenType.ORDINALITY: 'ORDINALITY'>, 'OUTER': <TokenType.OUTER: 'OUTER'>, 'OVER': <TokenType.OVER: 'OVER'>, 'OVERLAPS': <TokenType.OVERLAPS: 'OVERLAPS'>, 'OVERWRITE': <TokenType.OVERWRITE: 'OVERWRITE'>, 'PARTITION': <TokenType.PARTITION: 'PARTITION'>, 'PARTITION BY': <TokenType.PARTITION_BY: 'PARTITION_BY'>, 'PARTITIONED BY': <TokenType.PARTITION_BY: 'PARTITION_BY'>, 'PARTITIONED_BY': <TokenType.PARTITION_BY: 'PARTITION_BY'>, 'PERCENT': <TokenType.PERCENT: 'PERCENT'>, 'PIVOT': <TokenType.PIVOT: 'PIVOT'>, 'PRAGMA': <TokenType.PRAGMA: 'PRAGMA'>, 'PRIMARY KEY': <TokenType.PRIMARY_KEY: 'PRIMARY_KEY'>, 'PROCEDURE': <TokenType.PROCEDURE: 'PROCEDURE'>, 'QUALIFY': <TokenType.QUALIFY: 'QUALIFY'>, 'RANGE': <TokenType.RANGE: 'RANGE'>, 'RECURSIVE': <TokenType.RECURSIVE: 'RECURSIVE'>, 'REGEXP': <TokenType.RLIKE: 'RLIKE'>, 'REPLACE': <TokenType.REPLACE: 'REPLACE'>, 'RETURNING': <TokenType.RETURNING: 'RETURNING'>, 'REFERENCES': <TokenType.REFERENCES: 'REFERENCES'>, 'RIGHT': <TokenType.RIGHT: 'RIGHT'>, 'RLIKE': <TokenType.RLIKE: 'RLIKE'>, 'ROLLBACK': <TokenType.ROLLBACK: 'ROLLBACK'>, 'ROLLUP': <TokenType.ROLLUP: 'ROLLUP'>, 'ROW': <TokenType.ROW: 'ROW'>, 'ROWS': <TokenType.ROWS: 'ROWS'>, 'SCHEMA': <TokenType.SCHEMA: 'SCHEMA'>, 'SELECT': <TokenType.SELECT: 'SELECT'>, 'SEMI': <TokenType.SEMI: 'SEMI'>, 'SET': <TokenType.SET: 'SET'>, 'SETTINGS': <TokenType.SETTINGS: 'SETTINGS'>, 'SHOW': <TokenType.SHOW: 'SHOW'>, 'SIMILAR TO': <TokenType.SIMILAR_TO: 'SIMILAR_TO'>, 'SOME': <TokenType.SOME: 'SOME'>, 'SORT BY': <TokenType.SORT_BY: 'SORT_BY'>, 'START WITH': <TokenType.START_WITH: 'START_WITH'>, 'TABLE': <TokenType.TABLE: 'TABLE'>, 'TABLESAMPLE': <TokenType.TABLE_SAMPLE: 'TABLE_SAMPLE'>, 'TEMP': <TokenType.TEMPORARY: 'TEMPORARY'>, 'TEMPORARY': <TokenType.TEMPORARY: 'TEMPORARY'>, 'THEN': <TokenType.THEN: 'THEN'>, 'TRUE': <TokenType.TRUE: 'TRUE'>, 'TRUNCATE': <TokenType.TRUNCATE: 'TRUNCATE'>, 'UNION': <TokenType.UNION: 'UNION'>, 'UNKNOWN': <TokenType.UNKNOWN: 'UNKNOWN'>, 'UNNEST': <TokenType.UNNEST: 'UNNEST'>, 'UNPIVOT': <TokenType.UNPIVOT: 'UNPIVOT'>, 'UPDATE': <TokenType.UPDATE: 'UPDATE'>, 'USE': <TokenType.USE: 'USE'>, 'USING': <TokenType.USING: 'USING'>, 'UUID': <TokenType.UUID: 'UUID'>, 'VALUES': <TokenType.VALUES: 'VALUES'>, 'VIEW': <TokenType.VIEW: 'VIEW'>, 'VOLATILE': <TokenType.VOLATILE: 'VOLATILE'>, 'WHEN': <TokenType.WHEN: 'WHEN'>, 'WHERE': <TokenType.WHERE: 'WHERE'>, 'WINDOW': <TokenType.WINDOW: 'WINDOW'>, 'WITH': <TokenType.WITH: 'WITH'>, 'APPLY': <TokenType.APPLY: 'APPLY'>, 'ARRAY': <TokenType.ARRAY: 'ARRAY'>, 'BIT': <TokenType.BIT: 'BIT'>, 'BOOL': <TokenType.BOOLEAN: 'BOOLEAN'>, 'BOOLEAN': <TokenType.BOOLEAN: 'BOOLEAN'>, 'BYTE': <TokenType.TINYINT: 'TINYINT'>, 'MEDIUMINT': <TokenType.MEDIUMINT: 'MEDIUMINT'>, 'INT1': <TokenType.TINYINT: 'TINYINT'>, 'TINYINT': <TokenType.TINYINT: 'TINYINT'>, 'INT16': <TokenType.SMALLINT: 'SMALLINT'>, 'SHORT': <TokenType.SMALLINT: 'SMALLINT'>, 'SMALLINT': <TokenType.SMALLINT: 'SMALLINT'>, 'INT128': <TokenType.INT128: 'INT128'>, 'HUGEINT': <TokenType.INT128: 'INT128'>, 'INT2': <TokenType.SMALLINT: 'SMALLINT'>, 'INTEGER': <TokenType.INT: 'INT'>, 'INT': <TokenType.INT: 'INT'>, 'INT4': <TokenType.INT: 'INT'>, 'INT32': <TokenType.INT: 'INT'>, 'INT64': <TokenType.BIGINT: 'BIGINT'>, 'LONG': <TokenType.BIGINT: 'BIGINT'>, 'BIGINT': <TokenType.BIGINT: 'BIGINT'>, 'INT8': <TokenType.TINYINT: 'TINYINT'>, 'UINT': <TokenType.UINT: 'UINT'>, 'DEC': <TokenType.DECIMAL: 'DECIMAL'>, 'DECIMAL': <TokenType.DECIMAL: 'DECIMAL'>, 'BIGDECIMAL': <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, 'BIGNUMERIC': <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, 'MAP': <TokenType.MAP: 'MAP'>, 'NULLABLE': <TokenType.NULLABLE: 'NULLABLE'>, 'NUMBER': <TokenType.DECIMAL: 'DECIMAL'>, 'NUMERIC': <TokenType.DECIMAL: 'DECIMAL'>, 'FIXED': <TokenType.DECIMAL: 'DECIMAL'>, 'REAL': <TokenType.FLOAT: 'FLOAT'>, 'FLOAT': <TokenType.FLOAT: 'FLOAT'>, 'FLOAT4': <TokenType.FLOAT: 'FLOAT'>, 'FLOAT8': <TokenType.DOUBLE: 'DOUBLE'>, 'DOUBLE': <TokenType.DOUBLE: 'DOUBLE'>, 'DOUBLE PRECISION': <TokenType.DOUBLE: 'DOUBLE'>, 'JSON': <TokenType.JSON: 'JSON'>, 'CHAR': <TokenType.CHAR: 'CHAR'>, 'CHARACTER': <TokenType.CHAR: 'CHAR'>, 'NCHAR': <TokenType.NCHAR: 'NCHAR'>, 'VARCHAR': <TokenType.VARCHAR: 'VARCHAR'>, 'VARCHAR2': <TokenType.VARCHAR: 'VARCHAR'>, 'NVARCHAR': <TokenType.NVARCHAR: 'NVARCHAR'>, 'NVARCHAR2': <TokenType.NVARCHAR: 'NVARCHAR'>, 'BPCHAR': <TokenType.BPCHAR: 'BPCHAR'>, 'STR': <TokenType.TEXT: 'TEXT'>, 'STRING': <TokenType.TEXT: 'TEXT'>, 'TEXT': <TokenType.TEXT: 'TEXT'>, 'LONGTEXT': <TokenType.LONGTEXT: 'LONGTEXT'>, 'MEDIUMTEXT': <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, 'TINYTEXT': <TokenType.TINYTEXT: 'TINYTEXT'>, 'CLOB': <TokenType.TEXT: 'TEXT'>, 'LONGVARCHAR': <TokenType.TEXT: 'TEXT'>, 'BINARY': <TokenType.BINARY: 'BINARY'>, 'BLOB': <TokenType.VARBINARY: 'VARBINARY'>, 'LONGBLOB': <TokenType.LONGBLOB: 'LONGBLOB'>, 'MEDIUMBLOB': <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, 'TINYBLOB': <TokenType.TINYBLOB: 'TINYBLOB'>, 'BYTEA': <TokenType.VARBINARY: 'VARBINARY'>, 'VARBINARY': <TokenType.VARBINARY: 'VARBINARY'>, 'TIME': <TokenType.TIME: 'TIME'>, 'TIMETZ': <TokenType.TIMETZ: 'TIMETZ'>, 'TIMESTAMP': <TokenType.TIMESTAMP: 'TIMESTAMP'>, 'TIMESTAMPTZ': <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, 'TIMESTAMPLTZ': <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, 'TIMESTAMP_LTZ': <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, 'TIMESTAMPNTZ': <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, 'TIMESTAMP_NTZ': <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, 'DATE': <TokenType.DATE: 'DATE'>, 'DATETIME': <TokenType.DATETIME: 'DATETIME'>, 'INT4RANGE': <TokenType.INT4RANGE: 'INT4RANGE'>, 'INT4MULTIRANGE': <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, 'INT8RANGE': <TokenType.INT8RANGE: 'INT8RANGE'>, 'INT8MULTIRANGE': <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, 'NUMRANGE': <TokenType.NUMRANGE: 'NUMRANGE'>, 'NUMMULTIRANGE': <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, 'TSRANGE': <TokenType.TSRANGE: 'TSRANGE'>, 'TSMULTIRANGE': <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, 'TSTZRANGE': <TokenType.TSTZRANGE: 'TSTZRANGE'>, 'TSTZMULTIRANGE': <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, 'DATERANGE': <TokenType.DATERANGE: 'DATERANGE'>, 'DATEMULTIRANGE': <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, 'UNIQUE': <TokenType.UNIQUE: 'UNIQUE'>, 'STRUCT': <TokenType.STRUCT: 'STRUCT'>, 'SEQUENCE': <TokenType.SEQUENCE: 'SEQUENCE'>, 'VARIANT': <TokenType.VARIANT: 'VARIANT'>, 'ALTER': <TokenType.ALTER: 'ALTER'>, 'ANALYZE': <TokenType.COMMAND: 'COMMAND'>, 'CALL': <TokenType.COMMAND: 'COMMAND'>, 'COMMENT': <TokenType.COMMENT: 'COMMENT'>, 'EXPLAIN': <TokenType.COMMAND: 'COMMAND'>, 'GRANT': <TokenType.COMMAND: 'COMMAND'>, 'OPTIMIZE': <TokenType.COMMAND: 'COMMAND'>, 'PREPARE': <TokenType.COMMAND: 'COMMAND'>, 'VACUUM': <TokenType.COMMAND: 'COMMAND'>, 'USER-DEFINED': <TokenType.USERDEFINED: 'USERDEFINED'>, 'FOR VERSION': <TokenType.VERSION_SNAPSHOT: 'VERSION_SNAPSHOT'>, 'FOR TIMESTAMP': <TokenType.TIMESTAMP_SNAPSHOT: 'TIMESTAMP_SNAPSHOT'>, 'ATTACH': <TokenType.COMMAND: 'COMMAND'>, 'DATE32': <TokenType.DATE32: 'DATE32'>, 'DATETIME64': <TokenType.DATETIME64: 'DATETIME64'>, 'DICTIONARY': <TokenType.DICTIONARY: 'DICTIONARY'>, 'ENUM8': <TokenType.ENUM8: 'ENUM8'>, 'ENUM16': <TokenType.ENUM16: 'ENUM16'>, 'FINAL': <TokenType.FINAL: 'FINAL'>, 'FIXEDSTRING': <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, 'FLOAT32': <TokenType.FLOAT: 'FLOAT'>, 'FLOAT64': <TokenType.DOUBLE: 'DOUBLE'>, 'GLOBAL': <TokenType.GLOBAL: 'GLOBAL'>, 'INT256': <TokenType.INT256: 'INT256'>, 'LOWCARDINALITY': <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, 'NESTED': <TokenType.NESTED: 'NESTED'>, 'SAMPLE': <TokenType.TABLE_SAMPLE: 'TABLE_SAMPLE'>, 'TUPLE': <TokenType.STRUCT: 'STRUCT'>, 'UINT128': <TokenType.UINT128: 'UINT128'>, 'UINT16': <TokenType.USMALLINT: 'USMALLINT'>, 'UINT256': <TokenType.UINT256: 'UINT256'>, 'UINT32': <TokenType.UINT: 'UINT'>, 'UINT64': <TokenType.UBIGINT: 'UBIGINT'>, 'UINT8': <TokenType.UTINYINT: 'UTINYINT'>, 'IPV4': <TokenType.IPV4: 'IPV4'>, 'IPV6': <TokenType.IPV6: 'IPV6'>, 'AGGREGATEFUNCTION': <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, 'SIMPLEAGGREGATEFUNCTION': <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, 'SYSTEM': <TokenType.COMMAND: 'COMMAND'>, 'PREWHERE': <TokenType.PREWHERE: 'PREWHERE'>}
SINGLE_TOKENS =
{'(': <TokenType.L_PAREN: 'L_PAREN'>, ')': <TokenType.R_PAREN: 'R_PAREN'>, '[': <TokenType.L_BRACKET: 'L_BRACKET'>, ']': <TokenType.R_BRACKET: 'R_BRACKET'>, '{': <TokenType.L_BRACE: 'L_BRACE'>, '}': <TokenType.R_BRACE: 'R_BRACE'>, '&': <TokenType.AMP: 'AMP'>, '^': <TokenType.CARET: 'CARET'>, ':': <TokenType.COLON: 'COLON'>, ',': <TokenType.COMMA: 'COMMA'>, '.': <TokenType.DOT: 'DOT'>, '-': <TokenType.DASH: 'DASH'>, '=': <TokenType.EQ: 'EQ'>, '>': <TokenType.GT: 'GT'>, '<': <TokenType.LT: 'LT'>, '%': <TokenType.MOD: 'MOD'>, '!': <TokenType.NOT: 'NOT'>, '|': <TokenType.PIPE: 'PIPE'>, '+': <TokenType.PLUS: 'PLUS'>, ';': <TokenType.SEMICOLON: 'SEMICOLON'>, '/': <TokenType.SLASH: 'SLASH'>, '\\': <TokenType.BACKSLASH: 'BACKSLASH'>, '*': <TokenType.STAR: 'STAR'>, '~': <TokenType.TILDA: 'TILDA'>, '?': <TokenType.PLACEHOLDER: 'PLACEHOLDER'>, '@': <TokenType.PARAMETER: 'PARAMETER'>, '#': <TokenType.HASH: 'HASH'>, "'": <TokenType.UNKNOWN: 'UNKNOWN'>, '`': <TokenType.UNKNOWN: 'UNKNOWN'>, '"': <TokenType.UNKNOWN: 'UNKNOWN'>, '$': <TokenType.HEREDOC_STRING: 'HEREDOC_STRING'>}
Inherited Members
115 class Parser(parser.Parser): 116 # Tested in ClickHouse's playground, it seems that the following two queries do the same thing 117 # * select x from t1 union all select x from t2 limit 1; 118 # * select x from t1 union all (select x from t2 limit 1); 119 MODIFIERS_ATTACHED_TO_UNION = False 120 INTERVAL_SPANS = False 121 122 FUNCTIONS = { 123 **parser.Parser.FUNCTIONS, 124 "ANY": exp.AnyValue.from_arg_list, 125 "ARRAYSUM": exp.ArraySum.from_arg_list, 126 "COUNTIF": _build_count_if, 127 "DATE_ADD": lambda args: exp.DateAdd( 128 this=seq_get(args, 2), expression=seq_get(args, 1), unit=seq_get(args, 0) 129 ), 130 "DATEADD": lambda args: exp.DateAdd( 131 this=seq_get(args, 2), expression=seq_get(args, 1), unit=seq_get(args, 0) 132 ), 133 "DATE_DIFF": lambda args: exp.DateDiff( 134 this=seq_get(args, 2), expression=seq_get(args, 1), unit=seq_get(args, 0) 135 ), 136 "DATEDIFF": lambda args: exp.DateDiff( 137 this=seq_get(args, 2), expression=seq_get(args, 1), unit=seq_get(args, 0) 138 ), 139 "DATE_FORMAT": _build_date_format, 140 "FORMATDATETIME": _build_date_format, 141 "JSONEXTRACTSTRING": build_json_extract_path( 142 exp.JSONExtractScalar, zero_based_indexing=False 143 ), 144 "MAP": parser.build_var_map, 145 "MATCH": exp.RegexpLike.from_arg_list, 146 "RANDCANONICAL": exp.Rand.from_arg_list, 147 "TUPLE": exp.Struct.from_arg_list, 148 "UNIQ": exp.ApproxDistinct.from_arg_list, 149 "XOR": lambda args: exp.Xor(expressions=args), 150 } 151 152 AGG_FUNCTIONS = { 153 "count", 154 "min", 155 "max", 156 "sum", 157 "avg", 158 "any", 159 "stddevPop", 160 "stddevSamp", 161 "varPop", 162 "varSamp", 163 "corr", 164 "covarPop", 165 "covarSamp", 166 "entropy", 167 "exponentialMovingAverage", 168 "intervalLengthSum", 169 "kolmogorovSmirnovTest", 170 "mannWhitneyUTest", 171 "median", 172 "rankCorr", 173 "sumKahan", 174 "studentTTest", 175 "welchTTest", 176 "anyHeavy", 177 "anyLast", 178 "boundingRatio", 179 "first_value", 180 "last_value", 181 "argMin", 182 "argMax", 183 "avgWeighted", 184 "topK", 185 "topKWeighted", 186 "deltaSum", 187 "deltaSumTimestamp", 188 "groupArray", 189 "groupArrayLast", 190 "groupUniqArray", 191 "groupArrayInsertAt", 192 "groupArrayMovingAvg", 193 "groupArrayMovingSum", 194 "groupArraySample", 195 "groupBitAnd", 196 "groupBitOr", 197 "groupBitXor", 198 "groupBitmap", 199 "groupBitmapAnd", 200 "groupBitmapOr", 201 "groupBitmapXor", 202 "sumWithOverflow", 203 "sumMap", 204 "minMap", 205 "maxMap", 206 "skewSamp", 207 "skewPop", 208 "kurtSamp", 209 "kurtPop", 210 "uniq", 211 "uniqExact", 212 "uniqCombined", 213 "uniqCombined64", 214 "uniqHLL12", 215 "uniqTheta", 216 "quantile", 217 "quantiles", 218 "quantileExact", 219 "quantilesExact", 220 "quantileExactLow", 221 "quantilesExactLow", 222 "quantileExactHigh", 223 "quantilesExactHigh", 224 "quantileExactWeighted", 225 "quantilesExactWeighted", 226 "quantileTiming", 227 "quantilesTiming", 228 "quantileTimingWeighted", 229 "quantilesTimingWeighted", 230 "quantileDeterministic", 231 "quantilesDeterministic", 232 "quantileTDigest", 233 "quantilesTDigest", 234 "quantileTDigestWeighted", 235 "quantilesTDigestWeighted", 236 "quantileBFloat16", 237 "quantilesBFloat16", 238 "quantileBFloat16Weighted", 239 "quantilesBFloat16Weighted", 240 "simpleLinearRegression", 241 "stochasticLinearRegression", 242 "stochasticLogisticRegression", 243 "categoricalInformationValue", 244 "contingency", 245 "cramersV", 246 "cramersVBiasCorrected", 247 "theilsU", 248 "maxIntersections", 249 "maxIntersectionsPosition", 250 "meanZTest", 251 "quantileInterpolatedWeighted", 252 "quantilesInterpolatedWeighted", 253 "quantileGK", 254 "quantilesGK", 255 "sparkBar", 256 "sumCount", 257 "largestTriangleThreeBuckets", 258 "histogram", 259 "sequenceMatch", 260 "sequenceCount", 261 "windowFunnel", 262 "retention", 263 "uniqUpTo", 264 "sequenceNextNode", 265 "exponentialTimeDecayedAvg", 266 } 267 268 AGG_FUNCTIONS_SUFFIXES = [ 269 "If", 270 "Array", 271 "ArrayIf", 272 "Map", 273 "SimpleState", 274 "State", 275 "Merge", 276 "MergeState", 277 "ForEach", 278 "Distinct", 279 "OrDefault", 280 "OrNull", 281 "Resample", 282 "ArgMin", 283 "ArgMax", 284 ] 285 286 FUNC_TOKENS = { 287 *parser.Parser.FUNC_TOKENS, 288 TokenType.SET, 289 } 290 291 AGG_FUNC_MAPPING = ( 292 lambda functions, suffixes: { 293 f"{f}{sfx}": (f, sfx) for sfx in (suffixes + [""]) for f in functions 294 } 295 )(AGG_FUNCTIONS, AGG_FUNCTIONS_SUFFIXES) 296 297 FUNCTIONS_WITH_ALIASED_ARGS = {*parser.Parser.FUNCTIONS_WITH_ALIASED_ARGS, "TUPLE"} 298 299 FUNCTION_PARSERS = { 300 **parser.Parser.FUNCTION_PARSERS, 301 "ARRAYJOIN": lambda self: self.expression(exp.Explode, this=self._parse_expression()), 302 "QUANTILE": lambda self: self._parse_quantile(), 303 } 304 305 FUNCTION_PARSERS.pop("MATCH") 306 307 NO_PAREN_FUNCTION_PARSERS = parser.Parser.NO_PAREN_FUNCTION_PARSERS.copy() 308 NO_PAREN_FUNCTION_PARSERS.pop("ANY") 309 310 RANGE_PARSERS = { 311 **parser.Parser.RANGE_PARSERS, 312 TokenType.GLOBAL: lambda self, this: self._match(TokenType.IN) 313 and self._parse_in(this, is_global=True), 314 } 315 316 # The PLACEHOLDER entry is popped because 1) it doesn't affect Clickhouse (it corresponds to 317 # the postgres-specific JSONBContains parser) and 2) it makes parsing the ternary op simpler. 318 COLUMN_OPERATORS = parser.Parser.COLUMN_OPERATORS.copy() 319 COLUMN_OPERATORS.pop(TokenType.PLACEHOLDER) 320 321 JOIN_KINDS = { 322 *parser.Parser.JOIN_KINDS, 323 TokenType.ANY, 324 TokenType.ASOF, 325 TokenType.ARRAY, 326 } 327 328 TABLE_ALIAS_TOKENS = parser.Parser.TABLE_ALIAS_TOKENS - { 329 TokenType.ANY, 330 TokenType.ARRAY, 331 TokenType.FINAL, 332 TokenType.FORMAT, 333 TokenType.SETTINGS, 334 } 335 336 ALIAS_TOKENS = parser.Parser.ALIAS_TOKENS - { 337 TokenType.FORMAT, 338 } 339 340 LOG_DEFAULTS_TO_LN = True 341 342 QUERY_MODIFIER_PARSERS = { 343 **parser.Parser.QUERY_MODIFIER_PARSERS, 344 TokenType.SETTINGS: lambda self: ( 345 "settings", 346 self._advance() or self._parse_csv(self._parse_conjunction), 347 ), 348 TokenType.FORMAT: lambda self: ("format", self._advance() or self._parse_id_var()), 349 } 350 351 CONSTRAINT_PARSERS = { 352 **parser.Parser.CONSTRAINT_PARSERS, 353 "INDEX": lambda self: self._parse_index_constraint(), 354 "CODEC": lambda self: self._parse_compress(), 355 } 356 357 ALTER_PARSERS = { 358 **parser.Parser.ALTER_PARSERS, 359 "REPLACE": lambda self: self._parse_alter_table_replace(), 360 } 361 362 SCHEMA_UNNAMED_CONSTRAINTS = { 363 *parser.Parser.SCHEMA_UNNAMED_CONSTRAINTS, 364 "INDEX", 365 } 366 367 def _parse_conjunction(self) -> t.Optional[exp.Expression]: 368 this = super()._parse_conjunction() 369 370 if self._match(TokenType.PLACEHOLDER): 371 return self.expression( 372 exp.If, 373 this=this, 374 true=self._parse_conjunction(), 375 false=self._match(TokenType.COLON) and self._parse_conjunction(), 376 ) 377 378 return this 379 380 def _parse_placeholder(self) -> t.Optional[exp.Expression]: 381 """ 382 Parse a placeholder expression like SELECT {abc: UInt32} or FROM {table: Identifier} 383 https://clickhouse.com/docs/en/sql-reference/syntax#defining-and-using-query-parameters 384 """ 385 if not self._match(TokenType.L_BRACE): 386 return None 387 388 this = self._parse_id_var() 389 self._match(TokenType.COLON) 390 kind = self._parse_types(check_func=False, allow_identifiers=False) or ( 391 self._match_text_seq("IDENTIFIER") and "Identifier" 392 ) 393 394 if not kind: 395 self.raise_error("Expecting a placeholder type or 'Identifier' for tables") 396 elif not self._match(TokenType.R_BRACE): 397 self.raise_error("Expecting }") 398 399 return self.expression(exp.Placeholder, this=this, kind=kind) 400 401 def _parse_in(self, this: t.Optional[exp.Expression], is_global: bool = False) -> exp.In: 402 this = super()._parse_in(this) 403 this.set("is_global", is_global) 404 return this 405 406 def _parse_table( 407 self, 408 schema: bool = False, 409 joins: bool = False, 410 alias_tokens: t.Optional[t.Collection[TokenType]] = None, 411 parse_bracket: bool = False, 412 is_db_reference: bool = False, 413 parse_partition: bool = False, 414 ) -> t.Optional[exp.Expression]: 415 this = super()._parse_table( 416 schema=schema, 417 joins=joins, 418 alias_tokens=alias_tokens, 419 parse_bracket=parse_bracket, 420 is_db_reference=is_db_reference, 421 ) 422 423 if self._match(TokenType.FINAL): 424 this = self.expression(exp.Final, this=this) 425 426 return this 427 428 def _parse_position(self, haystack_first: bool = False) -> exp.StrPosition: 429 return super()._parse_position(haystack_first=True) 430 431 # https://clickhouse.com/docs/en/sql-reference/statements/select/with/ 432 def _parse_cte(self) -> exp.CTE: 433 # WITH <identifier> AS <subquery expression> 434 cte: t.Optional[exp.CTE] = self._try_parse(super()._parse_cte) 435 436 if not cte: 437 # WITH <expression> AS <identifier> 438 cte = self.expression( 439 exp.CTE, 440 this=self._parse_conjunction(), 441 alias=self._parse_table_alias(), 442 scalar=True, 443 ) 444 445 return cte 446 447 def _parse_join_parts( 448 self, 449 ) -> t.Tuple[t.Optional[Token], t.Optional[Token], t.Optional[Token]]: 450 is_global = self._match(TokenType.GLOBAL) and self._prev 451 kind_pre = self._match_set(self.JOIN_KINDS, advance=False) and self._prev 452 453 if kind_pre: 454 kind = self._match_set(self.JOIN_KINDS) and self._prev 455 side = self._match_set(self.JOIN_SIDES) and self._prev 456 return is_global, side, kind 457 458 return ( 459 is_global, 460 self._match_set(self.JOIN_SIDES) and self._prev, 461 self._match_set(self.JOIN_KINDS) and self._prev, 462 ) 463 464 def _parse_join( 465 self, skip_join_token: bool = False, parse_bracket: bool = False 466 ) -> t.Optional[exp.Join]: 467 join = super()._parse_join(skip_join_token=skip_join_token, parse_bracket=True) 468 if join: 469 join.set("global", join.args.pop("method", None)) 470 471 return join 472 473 def _parse_function( 474 self, 475 functions: t.Optional[t.Dict[str, t.Callable]] = None, 476 anonymous: bool = False, 477 optional_parens: bool = True, 478 any_token: bool = False, 479 ) -> t.Optional[exp.Expression]: 480 expr = super()._parse_function( 481 functions=functions, 482 anonymous=anonymous, 483 optional_parens=optional_parens, 484 any_token=any_token, 485 ) 486 487 func = expr.this if isinstance(expr, exp.Window) else expr 488 489 # Aggregate functions can be split in 2 parts: <func_name><suffix> 490 parts = ( 491 self.AGG_FUNC_MAPPING.get(func.this) if isinstance(func, exp.Anonymous) else None 492 ) 493 494 if parts: 495 params = self._parse_func_params(func) 496 497 kwargs = { 498 "this": func.this, 499 "expressions": func.expressions, 500 } 501 if parts[1]: 502 kwargs["parts"] = parts 503 exp_class = exp.CombinedParameterizedAgg if params else exp.CombinedAggFunc 504 else: 505 exp_class = exp.ParameterizedAgg if params else exp.AnonymousAggFunc 506 507 kwargs["exp_class"] = exp_class 508 if params: 509 kwargs["params"] = params 510 511 func = self.expression(**kwargs) 512 513 if isinstance(expr, exp.Window): 514 # The window's func was parsed as Anonymous in base parser, fix its 515 # type to be CH style CombinedAnonymousAggFunc / AnonymousAggFunc 516 expr.set("this", func) 517 elif params: 518 # Params have blocked super()._parse_function() from parsing the following window 519 # (if that exists) as they're standing between the function call and the window spec 520 expr = self._parse_window(func) 521 else: 522 expr = func 523 524 return expr 525 526 def _parse_func_params( 527 self, this: t.Optional[exp.Func] = None 528 ) -> t.Optional[t.List[exp.Expression]]: 529 if self._match_pair(TokenType.R_PAREN, TokenType.L_PAREN): 530 return self._parse_csv(self._parse_lambda) 531 532 if self._match(TokenType.L_PAREN): 533 params = self._parse_csv(self._parse_lambda) 534 self._match_r_paren(this) 535 return params 536 537 return None 538 539 def _parse_quantile(self) -> exp.Quantile: 540 this = self._parse_lambda() 541 params = self._parse_func_params() 542 if params: 543 return self.expression(exp.Quantile, this=params[0], quantile=this) 544 return self.expression(exp.Quantile, this=this, quantile=exp.Literal.number(0.5)) 545 546 def _parse_wrapped_id_vars(self, optional: bool = False) -> t.List[exp.Expression]: 547 return super()._parse_wrapped_id_vars(optional=True) 548 549 def _parse_primary_key( 550 self, wrapped_optional: bool = False, in_props: bool = False 551 ) -> exp.PrimaryKeyColumnConstraint | exp.PrimaryKey: 552 return super()._parse_primary_key( 553 wrapped_optional=wrapped_optional or in_props, in_props=in_props 554 ) 555 556 def _parse_on_property(self) -> t.Optional[exp.Expression]: 557 index = self._index 558 if self._match_text_seq("CLUSTER"): 559 this = self._parse_id_var() 560 if this: 561 return self.expression(exp.OnCluster, this=this) 562 else: 563 self._retreat(index) 564 return None 565 566 def _parse_index_constraint( 567 self, kind: t.Optional[str] = None 568 ) -> exp.IndexColumnConstraint: 569 # INDEX name1 expr TYPE type1(args) GRANULARITY value 570 this = self._parse_id_var() 571 expression = self._parse_conjunction() 572 573 index_type = self._match_text_seq("TYPE") and ( 574 self._parse_function() or self._parse_var() 575 ) 576 577 granularity = self._match_text_seq("GRANULARITY") and self._parse_term() 578 579 return self.expression( 580 exp.IndexColumnConstraint, 581 this=this, 582 expression=expression, 583 index_type=index_type, 584 granularity=granularity, 585 ) 586 587 def _parse_partition(self) -> t.Optional[exp.Partition]: 588 # https://clickhouse.com/docs/en/sql-reference/statements/alter/partition#how-to-set-partition-expression 589 if not self._match(TokenType.PARTITION): 590 return None 591 592 if self._match_text_seq("ID"): 593 # Corresponds to the PARTITION ID <string_value> syntax 594 expressions: t.List[exp.Expression] = [ 595 self.expression(exp.PartitionId, this=self._parse_string()) 596 ] 597 else: 598 expressions = self._parse_expressions() 599 600 return self.expression(exp.Partition, expressions=expressions) 601 602 def _parse_alter_table_replace(self) -> t.Optional[exp.Expression]: 603 partition = self._parse_partition() 604 605 if not partition or not self._match(TokenType.FROM): 606 return None 607 608 return self.expression( 609 exp.ReplacePartition, expression=partition, source=self._parse_table_parts() 610 )
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'>>, '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'>>, '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': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Array'>>, 'ARRAY_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayAgg'>>, '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_CONTAINS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayContains'>>, '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_OVERLAPS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayOverlaps'>>, '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_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'>>, 'AVG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Avg'>>, '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': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Chr'>>, 'CHAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Chr'>>, 'COALESCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Coalesce'>>, 'IFNULL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Coalesce'>>, 'NVL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Coalesce'>>, 'COLLATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Collate'>>, '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'>>, 'CONVERT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Convert'>>, 'CORR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Corr'>>, 'COUNT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Count'>>, 'COUNT_IF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CountIf'>>, 'COUNTIF': <function _build_count_if>, '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_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_USER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentUser'>>, 'DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Date'>>, 'DATE_ADD': <function ClickHouse.Parser.<lambda>>, 'DATEDIFF': <function ClickHouse.Parser.<lambda>>, 'DATE_DIFF': <function ClickHouse.Parser.<lambda>>, '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': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateSub'>>, 'DATE_TO_DATE_STR': <function Parser.<lambda>>, 'DATE_TO_DI': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateToDi'>>, 'DATE_TRUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateTrunc'>>, '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': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Day'>>, 'DAY_OF_MONTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfMonth'>>, 'DAYOFMONTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfMonth'>>, 'DAY_OF_WEEK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfWeek'>>, 'DAYOFWEEK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfWeek'>>, 'DAY_OF_YEAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfYear'>>, 'DAYOFYEAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfYear'>>, 'DECODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Decode'>>, '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'>>, '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'>>, 'EXTRACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Extract'>>, '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'>>, 'GENERATE_DATE_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GenerateDateArray'>>, 'GENERATE_SERIES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GenerateSeries'>>, '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': <bound method Func.from_arg_list of <class 'sqlglot.expressions.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'>>, '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_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'>>, 'JSON_EXTRACT': <function build_extract_json_with_path.<locals>._builder>, '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'>>, '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': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Length'>>, 'LEN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Length'>>, 'LEVENSHTEIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Levenshtein'>>, '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': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Lower'>>, 'LCASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Lower'>>, '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'>>, 'MAP': <function build_var_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'>>, 'MIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Min'>>, 'MONTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Month'>>, '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'>>, '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'>>, 'OPEN_J_S_O_N': <bound method Func.from_arg_list of <class 'sqlglot.expressions.OpenJSON'>>, '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_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'>>, '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'>>, 'SPLIT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Split'>>, 'SQRT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sqrt'>>, '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'>>, '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': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrToDate'>>, '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'>>, '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'>>, 'SUM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sum'>>, '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': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampDiff'>>, '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': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToDays'>>, '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_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'>>, 'UNHEX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Unhex'>>, 'UNIX_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixDate'>>, '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'>>, 'UPPER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Upper'>>, 'UCASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Upper'>>, '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': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Week'>>, 'WEEK_OF_YEAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.WeekOfYear'>>, 'WEEKOFYEAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.WeekOfYear'>>, 'WHEN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.When'>>, 'X_M_L_TABLE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.XMLTable'>>, 'XOR': <function ClickHouse.Parser.<lambda>>, 'YEAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Year'>>, '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>>, 'MOD': <function build_mod>, 'ANY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.AnyValue'>>, 'ARRAYSUM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySum'>>, 'DATEADD': <function ClickHouse.Parser.<lambda>>, 'DATE_FORMAT': <function _build_date_format>, 'FORMATDATETIME': <function _build_date_format>, 'JSONEXTRACTSTRING': <function build_json_extract_path.<locals>._builder>, 'MATCH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpLike'>>, 'RANDCANONICAL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Rand'>>, 'TUPLE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Struct'>>, 'UNIQ': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxDistinct'>>}
AGG_FUNCTIONS =
{'exponentialMovingAverage', 'quantiles', 'cramersV', 'quantilesTimingWeighted', 'sumWithOverflow', 'retention', 'rankCorr', 'quantilesExactWeighted', 'groupBitmapXor', 'skewSamp', 'covarPop', 'groupArrayMovingSum', 'uniqCombined', 'sumCount', 'groupBitmap', 'cramersVBiasCorrected', 'uniqTheta', 'quantileExactWeighted', 'groupArrayMovingAvg', 'quantileGK', 'quantilesExactLow', 'sequenceNextNode', 'simpleLinearRegression', 'quantileBFloat16Weighted', 'avg', 'kurtSamp', 'avgWeighted', 'max', 'histogram', 'quantilesBFloat16', 'varSamp', 'sequenceCount', 'any', 'categoricalInformationValue', 'topKWeighted', 'groupArrayLast', 'corr', 'sumKahan', 'boundingRatio', 'meanZTest', 'quantilesGK', 'groupBitmapOr', 'first_value', 'argMax', 'groupArraySample', 'anyHeavy', 'quantilesTDigest', 'deltaSumTimestamp', 'quantileExactHigh', 'topK', 'theilsU', 'quantileInterpolatedWeighted', 'uniqCombined64', 'studentTTest', 'quantilesTDigestWeighted', 'sequenceMatch', 'mannWhitneyUTest', 'uniqExact', 'last_value', 'quantilesInterpolatedWeighted', 'kurtPop', 'argMin', 'exponentialTimeDecayedAvg', 'covarSamp', 'groupBitXor', 'groupBitOr', 'maxIntersections', 'quantileExactLow', 'quantilesBFloat16Weighted', 'groupBitAnd', 'quantilesExactHigh', 'quantileTDigestWeighted', 'count', 'groupUniqArray', 'min', 'sparkBar', 'windowFunnel', 'stochasticLogisticRegression', 'kolmogorovSmirnovTest', 'maxIntersectionsPosition', 'quantileBFloat16', 'quantilesTiming', 'quantileTiming', 'groupArrayInsertAt', 'welchTTest', 'sumMap', 'quantilesDeterministic', 'sum', 'uniqUpTo', 'stochasticLinearRegression', 'contingency', 'minMap', 'largestTriangleThreeBuckets', 'anyLast', 'quantileTimingWeighted', 'skewPop', 'uniqHLL12', 'quantilesExact', 'quantileTDigest', 'deltaSum', 'entropy', 'groupBitmapAnd', 'maxMap', 'quantile', 'groupArray', 'stddevSamp', 'uniq', 'intervalLengthSum', 'median', 'varPop', 'quantileExact', 'quantileDeterministic', 'stddevPop'}
AGG_FUNCTIONS_SUFFIXES =
['If', 'Array', 'ArrayIf', 'Map', 'SimpleState', 'State', 'Merge', 'MergeState', 'ForEach', 'Distinct', 'OrDefault', 'OrNull', 'Resample', 'ArgMin', 'ArgMax']
FUNC_TOKENS =
{<TokenType.WINDOW: 'WINDOW'>, <TokenType.UINT256: 'UINT256'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.DATE32: 'DATE32'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.BIT: 'BIT'>, <TokenType.MERGE: 'MERGE'>, <TokenType.TEXT: 'TEXT'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.GLOB: 'GLOB'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.NAME: 'NAME'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.ALL: 'ALL'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.RANGE: 'RANGE'>, <TokenType.BINARY: 'BINARY'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.XML: 'XML'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.XOR: 'XOR'>, <TokenType.IPV4: 'IPV4'>, <TokenType.LIKE: 'LIKE'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.IPV6: 'IPV6'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.INT: 'INT'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.UNIQUEIDENTIFIER: 'UNIQUEIDENTIFIER'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.SOME: 'SOME'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.JSON: 'JSON'>, <TokenType.ANY: 'ANY'>, <TokenType.SUPER: 'SUPER'>, <TokenType.TIME: 'TIME'>, <TokenType.INT256: 'INT256'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.INSERT: 'INSERT'>, <TokenType.YEAR: 'YEAR'>, <TokenType.JSONB: 'JSONB'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.RLIKE: 'RLIKE'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.ILIKE: 'ILIKE'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.MONEY: 'MONEY'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.DATE: 'DATE'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.RIGHT: 'RIGHT'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.PRIMARY_KEY: 'PRIMARY_KEY'>, <TokenType.UUID: 'UUID'>, <TokenType.SET: 'SET'>, <TokenType.FIRST: 'FIRST'>, <TokenType.INDEX: 'INDEX'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.NESTED: 'NESTED'>, <TokenType.FILTER: 'FILTER'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.INT128: 'INT128'>, <TokenType.INET: 'INET'>, <TokenType.LEFT: 'LEFT'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.UINT128: 'UINT128'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.ENUM: 'ENUM'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.MAP: 'MAP'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.FORMAT: 'FORMAT'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.UINT: 'UINT'>, <TokenType.ROW: 'ROW'>, <TokenType.TABLE: 'TABLE'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.NULL: 'NULL'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.CHAR: 'CHAR'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.VAR: 'VAR'>}
AGG_FUNC_MAPPING =
{'exponentialMovingAverageIf': ('exponentialMovingAverage', 'If'), 'quantilesIf': ('quantiles', 'If'), 'cramersVIf': ('cramersV', 'If'), 'quantilesTimingWeightedIf': ('quantilesTimingWeighted', 'If'), 'sumWithOverflowIf': ('sumWithOverflow', 'If'), 'retentionIf': ('retention', 'If'), 'rankCorrIf': ('rankCorr', 'If'), 'quantilesExactWeightedIf': ('quantilesExactWeighted', 'If'), 'groupBitmapXorIf': ('groupBitmapXor', 'If'), 'skewSampIf': ('skewSamp', 'If'), 'covarPopIf': ('covarPop', 'If'), 'groupArrayMovingSumIf': ('groupArrayMovingSum', 'If'), 'uniqCombinedIf': ('uniqCombined', 'If'), 'sumCountIf': ('sumCount', 'If'), 'groupBitmapIf': ('groupBitmap', 'If'), 'cramersVBiasCorrectedIf': ('cramersVBiasCorrected', 'If'), 'uniqThetaIf': ('uniqTheta', 'If'), 'quantileExactWeightedIf': ('quantileExactWeighted', 'If'), 'groupArrayMovingAvgIf': ('groupArrayMovingAvg', 'If'), 'quantileGKIf': ('quantileGK', 'If'), 'quantilesExactLowIf': ('quantilesExactLow', 'If'), 'sequenceNextNodeIf': ('sequenceNextNode', 'If'), 'simpleLinearRegressionIf': ('simpleLinearRegression', 'If'), 'quantileBFloat16WeightedIf': ('quantileBFloat16Weighted', 'If'), 'avgIf': ('avg', 'If'), 'kurtSampIf': ('kurtSamp', 'If'), 'avgWeightedIf': ('avgWeighted', 'If'), 'maxIf': ('max', 'If'), 'histogramIf': ('histogram', 'If'), 'quantilesBFloat16If': ('quantilesBFloat16', 'If'), 'varSampIf': ('varSamp', 'If'), 'sequenceCountIf': ('sequenceCount', 'If'), 'anyIf': ('any', 'If'), 'categoricalInformationValueIf': ('categoricalInformationValue', 'If'), 'topKWeightedIf': ('topKWeighted', 'If'), 'groupArrayLastIf': ('groupArrayLast', 'If'), 'corrIf': ('corr', 'If'), 'sumKahanIf': ('sumKahan', 'If'), 'boundingRatioIf': ('boundingRatio', 'If'), 'meanZTestIf': ('meanZTest', 'If'), 'quantilesGKIf': ('quantilesGK', 'If'), 'groupBitmapOrIf': ('groupBitmapOr', 'If'), 'first_valueIf': ('first_value', 'If'), 'argMaxIf': ('argMax', 'If'), 'groupArraySampleIf': ('groupArraySample', 'If'), 'anyHeavyIf': ('anyHeavy', 'If'), 'quantilesTDigestIf': ('quantilesTDigest', 'If'), 'deltaSumTimestampIf': ('deltaSumTimestamp', 'If'), 'quantileExactHighIf': ('quantileExactHigh', 'If'), 'topKIf': ('topK', 'If'), 'theilsUIf': ('theilsU', 'If'), 'quantileInterpolatedWeightedIf': ('quantileInterpolatedWeighted', 'If'), 'uniqCombined64If': ('uniqCombined64', 'If'), 'studentTTestIf': ('studentTTest', 'If'), 'quantilesTDigestWeightedIf': ('quantilesTDigestWeighted', 'If'), 'sequenceMatchIf': ('sequenceMatch', 'If'), 'mannWhitneyUTestIf': ('mannWhitneyUTest', 'If'), 'uniqExactIf': ('uniqExact', 'If'), 'last_valueIf': ('last_value', 'If'), 'quantilesInterpolatedWeightedIf': ('quantilesInterpolatedWeighted', 'If'), 'kurtPopIf': ('kurtPop', 'If'), 'argMinIf': ('argMin', 'If'), 'exponentialTimeDecayedAvgIf': ('exponentialTimeDecayedAvg', 'If'), 'covarSampIf': ('covarSamp', 'If'), 'groupBitXorIf': ('groupBitXor', 'If'), 'groupBitOrIf': ('groupBitOr', 'If'), 'maxIntersectionsIf': ('maxIntersections', 'If'), 'quantileExactLowIf': ('quantileExactLow', 'If'), 'quantilesBFloat16WeightedIf': ('quantilesBFloat16Weighted', 'If'), 'groupBitAndIf': ('groupBitAnd', 'If'), 'quantilesExactHighIf': ('quantilesExactHigh', 'If'), 'quantileTDigestWeightedIf': ('quantileTDigestWeighted', 'If'), 'countIf': ('count', 'If'), 'groupUniqArrayIf': ('groupUniqArray', 'If'), 'minIf': ('min', 'If'), 'sparkBarIf': ('sparkBar', 'If'), 'windowFunnelIf': ('windowFunnel', 'If'), 'stochasticLogisticRegressionIf': ('stochasticLogisticRegression', 'If'), 'kolmogorovSmirnovTestIf': ('kolmogorovSmirnovTest', 'If'), 'maxIntersectionsPositionIf': ('maxIntersectionsPosition', 'If'), 'quantileBFloat16If': ('quantileBFloat16', 'If'), 'quantilesTimingIf': ('quantilesTiming', 'If'), 'quantileTimingIf': ('quantileTiming', 'If'), 'groupArrayInsertAtIf': ('groupArrayInsertAt', 'If'), 'welchTTestIf': ('welchTTest', 'If'), 'sumMapIf': ('sumMap', 'If'), 'quantilesDeterministicIf': ('quantilesDeterministic', 'If'), 'sumIf': ('sum', 'If'), 'uniqUpToIf': ('uniqUpTo', 'If'), 'stochasticLinearRegressionIf': ('stochasticLinearRegression', 'If'), 'contingencyIf': ('contingency', 'If'), 'minMapIf': ('minMap', 'If'), 'largestTriangleThreeBucketsIf': ('largestTriangleThreeBuckets', 'If'), 'anyLastIf': ('anyLast', 'If'), 'quantileTimingWeightedIf': ('quantileTimingWeighted', 'If'), 'skewPopIf': ('skewPop', 'If'), 'uniqHLL12If': ('uniqHLL12', 'If'), 'quantilesExactIf': ('quantilesExact', 'If'), 'quantileTDigestIf': ('quantileTDigest', 'If'), 'deltaSumIf': ('deltaSum', 'If'), 'entropyIf': ('entropy', 'If'), 'groupBitmapAndIf': ('groupBitmapAnd', 'If'), 'maxMapIf': ('maxMap', 'If'), 'quantileIf': ('quantile', 'If'), 'groupArrayIf': ('groupArray', 'If'), 'stddevSampIf': ('stddevSamp', 'If'), 'uniqIf': ('uniq', 'If'), 'intervalLengthSumIf': ('intervalLengthSum', 'If'), 'medianIf': ('median', 'If'), 'varPopIf': ('varPop', 'If'), 'quantileExactIf': ('quantileExact', 'If'), 'quantileDeterministicIf': ('quantileDeterministic', 'If'), 'stddevPopIf': ('stddevPop', 'If'), 'exponentialMovingAverageArray': ('exponentialMovingAverage', 'Array'), 'quantilesArray': ('quantiles', 'Array'), 'cramersVArray': ('cramersV', 'Array'), 'quantilesTimingWeightedArray': ('quantilesTimingWeighted', 'Array'), 'sumWithOverflowArray': ('sumWithOverflow', 'Array'), 'retentionArray': ('retention', 'Array'), 'rankCorrArray': ('rankCorr', 'Array'), 'quantilesExactWeightedArray': ('quantilesExactWeighted', 'Array'), 'groupBitmapXorArray': ('groupBitmapXor', 'Array'), 'skewSampArray': ('skewSamp', 'Array'), 'covarPopArray': ('covarPop', 'Array'), 'groupArrayMovingSumArray': ('groupArrayMovingSum', 'Array'), 'uniqCombinedArray': ('uniqCombined', 'Array'), 'sumCountArray': ('sumCount', 'Array'), 'groupBitmapArray': ('groupBitmap', 'Array'), 'cramersVBiasCorrectedArray': ('cramersVBiasCorrected', 'Array'), 'uniqThetaArray': ('uniqTheta', 'Array'), 'quantileExactWeightedArray': ('quantileExactWeighted', 'Array'), 'groupArrayMovingAvgArray': ('groupArrayMovingAvg', 'Array'), 'quantileGKArray': ('quantileGK', 'Array'), 'quantilesExactLowArray': ('quantilesExactLow', 'Array'), 'sequenceNextNodeArray': ('sequenceNextNode', 'Array'), 'simpleLinearRegressionArray': ('simpleLinearRegression', 'Array'), 'quantileBFloat16WeightedArray': ('quantileBFloat16Weighted', 'Array'), 'avgArray': ('avg', 'Array'), 'kurtSampArray': ('kurtSamp', 'Array'), 'avgWeightedArray': ('avgWeighted', 'Array'), 'maxArray': ('max', 'Array'), 'histogramArray': ('histogram', 'Array'), 'quantilesBFloat16Array': ('quantilesBFloat16', 'Array'), 'varSampArray': ('varSamp', 'Array'), 'sequenceCountArray': ('sequenceCount', 'Array'), 'anyArray': ('any', 'Array'), 'categoricalInformationValueArray': ('categoricalInformationValue', 'Array'), 'topKWeightedArray': ('topKWeighted', 'Array'), 'groupArrayLastArray': ('groupArrayLast', 'Array'), 'corrArray': ('corr', 'Array'), 'sumKahanArray': ('sumKahan', 'Array'), 'boundingRatioArray': ('boundingRatio', 'Array'), 'meanZTestArray': ('meanZTest', 'Array'), 'quantilesGKArray': ('quantilesGK', 'Array'), 'groupBitmapOrArray': ('groupBitmapOr', 'Array'), 'first_valueArray': ('first_value', 'Array'), 'argMaxArray': ('argMax', 'Array'), 'groupArraySampleArray': ('groupArraySample', 'Array'), 'anyHeavyArray': ('anyHeavy', 'Array'), 'quantilesTDigestArray': ('quantilesTDigest', 'Array'), 'deltaSumTimestampArray': ('deltaSumTimestamp', 'Array'), 'quantileExactHighArray': ('quantileExactHigh', 'Array'), 'topKArray': ('topK', 'Array'), 'theilsUArray': ('theilsU', 'Array'), 'quantileInterpolatedWeightedArray': ('quantileInterpolatedWeighted', 'Array'), 'uniqCombined64Array': ('uniqCombined64', 'Array'), 'studentTTestArray': ('studentTTest', 'Array'), 'quantilesTDigestWeightedArray': ('quantilesTDigestWeighted', 'Array'), 'sequenceMatchArray': ('sequenceMatch', 'Array'), 'mannWhitneyUTestArray': ('mannWhitneyUTest', 'Array'), 'uniqExactArray': ('uniqExact', 'Array'), 'last_valueArray': ('last_value', 'Array'), 'quantilesInterpolatedWeightedArray': ('quantilesInterpolatedWeighted', 'Array'), 'kurtPopArray': ('kurtPop', 'Array'), 'argMinArray': ('argMin', 'Array'), 'exponentialTimeDecayedAvgArray': ('exponentialTimeDecayedAvg', 'Array'), 'covarSampArray': ('covarSamp', 'Array'), 'groupBitXorArray': ('groupBitXor', 'Array'), 'groupBitOrArray': ('groupBitOr', 'Array'), 'maxIntersectionsArray': ('maxIntersections', 'Array'), 'quantileExactLowArray': ('quantileExactLow', 'Array'), 'quantilesBFloat16WeightedArray': ('quantilesBFloat16Weighted', 'Array'), 'groupBitAndArray': ('groupBitAnd', 'Array'), 'quantilesExactHighArray': ('quantilesExactHigh', 'Array'), 'quantileTDigestWeightedArray': ('quantileTDigestWeighted', 'Array'), 'countArray': ('count', 'Array'), 'groupUniqArrayArray': ('groupUniqArray', 'Array'), 'minArray': ('min', 'Array'), 'sparkBarArray': ('sparkBar', 'Array'), 'windowFunnelArray': ('windowFunnel', 'Array'), 'stochasticLogisticRegressionArray': ('stochasticLogisticRegression', 'Array'), 'kolmogorovSmirnovTestArray': ('kolmogorovSmirnovTest', 'Array'), 'maxIntersectionsPositionArray': ('maxIntersectionsPosition', 'Array'), 'quantileBFloat16Array': ('quantileBFloat16', 'Array'), 'quantilesTimingArray': ('quantilesTiming', 'Array'), 'quantileTimingArray': ('quantileTiming', 'Array'), 'groupArrayInsertAtArray': ('groupArrayInsertAt', 'Array'), 'welchTTestArray': ('welchTTest', 'Array'), 'sumMapArray': ('sumMap', 'Array'), 'quantilesDeterministicArray': ('quantilesDeterministic', 'Array'), 'sumArray': ('sum', 'Array'), 'uniqUpToArray': ('uniqUpTo', 'Array'), 'stochasticLinearRegressionArray': ('stochasticLinearRegression', 'Array'), 'contingencyArray': ('contingency', 'Array'), 'minMapArray': ('minMap', 'Array'), 'largestTriangleThreeBucketsArray': ('largestTriangleThreeBuckets', 'Array'), 'anyLastArray': ('anyLast', 'Array'), 'quantileTimingWeightedArray': ('quantileTimingWeighted', 'Array'), 'skewPopArray': ('skewPop', 'Array'), 'uniqHLL12Array': ('uniqHLL12', 'Array'), 'quantilesExactArray': ('quantilesExact', 'Array'), 'quantileTDigestArray': ('quantileTDigest', 'Array'), 'deltaSumArray': ('deltaSum', 'Array'), 'entropyArray': ('entropy', 'Array'), 'groupBitmapAndArray': ('groupBitmapAnd', 'Array'), 'maxMapArray': ('maxMap', 'Array'), 'quantileArray': ('quantile', 'Array'), 'groupArrayArray': ('groupArray', 'Array'), 'stddevSampArray': ('stddevSamp', 'Array'), 'uniqArray': ('uniq', 'Array'), 'intervalLengthSumArray': ('intervalLengthSum', 'Array'), 'medianArray': ('median', 'Array'), 'varPopArray': ('varPop', 'Array'), 'quantileExactArray': ('quantileExact', 'Array'), 'quantileDeterministicArray': ('quantileDeterministic', 'Array'), 'stddevPopArray': ('stddevPop', 'Array'), 'exponentialMovingAverageArrayIf': ('exponentialMovingAverage', 'ArrayIf'), 'quantilesArrayIf': ('quantiles', 'ArrayIf'), 'cramersVArrayIf': ('cramersV', 'ArrayIf'), 'quantilesTimingWeightedArrayIf': ('quantilesTimingWeighted', 'ArrayIf'), 'sumWithOverflowArrayIf': ('sumWithOverflow', 'ArrayIf'), 'retentionArrayIf': ('retention', 'ArrayIf'), 'rankCorrArrayIf': ('rankCorr', 'ArrayIf'), 'quantilesExactWeightedArrayIf': ('quantilesExactWeighted', 'ArrayIf'), 'groupBitmapXorArrayIf': ('groupBitmapXor', 'ArrayIf'), 'skewSampArrayIf': ('skewSamp', 'ArrayIf'), 'covarPopArrayIf': ('covarPop', 'ArrayIf'), 'groupArrayMovingSumArrayIf': ('groupArrayMovingSum', 'ArrayIf'), 'uniqCombinedArrayIf': ('uniqCombined', 'ArrayIf'), 'sumCountArrayIf': ('sumCount', 'ArrayIf'), 'groupBitmapArrayIf': ('groupBitmap', 'ArrayIf'), 'cramersVBiasCorrectedArrayIf': ('cramersVBiasCorrected', 'ArrayIf'), 'uniqThetaArrayIf': ('uniqTheta', 'ArrayIf'), 'quantileExactWeightedArrayIf': ('quantileExactWeighted', 'ArrayIf'), 'groupArrayMovingAvgArrayIf': ('groupArrayMovingAvg', 'ArrayIf'), 'quantileGKArrayIf': ('quantileGK', 'ArrayIf'), 'quantilesExactLowArrayIf': ('quantilesExactLow', 'ArrayIf'), 'sequenceNextNodeArrayIf': ('sequenceNextNode', 'ArrayIf'), 'simpleLinearRegressionArrayIf': ('simpleLinearRegression', 'ArrayIf'), 'quantileBFloat16WeightedArrayIf': ('quantileBFloat16Weighted', 'ArrayIf'), 'avgArrayIf': ('avg', 'ArrayIf'), 'kurtSampArrayIf': ('kurtSamp', 'ArrayIf'), 'avgWeightedArrayIf': ('avgWeighted', 'ArrayIf'), 'maxArrayIf': ('max', 'ArrayIf'), 'histogramArrayIf': ('histogram', 'ArrayIf'), 'quantilesBFloat16ArrayIf': ('quantilesBFloat16', 'ArrayIf'), 'varSampArrayIf': ('varSamp', 'ArrayIf'), 'sequenceCountArrayIf': ('sequenceCount', 'ArrayIf'), 'anyArrayIf': ('any', 'ArrayIf'), 'categoricalInformationValueArrayIf': ('categoricalInformationValue', 'ArrayIf'), 'topKWeightedArrayIf': ('topKWeighted', 'ArrayIf'), 'groupArrayLastArrayIf': ('groupArrayLast', 'ArrayIf'), 'corrArrayIf': ('corr', 'ArrayIf'), 'sumKahanArrayIf': ('sumKahan', 'ArrayIf'), 'boundingRatioArrayIf': ('boundingRatio', 'ArrayIf'), 'meanZTestArrayIf': ('meanZTest', 'ArrayIf'), 'quantilesGKArrayIf': ('quantilesGK', 'ArrayIf'), 'groupBitmapOrArrayIf': ('groupBitmapOr', 'ArrayIf'), 'first_valueArrayIf': ('first_value', 'ArrayIf'), 'argMaxArrayIf': ('argMax', 'ArrayIf'), 'groupArraySampleArrayIf': ('groupArraySample', 'ArrayIf'), 'anyHeavyArrayIf': ('anyHeavy', 'ArrayIf'), 'quantilesTDigestArrayIf': ('quantilesTDigest', 'ArrayIf'), 'deltaSumTimestampArrayIf': ('deltaSumTimestamp', 'ArrayIf'), 'quantileExactHighArrayIf': ('quantileExactHigh', 'ArrayIf'), 'topKArrayIf': ('topK', 'ArrayIf'), 'theilsUArrayIf': ('theilsU', 'ArrayIf'), 'quantileInterpolatedWeightedArrayIf': ('quantileInterpolatedWeighted', 'ArrayIf'), 'uniqCombined64ArrayIf': ('uniqCombined64', 'ArrayIf'), 'studentTTestArrayIf': ('studentTTest', 'ArrayIf'), 'quantilesTDigestWeightedArrayIf': ('quantilesTDigestWeighted', 'ArrayIf'), 'sequenceMatchArrayIf': ('sequenceMatch', 'ArrayIf'), 'mannWhitneyUTestArrayIf': ('mannWhitneyUTest', 'ArrayIf'), 'uniqExactArrayIf': ('uniqExact', 'ArrayIf'), 'last_valueArrayIf': ('last_value', 'ArrayIf'), 'quantilesInterpolatedWeightedArrayIf': ('quantilesInterpolatedWeighted', 'ArrayIf'), 'kurtPopArrayIf': ('kurtPop', 'ArrayIf'), 'argMinArrayIf': ('argMin', 'ArrayIf'), 'exponentialTimeDecayedAvgArrayIf': ('exponentialTimeDecayedAvg', 'ArrayIf'), 'covarSampArrayIf': ('covarSamp', 'ArrayIf'), 'groupBitXorArrayIf': ('groupBitXor', 'ArrayIf'), 'groupBitOrArrayIf': ('groupBitOr', 'ArrayIf'), 'maxIntersectionsArrayIf': ('maxIntersections', 'ArrayIf'), 'quantileExactLowArrayIf': ('quantileExactLow', 'ArrayIf'), 'quantilesBFloat16WeightedArrayIf': ('quantilesBFloat16Weighted', 'ArrayIf'), 'groupBitAndArrayIf': ('groupBitAnd', 'ArrayIf'), 'quantilesExactHighArrayIf': ('quantilesExactHigh', 'ArrayIf'), 'quantileTDigestWeightedArrayIf': ('quantileTDigestWeighted', 'ArrayIf'), 'countArrayIf': ('count', 'ArrayIf'), 'groupUniqArrayArrayIf': ('groupUniqArray', 'ArrayIf'), 'minArrayIf': ('min', 'ArrayIf'), 'sparkBarArrayIf': ('sparkBar', 'ArrayIf'), 'windowFunnelArrayIf': ('windowFunnel', 'ArrayIf'), 'stochasticLogisticRegressionArrayIf': ('stochasticLogisticRegression', 'ArrayIf'), 'kolmogorovSmirnovTestArrayIf': ('kolmogorovSmirnovTest', 'ArrayIf'), 'maxIntersectionsPositionArrayIf': ('maxIntersectionsPosition', 'ArrayIf'), 'quantileBFloat16ArrayIf': ('quantileBFloat16', 'ArrayIf'), 'quantilesTimingArrayIf': ('quantilesTiming', 'ArrayIf'), 'quantileTimingArrayIf': ('quantileTiming', 'ArrayIf'), 'groupArrayInsertAtArrayIf': ('groupArrayInsertAt', 'ArrayIf'), 'welchTTestArrayIf': ('welchTTest', 'ArrayIf'), 'sumMapArrayIf': ('sumMap', 'ArrayIf'), 'quantilesDeterministicArrayIf': ('quantilesDeterministic', 'ArrayIf'), 'sumArrayIf': ('sum', 'ArrayIf'), 'uniqUpToArrayIf': ('uniqUpTo', 'ArrayIf'), 'stochasticLinearRegressionArrayIf': ('stochasticLinearRegression', 'ArrayIf'), 'contingencyArrayIf': ('contingency', 'ArrayIf'), 'minMapArrayIf': ('minMap', 'ArrayIf'), 'largestTriangleThreeBucketsArrayIf': ('largestTriangleThreeBuckets', 'ArrayIf'), 'anyLastArrayIf': ('anyLast', 'ArrayIf'), 'quantileTimingWeightedArrayIf': ('quantileTimingWeighted', 'ArrayIf'), 'skewPopArrayIf': ('skewPop', 'ArrayIf'), 'uniqHLL12ArrayIf': ('uniqHLL12', 'ArrayIf'), 'quantilesExactArrayIf': ('quantilesExact', 'ArrayIf'), 'quantileTDigestArrayIf': ('quantileTDigest', 'ArrayIf'), 'deltaSumArrayIf': ('deltaSum', 'ArrayIf'), 'entropyArrayIf': ('entropy', 'ArrayIf'), 'groupBitmapAndArrayIf': ('groupBitmapAnd', 'ArrayIf'), 'maxMapArrayIf': ('maxMap', 'ArrayIf'), 'quantileArrayIf': ('quantile', 'ArrayIf'), 'groupArrayArrayIf': ('groupArray', 'ArrayIf'), 'stddevSampArrayIf': ('stddevSamp', 'ArrayIf'), 'uniqArrayIf': ('uniq', 'ArrayIf'), 'intervalLengthSumArrayIf': ('intervalLengthSum', 'ArrayIf'), 'medianArrayIf': ('median', 'ArrayIf'), 'varPopArrayIf': ('varPop', 'ArrayIf'), 'quantileExactArrayIf': ('quantileExact', 'ArrayIf'), 'quantileDeterministicArrayIf': ('quantileDeterministic', 'ArrayIf'), 'stddevPopArrayIf': ('stddevPop', 'ArrayIf'), 'exponentialMovingAverageMap': ('exponentialMovingAverage', 'Map'), 'quantilesMap': ('quantiles', 'Map'), 'cramersVMap': ('cramersV', 'Map'), 'quantilesTimingWeightedMap': ('quantilesTimingWeighted', 'Map'), 'sumWithOverflowMap': ('sumWithOverflow', 'Map'), 'retentionMap': ('retention', 'Map'), 'rankCorrMap': ('rankCorr', 'Map'), 'quantilesExactWeightedMap': ('quantilesExactWeighted', 'Map'), 'groupBitmapXorMap': ('groupBitmapXor', 'Map'), 'skewSampMap': ('skewSamp', 'Map'), 'covarPopMap': ('covarPop', 'Map'), 'groupArrayMovingSumMap': ('groupArrayMovingSum', 'Map'), 'uniqCombinedMap': ('uniqCombined', 'Map'), 'sumCountMap': ('sumCount', 'Map'), 'groupBitmapMap': ('groupBitmap', 'Map'), 'cramersVBiasCorrectedMap': ('cramersVBiasCorrected', 'Map'), 'uniqThetaMap': ('uniqTheta', 'Map'), 'quantileExactWeightedMap': ('quantileExactWeighted', 'Map'), 'groupArrayMovingAvgMap': ('groupArrayMovingAvg', 'Map'), 'quantileGKMap': ('quantileGK', 'Map'), 'quantilesExactLowMap': ('quantilesExactLow', 'Map'), 'sequenceNextNodeMap': ('sequenceNextNode', 'Map'), 'simpleLinearRegressionMap': ('simpleLinearRegression', 'Map'), 'quantileBFloat16WeightedMap': ('quantileBFloat16Weighted', 'Map'), 'avgMap': ('avg', 'Map'), 'kurtSampMap': ('kurtSamp', 'Map'), 'avgWeightedMap': ('avgWeighted', 'Map'), 'maxMap': ('maxMap', ''), 'histogramMap': ('histogram', 'Map'), 'quantilesBFloat16Map': ('quantilesBFloat16', 'Map'), 'varSampMap': ('varSamp', 'Map'), 'sequenceCountMap': ('sequenceCount', 'Map'), 'anyMap': ('any', 'Map'), 'categoricalInformationValueMap': ('categoricalInformationValue', 'Map'), 'topKWeightedMap': ('topKWeighted', 'Map'), 'groupArrayLastMap': ('groupArrayLast', 'Map'), 'corrMap': ('corr', 'Map'), 'sumKahanMap': ('sumKahan', 'Map'), 'boundingRatioMap': ('boundingRatio', 'Map'), 'meanZTestMap': ('meanZTest', 'Map'), 'quantilesGKMap': ('quantilesGK', 'Map'), 'groupBitmapOrMap': ('groupBitmapOr', 'Map'), 'first_valueMap': ('first_value', 'Map'), 'argMaxMap': ('argMax', 'Map'), 'groupArraySampleMap': ('groupArraySample', 'Map'), 'anyHeavyMap': ('anyHeavy', 'Map'), 'quantilesTDigestMap': ('quantilesTDigest', 'Map'), 'deltaSumTimestampMap': ('deltaSumTimestamp', 'Map'), 'quantileExactHighMap': ('quantileExactHigh', 'Map'), 'topKMap': ('topK', 'Map'), 'theilsUMap': ('theilsU', 'Map'), 'quantileInterpolatedWeightedMap': ('quantileInterpolatedWeighted', 'Map'), 'uniqCombined64Map': ('uniqCombined64', 'Map'), 'studentTTestMap': ('studentTTest', 'Map'), 'quantilesTDigestWeightedMap': ('quantilesTDigestWeighted', 'Map'), 'sequenceMatchMap': ('sequenceMatch', 'Map'), 'mannWhitneyUTestMap': ('mannWhitneyUTest', 'Map'), 'uniqExactMap': ('uniqExact', 'Map'), 'last_valueMap': ('last_value', 'Map'), 'quantilesInterpolatedWeightedMap': ('quantilesInterpolatedWeighted', 'Map'), 'kurtPopMap': ('kurtPop', 'Map'), 'argMinMap': ('argMin', 'Map'), 'exponentialTimeDecayedAvgMap': ('exponentialTimeDecayedAvg', 'Map'), 'covarSampMap': ('covarSamp', 'Map'), 'groupBitXorMap': ('groupBitXor', 'Map'), 'groupBitOrMap': ('groupBitOr', 'Map'), 'maxIntersectionsMap': ('maxIntersections', 'Map'), 'quantileExactLowMap': ('quantileExactLow', 'Map'), 'quantilesBFloat16WeightedMap': ('quantilesBFloat16Weighted', 'Map'), 'groupBitAndMap': ('groupBitAnd', 'Map'), 'quantilesExactHighMap': ('quantilesExactHigh', 'Map'), 'quantileTDigestWeightedMap': ('quantileTDigestWeighted', 'Map'), 'countMap': ('count', 'Map'), 'groupUniqArrayMap': ('groupUniqArray', 'Map'), 'minMap': ('minMap', ''), 'sparkBarMap': ('sparkBar', 'Map'), 'windowFunnelMap': ('windowFunnel', 'Map'), 'stochasticLogisticRegressionMap': ('stochasticLogisticRegression', 'Map'), 'kolmogorovSmirnovTestMap': ('kolmogorovSmirnovTest', 'Map'), 'maxIntersectionsPositionMap': ('maxIntersectionsPosition', 'Map'), 'quantileBFloat16Map': ('quantileBFloat16', 'Map'), 'quantilesTimingMap': ('quantilesTiming', 'Map'), 'quantileTimingMap': ('quantileTiming', 'Map'), 'groupArrayInsertAtMap': ('groupArrayInsertAt', 'Map'), 'welchTTestMap': ('welchTTest', 'Map'), 'sumMapMap': ('sumMap', 'Map'), 'quantilesDeterministicMap': ('quantilesDeterministic', 'Map'), 'sumMap': ('sumMap', ''), 'uniqUpToMap': ('uniqUpTo', 'Map'), 'stochasticLinearRegressionMap': ('stochasticLinearRegression', 'Map'), 'contingencyMap': ('contingency', 'Map'), 'minMapMap': ('minMap', 'Map'), 'largestTriangleThreeBucketsMap': ('largestTriangleThreeBuckets', 'Map'), 'anyLastMap': ('anyLast', 'Map'), 'quantileTimingWeightedMap': ('quantileTimingWeighted', 'Map'), 'skewPopMap': ('skewPop', 'Map'), 'uniqHLL12Map': ('uniqHLL12', 'Map'), 'quantilesExactMap': ('quantilesExact', 'Map'), 'quantileTDigestMap': ('quantileTDigest', 'Map'), 'deltaSumMap': ('deltaSum', 'Map'), 'entropyMap': ('entropy', 'Map'), 'groupBitmapAndMap': ('groupBitmapAnd', 'Map'), 'maxMapMap': ('maxMap', 'Map'), 'quantileMap': ('quantile', 'Map'), 'groupArrayMap': ('groupArray', 'Map'), 'stddevSampMap': ('stddevSamp', 'Map'), 'uniqMap': ('uniq', 'Map'), 'intervalLengthSumMap': ('intervalLengthSum', 'Map'), 'medianMap': ('median', 'Map'), 'varPopMap': ('varPop', 'Map'), 'quantileExactMap': ('quantileExact', 'Map'), 'quantileDeterministicMap': ('quantileDeterministic', 'Map'), 'stddevPopMap': ('stddevPop', 'Map'), 'exponentialMovingAverageSimpleState': ('exponentialMovingAverage', 'SimpleState'), 'quantilesSimpleState': ('quantiles', 'SimpleState'), 'cramersVSimpleState': ('cramersV', 'SimpleState'), 'quantilesTimingWeightedSimpleState': ('quantilesTimingWeighted', 'SimpleState'), 'sumWithOverflowSimpleState': ('sumWithOverflow', 'SimpleState'), 'retentionSimpleState': ('retention', 'SimpleState'), 'rankCorrSimpleState': ('rankCorr', 'SimpleState'), 'quantilesExactWeightedSimpleState': ('quantilesExactWeighted', 'SimpleState'), 'groupBitmapXorSimpleState': ('groupBitmapXor', 'SimpleState'), 'skewSampSimpleState': ('skewSamp', 'SimpleState'), 'covarPopSimpleState': ('covarPop', 'SimpleState'), 'groupArrayMovingSumSimpleState': ('groupArrayMovingSum', 'SimpleState'), 'uniqCombinedSimpleState': ('uniqCombined', 'SimpleState'), 'sumCountSimpleState': ('sumCount', 'SimpleState'), 'groupBitmapSimpleState': ('groupBitmap', 'SimpleState'), 'cramersVBiasCorrectedSimpleState': ('cramersVBiasCorrected', 'SimpleState'), 'uniqThetaSimpleState': ('uniqTheta', 'SimpleState'), 'quantileExactWeightedSimpleState': ('quantileExactWeighted', 'SimpleState'), 'groupArrayMovingAvgSimpleState': ('groupArrayMovingAvg', 'SimpleState'), 'quantileGKSimpleState': ('quantileGK', 'SimpleState'), 'quantilesExactLowSimpleState': ('quantilesExactLow', 'SimpleState'), 'sequenceNextNodeSimpleState': ('sequenceNextNode', 'SimpleState'), 'simpleLinearRegressionSimpleState': ('simpleLinearRegression', 'SimpleState'), 'quantileBFloat16WeightedSimpleState': ('quantileBFloat16Weighted', 'SimpleState'), 'avgSimpleState': ('avg', 'SimpleState'), 'kurtSampSimpleState': ('kurtSamp', 'SimpleState'), 'avgWeightedSimpleState': ('avgWeighted', 'SimpleState'), 'maxSimpleState': ('max', 'SimpleState'), 'histogramSimpleState': ('histogram', 'SimpleState'), 'quantilesBFloat16SimpleState': ('quantilesBFloat16', 'SimpleState'), 'varSampSimpleState': ('varSamp', 'SimpleState'), 'sequenceCountSimpleState': ('sequenceCount', 'SimpleState'), 'anySimpleState': ('any', 'SimpleState'), 'categoricalInformationValueSimpleState': ('categoricalInformationValue', 'SimpleState'), 'topKWeightedSimpleState': ('topKWeighted', 'SimpleState'), 'groupArrayLastSimpleState': ('groupArrayLast', 'SimpleState'), 'corrSimpleState': ('corr', 'SimpleState'), 'sumKahanSimpleState': ('sumKahan', 'SimpleState'), 'boundingRatioSimpleState': ('boundingRatio', 'SimpleState'), 'meanZTestSimpleState': ('meanZTest', 'SimpleState'), 'quantilesGKSimpleState': ('quantilesGK', 'SimpleState'), 'groupBitmapOrSimpleState': ('groupBitmapOr', 'SimpleState'), 'first_valueSimpleState': ('first_value', 'SimpleState'), 'argMaxSimpleState': ('argMax', 'SimpleState'), 'groupArraySampleSimpleState': ('groupArraySample', 'SimpleState'), 'anyHeavySimpleState': ('anyHeavy', 'SimpleState'), 'quantilesTDigestSimpleState': ('quantilesTDigest', 'SimpleState'), 'deltaSumTimestampSimpleState': ('deltaSumTimestamp', 'SimpleState'), 'quantileExactHighSimpleState': ('quantileExactHigh', 'SimpleState'), 'topKSimpleState': ('topK', 'SimpleState'), 'theilsUSimpleState': ('theilsU', 'SimpleState'), 'quantileInterpolatedWeightedSimpleState': ('quantileInterpolatedWeighted', 'SimpleState'), 'uniqCombined64SimpleState': ('uniqCombined64', 'SimpleState'), 'studentTTestSimpleState': ('studentTTest', 'SimpleState'), 'quantilesTDigestWeightedSimpleState': ('quantilesTDigestWeighted', 'SimpleState'), 'sequenceMatchSimpleState': ('sequenceMatch', 'SimpleState'), 'mannWhitneyUTestSimpleState': ('mannWhitneyUTest', 'SimpleState'), 'uniqExactSimpleState': ('uniqExact', 'SimpleState'), 'last_valueSimpleState': ('last_value', 'SimpleState'), 'quantilesInterpolatedWeightedSimpleState': ('quantilesInterpolatedWeighted', 'SimpleState'), 'kurtPopSimpleState': ('kurtPop', 'SimpleState'), 'argMinSimpleState': ('argMin', 'SimpleState'), 'exponentialTimeDecayedAvgSimpleState': ('exponentialTimeDecayedAvg', 'SimpleState'), 'covarSampSimpleState': ('covarSamp', 'SimpleState'), 'groupBitXorSimpleState': ('groupBitXor', 'SimpleState'), 'groupBitOrSimpleState': ('groupBitOr', 'SimpleState'), 'maxIntersectionsSimpleState': ('maxIntersections', 'SimpleState'), 'quantileExactLowSimpleState': ('quantileExactLow', 'SimpleState'), 'quantilesBFloat16WeightedSimpleState': ('quantilesBFloat16Weighted', 'SimpleState'), 'groupBitAndSimpleState': ('groupBitAnd', 'SimpleState'), 'quantilesExactHighSimpleState': ('quantilesExactHigh', 'SimpleState'), 'quantileTDigestWeightedSimpleState': ('quantileTDigestWeighted', 'SimpleState'), 'countSimpleState': ('count', 'SimpleState'), 'groupUniqArraySimpleState': ('groupUniqArray', 'SimpleState'), 'minSimpleState': ('min', 'SimpleState'), 'sparkBarSimpleState': ('sparkBar', 'SimpleState'), 'windowFunnelSimpleState': ('windowFunnel', 'SimpleState'), 'stochasticLogisticRegressionSimpleState': ('stochasticLogisticRegression', 'SimpleState'), 'kolmogorovSmirnovTestSimpleState': ('kolmogorovSmirnovTest', 'SimpleState'), 'maxIntersectionsPositionSimpleState': ('maxIntersectionsPosition', 'SimpleState'), 'quantileBFloat16SimpleState': ('quantileBFloat16', 'SimpleState'), 'quantilesTimingSimpleState': ('quantilesTiming', 'SimpleState'), 'quantileTimingSimpleState': ('quantileTiming', 'SimpleState'), 'groupArrayInsertAtSimpleState': ('groupArrayInsertAt', 'SimpleState'), 'welchTTestSimpleState': ('welchTTest', 'SimpleState'), 'sumMapSimpleState': ('sumMap', 'SimpleState'), 'quantilesDeterministicSimpleState': ('quantilesDeterministic', 'SimpleState'), 'sumSimpleState': ('sum', 'SimpleState'), 'uniqUpToSimpleState': ('uniqUpTo', 'SimpleState'), 'stochasticLinearRegressionSimpleState': ('stochasticLinearRegression', 'SimpleState'), 'contingencySimpleState': ('contingency', 'SimpleState'), 'minMapSimpleState': ('minMap', 'SimpleState'), 'largestTriangleThreeBucketsSimpleState': ('largestTriangleThreeBuckets', 'SimpleState'), 'anyLastSimpleState': ('anyLast', 'SimpleState'), 'quantileTimingWeightedSimpleState': ('quantileTimingWeighted', 'SimpleState'), 'skewPopSimpleState': ('skewPop', 'SimpleState'), 'uniqHLL12SimpleState': ('uniqHLL12', 'SimpleState'), 'quantilesExactSimpleState': ('quantilesExact', 'SimpleState'), 'quantileTDigestSimpleState': ('quantileTDigest', 'SimpleState'), 'deltaSumSimpleState': ('deltaSum', 'SimpleState'), 'entropySimpleState': ('entropy', 'SimpleState'), 'groupBitmapAndSimpleState': ('groupBitmapAnd', 'SimpleState'), 'maxMapSimpleState': ('maxMap', 'SimpleState'), 'quantileSimpleState': ('quantile', 'SimpleState'), 'groupArraySimpleState': ('groupArray', 'SimpleState'), 'stddevSampSimpleState': ('stddevSamp', 'SimpleState'), 'uniqSimpleState': ('uniq', 'SimpleState'), 'intervalLengthSumSimpleState': ('intervalLengthSum', 'SimpleState'), 'medianSimpleState': ('median', 'SimpleState'), 'varPopSimpleState': ('varPop', 'SimpleState'), 'quantileExactSimpleState': ('quantileExact', 'SimpleState'), 'quantileDeterministicSimpleState': ('quantileDeterministic', 'SimpleState'), 'stddevPopSimpleState': ('stddevPop', 'SimpleState'), 'exponentialMovingAverageState': ('exponentialMovingAverage', 'State'), 'quantilesState': ('quantiles', 'State'), 'cramersVState': ('cramersV', 'State'), 'quantilesTimingWeightedState': ('quantilesTimingWeighted', 'State'), 'sumWithOverflowState': ('sumWithOverflow', 'State'), 'retentionState': ('retention', 'State'), 'rankCorrState': ('rankCorr', 'State'), 'quantilesExactWeightedState': ('quantilesExactWeighted', 'State'), 'groupBitmapXorState': ('groupBitmapXor', 'State'), 'skewSampState': ('skewSamp', 'State'), 'covarPopState': ('covarPop', 'State'), 'groupArrayMovingSumState': ('groupArrayMovingSum', 'State'), 'uniqCombinedState': ('uniqCombined', 'State'), 'sumCountState': ('sumCount', 'State'), 'groupBitmapState': ('groupBitmap', 'State'), 'cramersVBiasCorrectedState': ('cramersVBiasCorrected', 'State'), 'uniqThetaState': ('uniqTheta', 'State'), 'quantileExactWeightedState': ('quantileExactWeighted', 'State'), 'groupArrayMovingAvgState': ('groupArrayMovingAvg', 'State'), 'quantileGKState': ('quantileGK', 'State'), 'quantilesExactLowState': ('quantilesExactLow', 'State'), 'sequenceNextNodeState': ('sequenceNextNode', 'State'), 'simpleLinearRegressionState': ('simpleLinearRegression', 'State'), 'quantileBFloat16WeightedState': ('quantileBFloat16Weighted', 'State'), 'avgState': ('avg', 'State'), 'kurtSampState': ('kurtSamp', 'State'), 'avgWeightedState': ('avgWeighted', 'State'), 'maxState': ('max', 'State'), 'histogramState': ('histogram', 'State'), 'quantilesBFloat16State': ('quantilesBFloat16', 'State'), 'varSampState': ('varSamp', 'State'), 'sequenceCountState': ('sequenceCount', 'State'), 'anyState': ('any', 'State'), 'categoricalInformationValueState': ('categoricalInformationValue', 'State'), 'topKWeightedState': ('topKWeighted', 'State'), 'groupArrayLastState': ('groupArrayLast', 'State'), 'corrState': ('corr', 'State'), 'sumKahanState': ('sumKahan', 'State'), 'boundingRatioState': ('boundingRatio', 'State'), 'meanZTestState': ('meanZTest', 'State'), 'quantilesGKState': ('quantilesGK', 'State'), 'groupBitmapOrState': ('groupBitmapOr', 'State'), 'first_valueState': ('first_value', 'State'), 'argMaxState': ('argMax', 'State'), 'groupArraySampleState': ('groupArraySample', 'State'), 'anyHeavyState': ('anyHeavy', 'State'), 'quantilesTDigestState': ('quantilesTDigest', 'State'), 'deltaSumTimestampState': ('deltaSumTimestamp', 'State'), 'quantileExactHighState': ('quantileExactHigh', 'State'), 'topKState': ('topK', 'State'), 'theilsUState': ('theilsU', 'State'), 'quantileInterpolatedWeightedState': ('quantileInterpolatedWeighted', 'State'), 'uniqCombined64State': ('uniqCombined64', 'State'), 'studentTTestState': ('studentTTest', 'State'), 'quantilesTDigestWeightedState': ('quantilesTDigestWeighted', 'State'), 'sequenceMatchState': ('sequenceMatch', 'State'), 'mannWhitneyUTestState': ('mannWhitneyUTest', 'State'), 'uniqExactState': ('uniqExact', 'State'), 'last_valueState': ('last_value', 'State'), 'quantilesInterpolatedWeightedState': ('quantilesInterpolatedWeighted', 'State'), 'kurtPopState': ('kurtPop', 'State'), 'argMinState': ('argMin', 'State'), 'exponentialTimeDecayedAvgState': ('exponentialTimeDecayedAvg', 'State'), 'covarSampState': ('covarSamp', 'State'), 'groupBitXorState': ('groupBitXor', 'State'), 'groupBitOrState': ('groupBitOr', 'State'), 'maxIntersectionsState': ('maxIntersections', 'State'), 'quantileExactLowState': ('quantileExactLow', 'State'), 'quantilesBFloat16WeightedState': ('quantilesBFloat16Weighted', 'State'), 'groupBitAndState': ('groupBitAnd', 'State'), 'quantilesExactHighState': ('quantilesExactHigh', 'State'), 'quantileTDigestWeightedState': ('quantileTDigestWeighted', 'State'), 'countState': ('count', 'State'), 'groupUniqArrayState': ('groupUniqArray', 'State'), 'minState': ('min', 'State'), 'sparkBarState': ('sparkBar', 'State'), 'windowFunnelState': ('windowFunnel', 'State'), 'stochasticLogisticRegressionState': ('stochasticLogisticRegression', 'State'), 'kolmogorovSmirnovTestState': ('kolmogorovSmirnovTest', 'State'), 'maxIntersectionsPositionState': ('maxIntersectionsPosition', 'State'), 'quantileBFloat16State': ('quantileBFloat16', 'State'), 'quantilesTimingState': ('quantilesTiming', 'State'), 'quantileTimingState': ('quantileTiming', 'State'), 'groupArrayInsertAtState': ('groupArrayInsertAt', 'State'), 'welchTTestState': ('welchTTest', 'State'), 'sumMapState': ('sumMap', 'State'), 'quantilesDeterministicState': ('quantilesDeterministic', 'State'), 'sumState': ('sum', 'State'), 'uniqUpToState': ('uniqUpTo', 'State'), 'stochasticLinearRegressionState': ('stochasticLinearRegression', 'State'), 'contingencyState': ('contingency', 'State'), 'minMapState': ('minMap', 'State'), 'largestTriangleThreeBucketsState': ('largestTriangleThreeBuckets', 'State'), 'anyLastState': ('anyLast', 'State'), 'quantileTimingWeightedState': ('quantileTimingWeighted', 'State'), 'skewPopState': ('skewPop', 'State'), 'uniqHLL12State': ('uniqHLL12', 'State'), 'quantilesExactState': ('quantilesExact', 'State'), 'quantileTDigestState': ('quantileTDigest', 'State'), 'deltaSumState': ('deltaSum', 'State'), 'entropyState': ('entropy', 'State'), 'groupBitmapAndState': ('groupBitmapAnd', 'State'), 'maxMapState': ('maxMap', 'State'), 'quantileState': ('quantile', 'State'), 'groupArrayState': ('groupArray', 'State'), 'stddevSampState': ('stddevSamp', 'State'), 'uniqState': ('uniq', 'State'), 'intervalLengthSumState': ('intervalLengthSum', 'State'), 'medianState': ('median', 'State'), 'varPopState': ('varPop', 'State'), 'quantileExactState': ('quantileExact', 'State'), 'quantileDeterministicState': ('quantileDeterministic', 'State'), 'stddevPopState': ('stddevPop', 'State'), 'exponentialMovingAverageMerge': ('exponentialMovingAverage', 'Merge'), 'quantilesMerge': ('quantiles', 'Merge'), 'cramersVMerge': ('cramersV', 'Merge'), 'quantilesTimingWeightedMerge': ('quantilesTimingWeighted', 'Merge'), 'sumWithOverflowMerge': ('sumWithOverflow', 'Merge'), 'retentionMerge': ('retention', 'Merge'), 'rankCorrMerge': ('rankCorr', 'Merge'), 'quantilesExactWeightedMerge': ('quantilesExactWeighted', 'Merge'), 'groupBitmapXorMerge': ('groupBitmapXor', 'Merge'), 'skewSampMerge': ('skewSamp', 'Merge'), 'covarPopMerge': ('covarPop', 'Merge'), 'groupArrayMovingSumMerge': ('groupArrayMovingSum', 'Merge'), 'uniqCombinedMerge': ('uniqCombined', 'Merge'), 'sumCountMerge': ('sumCount', 'Merge'), 'groupBitmapMerge': ('groupBitmap', 'Merge'), 'cramersVBiasCorrectedMerge': ('cramersVBiasCorrected', 'Merge'), 'uniqThetaMerge': ('uniqTheta', 'Merge'), 'quantileExactWeightedMerge': ('quantileExactWeighted', 'Merge'), 'groupArrayMovingAvgMerge': ('groupArrayMovingAvg', 'Merge'), 'quantileGKMerge': ('quantileGK', 'Merge'), 'quantilesExactLowMerge': ('quantilesExactLow', 'Merge'), 'sequenceNextNodeMerge': ('sequenceNextNode', 'Merge'), 'simpleLinearRegressionMerge': ('simpleLinearRegression', 'Merge'), 'quantileBFloat16WeightedMerge': ('quantileBFloat16Weighted', 'Merge'), 'avgMerge': ('avg', 'Merge'), 'kurtSampMerge': ('kurtSamp', 'Merge'), 'avgWeightedMerge': ('avgWeighted', 'Merge'), 'maxMerge': ('max', 'Merge'), 'histogramMerge': ('histogram', 'Merge'), 'quantilesBFloat16Merge': ('quantilesBFloat16', 'Merge'), 'varSampMerge': ('varSamp', 'Merge'), 'sequenceCountMerge': ('sequenceCount', 'Merge'), 'anyMerge': ('any', 'Merge'), 'categoricalInformationValueMerge': ('categoricalInformationValue', 'Merge'), 'topKWeightedMerge': ('topKWeighted', 'Merge'), 'groupArrayLastMerge': ('groupArrayLast', 'Merge'), 'corrMerge': ('corr', 'Merge'), 'sumKahanMerge': ('sumKahan', 'Merge'), 'boundingRatioMerge': ('boundingRatio', 'Merge'), 'meanZTestMerge': ('meanZTest', 'Merge'), 'quantilesGKMerge': ('quantilesGK', 'Merge'), 'groupBitmapOrMerge': ('groupBitmapOr', 'Merge'), 'first_valueMerge': ('first_value', 'Merge'), 'argMaxMerge': ('argMax', 'Merge'), 'groupArraySampleMerge': ('groupArraySample', 'Merge'), 'anyHeavyMerge': ('anyHeavy', 'Merge'), 'quantilesTDigestMerge': ('quantilesTDigest', 'Merge'), 'deltaSumTimestampMerge': ('deltaSumTimestamp', 'Merge'), 'quantileExactHighMerge': ('quantileExactHigh', 'Merge'), 'topKMerge': ('topK', 'Merge'), 'theilsUMerge': ('theilsU', 'Merge'), 'quantileInterpolatedWeightedMerge': ('quantileInterpolatedWeighted', 'Merge'), 'uniqCombined64Merge': ('uniqCombined64', 'Merge'), 'studentTTestMerge': ('studentTTest', 'Merge'), 'quantilesTDigestWeightedMerge': ('quantilesTDigestWeighted', 'Merge'), 'sequenceMatchMerge': ('sequenceMatch', 'Merge'), 'mannWhitneyUTestMerge': ('mannWhitneyUTest', 'Merge'), 'uniqExactMerge': ('uniqExact', 'Merge'), 'last_valueMerge': ('last_value', 'Merge'), 'quantilesInterpolatedWeightedMerge': ('quantilesInterpolatedWeighted', 'Merge'), 'kurtPopMerge': ('kurtPop', 'Merge'), 'argMinMerge': ('argMin', 'Merge'), 'exponentialTimeDecayedAvgMerge': ('exponentialTimeDecayedAvg', 'Merge'), 'covarSampMerge': ('covarSamp', 'Merge'), 'groupBitXorMerge': ('groupBitXor', 'Merge'), 'groupBitOrMerge': ('groupBitOr', 'Merge'), 'maxIntersectionsMerge': ('maxIntersections', 'Merge'), 'quantileExactLowMerge': ('quantileExactLow', 'Merge'), 'quantilesBFloat16WeightedMerge': ('quantilesBFloat16Weighted', 'Merge'), 'groupBitAndMerge': ('groupBitAnd', 'Merge'), 'quantilesExactHighMerge': ('quantilesExactHigh', 'Merge'), 'quantileTDigestWeightedMerge': ('quantileTDigestWeighted', 'Merge'), 'countMerge': ('count', 'Merge'), 'groupUniqArrayMerge': ('groupUniqArray', 'Merge'), 'minMerge': ('min', 'Merge'), 'sparkBarMerge': ('sparkBar', 'Merge'), 'windowFunnelMerge': ('windowFunnel', 'Merge'), 'stochasticLogisticRegressionMerge': ('stochasticLogisticRegression', 'Merge'), 'kolmogorovSmirnovTestMerge': ('kolmogorovSmirnovTest', 'Merge'), 'maxIntersectionsPositionMerge': ('maxIntersectionsPosition', 'Merge'), 'quantileBFloat16Merge': ('quantileBFloat16', 'Merge'), 'quantilesTimingMerge': ('quantilesTiming', 'Merge'), 'quantileTimingMerge': ('quantileTiming', 'Merge'), 'groupArrayInsertAtMerge': ('groupArrayInsertAt', 'Merge'), 'welchTTestMerge': ('welchTTest', 'Merge'), 'sumMapMerge': ('sumMap', 'Merge'), 'quantilesDeterministicMerge': ('quantilesDeterministic', 'Merge'), 'sumMerge': ('sum', 'Merge'), 'uniqUpToMerge': ('uniqUpTo', 'Merge'), 'stochasticLinearRegressionMerge': ('stochasticLinearRegression', 'Merge'), 'contingencyMerge': ('contingency', 'Merge'), 'minMapMerge': ('minMap', 'Merge'), 'largestTriangleThreeBucketsMerge': ('largestTriangleThreeBuckets', 'Merge'), 'anyLastMerge': ('anyLast', 'Merge'), 'quantileTimingWeightedMerge': ('quantileTimingWeighted', 'Merge'), 'skewPopMerge': ('skewPop', 'Merge'), 'uniqHLL12Merge': ('uniqHLL12', 'Merge'), 'quantilesExactMerge': ('quantilesExact', 'Merge'), 'quantileTDigestMerge': ('quantileTDigest', 'Merge'), 'deltaSumMerge': ('deltaSum', 'Merge'), 'entropyMerge': ('entropy', 'Merge'), 'groupBitmapAndMerge': ('groupBitmapAnd', 'Merge'), 'maxMapMerge': ('maxMap', 'Merge'), 'quantileMerge': ('quantile', 'Merge'), 'groupArrayMerge': ('groupArray', 'Merge'), 'stddevSampMerge': ('stddevSamp', 'Merge'), 'uniqMerge': ('uniq', 'Merge'), 'intervalLengthSumMerge': ('intervalLengthSum', 'Merge'), 'medianMerge': ('median', 'Merge'), 'varPopMerge': ('varPop', 'Merge'), 'quantileExactMerge': ('quantileExact', 'Merge'), 'quantileDeterministicMerge': ('quantileDeterministic', 'Merge'), 'stddevPopMerge': ('stddevPop', 'Merge'), 'exponentialMovingAverageMergeState': ('exponentialMovingAverage', 'MergeState'), 'quantilesMergeState': ('quantiles', 'MergeState'), 'cramersVMergeState': ('cramersV', 'MergeState'), 'quantilesTimingWeightedMergeState': ('quantilesTimingWeighted', 'MergeState'), 'sumWithOverflowMergeState': ('sumWithOverflow', 'MergeState'), 'retentionMergeState': ('retention', 'MergeState'), 'rankCorrMergeState': ('rankCorr', 'MergeState'), 'quantilesExactWeightedMergeState': ('quantilesExactWeighted', 'MergeState'), 'groupBitmapXorMergeState': ('groupBitmapXor', 'MergeState'), 'skewSampMergeState': ('skewSamp', 'MergeState'), 'covarPopMergeState': ('covarPop', 'MergeState'), 'groupArrayMovingSumMergeState': ('groupArrayMovingSum', 'MergeState'), 'uniqCombinedMergeState': ('uniqCombined', 'MergeState'), 'sumCountMergeState': ('sumCount', 'MergeState'), 'groupBitmapMergeState': ('groupBitmap', 'MergeState'), 'cramersVBiasCorrectedMergeState': ('cramersVBiasCorrected', 'MergeState'), 'uniqThetaMergeState': ('uniqTheta', 'MergeState'), 'quantileExactWeightedMergeState': ('quantileExactWeighted', 'MergeState'), 'groupArrayMovingAvgMergeState': ('groupArrayMovingAvg', 'MergeState'), 'quantileGKMergeState': ('quantileGK', 'MergeState'), 'quantilesExactLowMergeState': ('quantilesExactLow', 'MergeState'), 'sequenceNextNodeMergeState': ('sequenceNextNode', 'MergeState'), 'simpleLinearRegressionMergeState': ('simpleLinearRegression', 'MergeState'), 'quantileBFloat16WeightedMergeState': ('quantileBFloat16Weighted', 'MergeState'), 'avgMergeState': ('avg', 'MergeState'), 'kurtSampMergeState': ('kurtSamp', 'MergeState'), 'avgWeightedMergeState': ('avgWeighted', 'MergeState'), 'maxMergeState': ('max', 'MergeState'), 'histogramMergeState': ('histogram', 'MergeState'), 'quantilesBFloat16MergeState': ('quantilesBFloat16', 'MergeState'), 'varSampMergeState': ('varSamp', 'MergeState'), 'sequenceCountMergeState': ('sequenceCount', 'MergeState'), 'anyMergeState': ('any', 'MergeState'), 'categoricalInformationValueMergeState': ('categoricalInformationValue', 'MergeState'), 'topKWeightedMergeState': ('topKWeighted', 'MergeState'), 'groupArrayLastMergeState': ('groupArrayLast', 'MergeState'), 'corrMergeState': ('corr', 'MergeState'), 'sumKahanMergeState': ('sumKahan', 'MergeState'), 'boundingRatioMergeState': ('boundingRatio', 'MergeState'), 'meanZTestMergeState': ('meanZTest', 'MergeState'), 'quantilesGKMergeState': ('quantilesGK', 'MergeState'), 'groupBitmapOrMergeState': ('groupBitmapOr', 'MergeState'), 'first_valueMergeState': ('first_value', 'MergeState'), 'argMaxMergeState': ('argMax', 'MergeState'), 'groupArraySampleMergeState': ('groupArraySample', 'MergeState'), 'anyHeavyMergeState': ('anyHeavy', 'MergeState'), 'quantilesTDigestMergeState': ('quantilesTDigest', 'MergeState'), 'deltaSumTimestampMergeState': ('deltaSumTimestamp', 'MergeState'), 'quantileExactHighMergeState': ('quantileExactHigh', 'MergeState'), 'topKMergeState': ('topK', 'MergeState'), 'theilsUMergeState': ('theilsU', 'MergeState'), 'quantileInterpolatedWeightedMergeState': ('quantileInterpolatedWeighted', 'MergeState'), 'uniqCombined64MergeState': ('uniqCombined64', 'MergeState'), 'studentTTestMergeState': ('studentTTest', 'MergeState'), 'quantilesTDigestWeightedMergeState': ('quantilesTDigestWeighted', 'MergeState'), 'sequenceMatchMergeState': ('sequenceMatch', 'MergeState'), 'mannWhitneyUTestMergeState': ('mannWhitneyUTest', 'MergeState'), 'uniqExactMergeState': ('uniqExact', 'MergeState'), 'last_valueMergeState': ('last_value', 'MergeState'), 'quantilesInterpolatedWeightedMergeState': ('quantilesInterpolatedWeighted', 'MergeState'), 'kurtPopMergeState': ('kurtPop', 'MergeState'), 'argMinMergeState': ('argMin', 'MergeState'), 'exponentialTimeDecayedAvgMergeState': ('exponentialTimeDecayedAvg', 'MergeState'), 'covarSampMergeState': ('covarSamp', 'MergeState'), 'groupBitXorMergeState': ('groupBitXor', 'MergeState'), 'groupBitOrMergeState': ('groupBitOr', 'MergeState'), 'maxIntersectionsMergeState': ('maxIntersections', 'MergeState'), 'quantileExactLowMergeState': ('quantileExactLow', 'MergeState'), 'quantilesBFloat16WeightedMergeState': ('quantilesBFloat16Weighted', 'MergeState'), 'groupBitAndMergeState': ('groupBitAnd', 'MergeState'), 'quantilesExactHighMergeState': ('quantilesExactHigh', 'MergeState'), 'quantileTDigestWeightedMergeState': ('quantileTDigestWeighted', 'MergeState'), 'countMergeState': ('count', 'MergeState'), 'groupUniqArrayMergeState': ('groupUniqArray', 'MergeState'), 'minMergeState': ('min', 'MergeState'), 'sparkBarMergeState': ('sparkBar', 'MergeState'), 'windowFunnelMergeState': ('windowFunnel', 'MergeState'), 'stochasticLogisticRegressionMergeState': ('stochasticLogisticRegression', 'MergeState'), 'kolmogorovSmirnovTestMergeState': ('kolmogorovSmirnovTest', 'MergeState'), 'maxIntersectionsPositionMergeState': ('maxIntersectionsPosition', 'MergeState'), 'quantileBFloat16MergeState': ('quantileBFloat16', 'MergeState'), 'quantilesTimingMergeState': ('quantilesTiming', 'MergeState'), 'quantileTimingMergeState': ('quantileTiming', 'MergeState'), 'groupArrayInsertAtMergeState': ('groupArrayInsertAt', 'MergeState'), 'welchTTestMergeState': ('welchTTest', 'MergeState'), 'sumMapMergeState': ('sumMap', 'MergeState'), 'quantilesDeterministicMergeState': ('quantilesDeterministic', 'MergeState'), 'sumMergeState': ('sum', 'MergeState'), 'uniqUpToMergeState': ('uniqUpTo', 'MergeState'), 'stochasticLinearRegressionMergeState': ('stochasticLinearRegression', 'MergeState'), 'contingencyMergeState': ('contingency', 'MergeState'), 'minMapMergeState': ('minMap', 'MergeState'), 'largestTriangleThreeBucketsMergeState': ('largestTriangleThreeBuckets', 'MergeState'), 'anyLastMergeState': ('anyLast', 'MergeState'), 'quantileTimingWeightedMergeState': ('quantileTimingWeighted', 'MergeState'), 'skewPopMergeState': ('skewPop', 'MergeState'), 'uniqHLL12MergeState': ('uniqHLL12', 'MergeState'), 'quantilesExactMergeState': ('quantilesExact', 'MergeState'), 'quantileTDigestMergeState': ('quantileTDigest', 'MergeState'), 'deltaSumMergeState': ('deltaSum', 'MergeState'), 'entropyMergeState': ('entropy', 'MergeState'), 'groupBitmapAndMergeState': ('groupBitmapAnd', 'MergeState'), 'maxMapMergeState': ('maxMap', 'MergeState'), 'quantileMergeState': ('quantile', 'MergeState'), 'groupArrayMergeState': ('groupArray', 'MergeState'), 'stddevSampMergeState': ('stddevSamp', 'MergeState'), 'uniqMergeState': ('uniq', 'MergeState'), 'intervalLengthSumMergeState': ('intervalLengthSum', 'MergeState'), 'medianMergeState': ('median', 'MergeState'), 'varPopMergeState': ('varPop', 'MergeState'), 'quantileExactMergeState': ('quantileExact', 'MergeState'), 'quantileDeterministicMergeState': ('quantileDeterministic', 'MergeState'), 'stddevPopMergeState': ('stddevPop', 'MergeState'), 'exponentialMovingAverageForEach': ('exponentialMovingAverage', 'ForEach'), 'quantilesForEach': ('quantiles', 'ForEach'), 'cramersVForEach': ('cramersV', 'ForEach'), 'quantilesTimingWeightedForEach': ('quantilesTimingWeighted', 'ForEach'), 'sumWithOverflowForEach': ('sumWithOverflow', 'ForEach'), 'retentionForEach': ('retention', 'ForEach'), 'rankCorrForEach': ('rankCorr', 'ForEach'), 'quantilesExactWeightedForEach': ('quantilesExactWeighted', 'ForEach'), 'groupBitmapXorForEach': ('groupBitmapXor', 'ForEach'), 'skewSampForEach': ('skewSamp', 'ForEach'), 'covarPopForEach': ('covarPop', 'ForEach'), 'groupArrayMovingSumForEach': ('groupArrayMovingSum', 'ForEach'), 'uniqCombinedForEach': ('uniqCombined', 'ForEach'), 'sumCountForEach': ('sumCount', 'ForEach'), 'groupBitmapForEach': ('groupBitmap', 'ForEach'), 'cramersVBiasCorrectedForEach': ('cramersVBiasCorrected', 'ForEach'), 'uniqThetaForEach': ('uniqTheta', 'ForEach'), 'quantileExactWeightedForEach': ('quantileExactWeighted', 'ForEach'), 'groupArrayMovingAvgForEach': ('groupArrayMovingAvg', 'ForEach'), 'quantileGKForEach': ('quantileGK', 'ForEach'), 'quantilesExactLowForEach': ('quantilesExactLow', 'ForEach'), 'sequenceNextNodeForEach': ('sequenceNextNode', 'ForEach'), 'simpleLinearRegressionForEach': ('simpleLinearRegression', 'ForEach'), 'quantileBFloat16WeightedForEach': ('quantileBFloat16Weighted', 'ForEach'), 'avgForEach': ('avg', 'ForEach'), 'kurtSampForEach': ('kurtSamp', 'ForEach'), 'avgWeightedForEach': ('avgWeighted', 'ForEach'), 'maxForEach': ('max', 'ForEach'), 'histogramForEach': ('histogram', 'ForEach'), 'quantilesBFloat16ForEach': ('quantilesBFloat16', 'ForEach'), 'varSampForEach': ('varSamp', 'ForEach'), 'sequenceCountForEach': ('sequenceCount', 'ForEach'), 'anyForEach': ('any', 'ForEach'), 'categoricalInformationValueForEach': ('categoricalInformationValue', 'ForEach'), 'topKWeightedForEach': ('topKWeighted', 'ForEach'), 'groupArrayLastForEach': ('groupArrayLast', 'ForEach'), 'corrForEach': ('corr', 'ForEach'), 'sumKahanForEach': ('sumKahan', 'ForEach'), 'boundingRatioForEach': ('boundingRatio', 'ForEach'), 'meanZTestForEach': ('meanZTest', 'ForEach'), 'quantilesGKForEach': ('quantilesGK', 'ForEach'), 'groupBitmapOrForEach': ('groupBitmapOr', 'ForEach'), 'first_valueForEach': ('first_value', 'ForEach'), 'argMaxForEach': ('argMax', 'ForEach'), 'groupArraySampleForEach': ('groupArraySample', 'ForEach'), 'anyHeavyForEach': ('anyHeavy', 'ForEach'), 'quantilesTDigestForEach': ('quantilesTDigest', 'ForEach'), 'deltaSumTimestampForEach': ('deltaSumTimestamp', 'ForEach'), 'quantileExactHighForEach': ('quantileExactHigh', 'ForEach'), 'topKForEach': ('topK', 'ForEach'), 'theilsUForEach': ('theilsU', 'ForEach'), 'quantileInterpolatedWeightedForEach': ('quantileInterpolatedWeighted', 'ForEach'), 'uniqCombined64ForEach': ('uniqCombined64', 'ForEach'), 'studentTTestForEach': ('studentTTest', 'ForEach'), 'quantilesTDigestWeightedForEach': ('quantilesTDigestWeighted', 'ForEach'), 'sequenceMatchForEach': ('sequenceMatch', 'ForEach'), 'mannWhitneyUTestForEach': ('mannWhitneyUTest', 'ForEach'), 'uniqExactForEach': ('uniqExact', 'ForEach'), 'last_valueForEach': ('last_value', 'ForEach'), 'quantilesInterpolatedWeightedForEach': ('quantilesInterpolatedWeighted', 'ForEach'), 'kurtPopForEach': ('kurtPop', 'ForEach'), 'argMinForEach': ('argMin', 'ForEach'), 'exponentialTimeDecayedAvgForEach': ('exponentialTimeDecayedAvg', 'ForEach'), 'covarSampForEach': ('covarSamp', 'ForEach'), 'groupBitXorForEach': ('groupBitXor', 'ForEach'), 'groupBitOrForEach': ('groupBitOr', 'ForEach'), 'maxIntersectionsForEach': ('maxIntersections', 'ForEach'), 'quantileExactLowForEach': ('quantileExactLow', 'ForEach'), 'quantilesBFloat16WeightedForEach': ('quantilesBFloat16Weighted', 'ForEach'), 'groupBitAndForEach': ('groupBitAnd', 'ForEach'), 'quantilesExactHighForEach': ('quantilesExactHigh', 'ForEach'), 'quantileTDigestWeightedForEach': ('quantileTDigestWeighted', 'ForEach'), 'countForEach': ('count', 'ForEach'), 'groupUniqArrayForEach': ('groupUniqArray', 'ForEach'), 'minForEach': ('min', 'ForEach'), 'sparkBarForEach': ('sparkBar', 'ForEach'), 'windowFunnelForEach': ('windowFunnel', 'ForEach'), 'stochasticLogisticRegressionForEach': ('stochasticLogisticRegression', 'ForEach'), 'kolmogorovSmirnovTestForEach': ('kolmogorovSmirnovTest', 'ForEach'), 'maxIntersectionsPositionForEach': ('maxIntersectionsPosition', 'ForEach'), 'quantileBFloat16ForEach': ('quantileBFloat16', 'ForEach'), 'quantilesTimingForEach': ('quantilesTiming', 'ForEach'), 'quantileTimingForEach': ('quantileTiming', 'ForEach'), 'groupArrayInsertAtForEach': ('groupArrayInsertAt', 'ForEach'), 'welchTTestForEach': ('welchTTest', 'ForEach'), 'sumMapForEach': ('sumMap', 'ForEach'), 'quantilesDeterministicForEach': ('quantilesDeterministic', 'ForEach'), 'sumForEach': ('sum', 'ForEach'), 'uniqUpToForEach': ('uniqUpTo', 'ForEach'), 'stochasticLinearRegressionForEach': ('stochasticLinearRegression', 'ForEach'), 'contingencyForEach': ('contingency', 'ForEach'), 'minMapForEach': ('minMap', 'ForEach'), 'largestTriangleThreeBucketsForEach': ('largestTriangleThreeBuckets', 'ForEach'), 'anyLastForEach': ('anyLast', 'ForEach'), 'quantileTimingWeightedForEach': ('quantileTimingWeighted', 'ForEach'), 'skewPopForEach': ('skewPop', 'ForEach'), 'uniqHLL12ForEach': ('uniqHLL12', 'ForEach'), 'quantilesExactForEach': ('quantilesExact', 'ForEach'), 'quantileTDigestForEach': ('quantileTDigest', 'ForEach'), 'deltaSumForEach': ('deltaSum', 'ForEach'), 'entropyForEach': ('entropy', 'ForEach'), 'groupBitmapAndForEach': ('groupBitmapAnd', 'ForEach'), 'maxMapForEach': ('maxMap', 'ForEach'), 'quantileForEach': ('quantile', 'ForEach'), 'groupArrayForEach': ('groupArray', 'ForEach'), 'stddevSampForEach': ('stddevSamp', 'ForEach'), 'uniqForEach': ('uniq', 'ForEach'), 'intervalLengthSumForEach': ('intervalLengthSum', 'ForEach'), 'medianForEach': ('median', 'ForEach'), 'varPopForEach': ('varPop', 'ForEach'), 'quantileExactForEach': ('quantileExact', 'ForEach'), 'quantileDeterministicForEach': ('quantileDeterministic', 'ForEach'), 'stddevPopForEach': ('stddevPop', 'ForEach'), 'exponentialMovingAverageDistinct': ('exponentialMovingAverage', 'Distinct'), 'quantilesDistinct': ('quantiles', 'Distinct'), 'cramersVDistinct': ('cramersV', 'Distinct'), 'quantilesTimingWeightedDistinct': ('quantilesTimingWeighted', 'Distinct'), 'sumWithOverflowDistinct': ('sumWithOverflow', 'Distinct'), 'retentionDistinct': ('retention', 'Distinct'), 'rankCorrDistinct': ('rankCorr', 'Distinct'), 'quantilesExactWeightedDistinct': ('quantilesExactWeighted', 'Distinct'), 'groupBitmapXorDistinct': ('groupBitmapXor', 'Distinct'), 'skewSampDistinct': ('skewSamp', 'Distinct'), 'covarPopDistinct': ('covarPop', 'Distinct'), 'groupArrayMovingSumDistinct': ('groupArrayMovingSum', 'Distinct'), 'uniqCombinedDistinct': ('uniqCombined', 'Distinct'), 'sumCountDistinct': ('sumCount', 'Distinct'), 'groupBitmapDistinct': ('groupBitmap', 'Distinct'), 'cramersVBiasCorrectedDistinct': ('cramersVBiasCorrected', 'Distinct'), 'uniqThetaDistinct': ('uniqTheta', 'Distinct'), 'quantileExactWeightedDistinct': ('quantileExactWeighted', 'Distinct'), 'groupArrayMovingAvgDistinct': ('groupArrayMovingAvg', 'Distinct'), 'quantileGKDistinct': ('quantileGK', 'Distinct'), 'quantilesExactLowDistinct': ('quantilesExactLow', 'Distinct'), 'sequenceNextNodeDistinct': ('sequenceNextNode', 'Distinct'), 'simpleLinearRegressionDistinct': ('simpleLinearRegression', 'Distinct'), 'quantileBFloat16WeightedDistinct': ('quantileBFloat16Weighted', 'Distinct'), 'avgDistinct': ('avg', 'Distinct'), 'kurtSampDistinct': ('kurtSamp', 'Distinct'), 'avgWeightedDistinct': ('avgWeighted', 'Distinct'), 'maxDistinct': ('max', 'Distinct'), 'histogramDistinct': ('histogram', 'Distinct'), 'quantilesBFloat16Distinct': ('quantilesBFloat16', 'Distinct'), 'varSampDistinct': ('varSamp', 'Distinct'), 'sequenceCountDistinct': ('sequenceCount', 'Distinct'), 'anyDistinct': ('any', 'Distinct'), 'categoricalInformationValueDistinct': ('categoricalInformationValue', 'Distinct'), 'topKWeightedDistinct': ('topKWeighted', 'Distinct'), 'groupArrayLastDistinct': ('groupArrayLast', 'Distinct'), 'corrDistinct': ('corr', 'Distinct'), 'sumKahanDistinct': ('sumKahan', 'Distinct'), 'boundingRatioDistinct': ('boundingRatio', 'Distinct'), 'meanZTestDistinct': ('meanZTest', 'Distinct'), 'quantilesGKDistinct': ('quantilesGK', 'Distinct'), 'groupBitmapOrDistinct': ('groupBitmapOr', 'Distinct'), 'first_valueDistinct': ('first_value', 'Distinct'), 'argMaxDistinct': ('argMax', 'Distinct'), 'groupArraySampleDistinct': ('groupArraySample', 'Distinct'), 'anyHeavyDistinct': ('anyHeavy', 'Distinct'), 'quantilesTDigestDistinct': ('quantilesTDigest', 'Distinct'), 'deltaSumTimestampDistinct': ('deltaSumTimestamp', 'Distinct'), 'quantileExactHighDistinct': ('quantileExactHigh', 'Distinct'), 'topKDistinct': ('topK', 'Distinct'), 'theilsUDistinct': ('theilsU', 'Distinct'), 'quantileInterpolatedWeightedDistinct': ('quantileInterpolatedWeighted', 'Distinct'), 'uniqCombined64Distinct': ('uniqCombined64', 'Distinct'), 'studentTTestDistinct': ('studentTTest', 'Distinct'), 'quantilesTDigestWeightedDistinct': ('quantilesTDigestWeighted', 'Distinct'), 'sequenceMatchDistinct': ('sequenceMatch', 'Distinct'), 'mannWhitneyUTestDistinct': ('mannWhitneyUTest', 'Distinct'), 'uniqExactDistinct': ('uniqExact', 'Distinct'), 'last_valueDistinct': ('last_value', 'Distinct'), 'quantilesInterpolatedWeightedDistinct': ('quantilesInterpolatedWeighted', 'Distinct'), 'kurtPopDistinct': ('kurtPop', 'Distinct'), 'argMinDistinct': ('argMin', 'Distinct'), 'exponentialTimeDecayedAvgDistinct': ('exponentialTimeDecayedAvg', 'Distinct'), 'covarSampDistinct': ('covarSamp', 'Distinct'), 'groupBitXorDistinct': ('groupBitXor', 'Distinct'), 'groupBitOrDistinct': ('groupBitOr', 'Distinct'), 'maxIntersectionsDistinct': ('maxIntersections', 'Distinct'), 'quantileExactLowDistinct': ('quantileExactLow', 'Distinct'), 'quantilesBFloat16WeightedDistinct': ('quantilesBFloat16Weighted', 'Distinct'), 'groupBitAndDistinct': ('groupBitAnd', 'Distinct'), 'quantilesExactHighDistinct': ('quantilesExactHigh', 'Distinct'), 'quantileTDigestWeightedDistinct': ('quantileTDigestWeighted', 'Distinct'), 'countDistinct': ('count', 'Distinct'), 'groupUniqArrayDistinct': ('groupUniqArray', 'Distinct'), 'minDistinct': ('min', 'Distinct'), 'sparkBarDistinct': ('sparkBar', 'Distinct'), 'windowFunnelDistinct': ('windowFunnel', 'Distinct'), 'stochasticLogisticRegressionDistinct': ('stochasticLogisticRegression', 'Distinct'), 'kolmogorovSmirnovTestDistinct': ('kolmogorovSmirnovTest', 'Distinct'), 'maxIntersectionsPositionDistinct': ('maxIntersectionsPosition', 'Distinct'), 'quantileBFloat16Distinct': ('quantileBFloat16', 'Distinct'), 'quantilesTimingDistinct': ('quantilesTiming', 'Distinct'), 'quantileTimingDistinct': ('quantileTiming', 'Distinct'), 'groupArrayInsertAtDistinct': ('groupArrayInsertAt', 'Distinct'), 'welchTTestDistinct': ('welchTTest', 'Distinct'), 'sumMapDistinct': ('sumMap', 'Distinct'), 'quantilesDeterministicDistinct': ('quantilesDeterministic', 'Distinct'), 'sumDistinct': ('sum', 'Distinct'), 'uniqUpToDistinct': ('uniqUpTo', 'Distinct'), 'stochasticLinearRegressionDistinct': ('stochasticLinearRegression', 'Distinct'), 'contingencyDistinct': ('contingency', 'Distinct'), 'minMapDistinct': ('minMap', 'Distinct'), 'largestTriangleThreeBucketsDistinct': ('largestTriangleThreeBuckets', 'Distinct'), 'anyLastDistinct': ('anyLast', 'Distinct'), 'quantileTimingWeightedDistinct': ('quantileTimingWeighted', 'Distinct'), 'skewPopDistinct': ('skewPop', 'Distinct'), 'uniqHLL12Distinct': ('uniqHLL12', 'Distinct'), 'quantilesExactDistinct': ('quantilesExact', 'Distinct'), 'quantileTDigestDistinct': ('quantileTDigest', 'Distinct'), 'deltaSumDistinct': ('deltaSum', 'Distinct'), 'entropyDistinct': ('entropy', 'Distinct'), 'groupBitmapAndDistinct': ('groupBitmapAnd', 'Distinct'), 'maxMapDistinct': ('maxMap', 'Distinct'), 'quantileDistinct': ('quantile', 'Distinct'), 'groupArrayDistinct': ('groupArray', 'Distinct'), 'stddevSampDistinct': ('stddevSamp', 'Distinct'), 'uniqDistinct': ('uniq', 'Distinct'), 'intervalLengthSumDistinct': ('intervalLengthSum', 'Distinct'), 'medianDistinct': ('median', 'Distinct'), 'varPopDistinct': ('varPop', 'Distinct'), 'quantileExactDistinct': ('quantileExact', 'Distinct'), 'quantileDeterministicDistinct': ('quantileDeterministic', 'Distinct'), 'stddevPopDistinct': ('stddevPop', 'Distinct'), 'exponentialMovingAverageOrDefault': ('exponentialMovingAverage', 'OrDefault'), 'quantilesOrDefault': ('quantiles', 'OrDefault'), 'cramersVOrDefault': ('cramersV', 'OrDefault'), 'quantilesTimingWeightedOrDefault': ('quantilesTimingWeighted', 'OrDefault'), 'sumWithOverflowOrDefault': ('sumWithOverflow', 'OrDefault'), 'retentionOrDefault': ('retention', 'OrDefault'), 'rankCorrOrDefault': ('rankCorr', 'OrDefault'), 'quantilesExactWeightedOrDefault': ('quantilesExactWeighted', 'OrDefault'), 'groupBitmapXorOrDefault': ('groupBitmapXor', 'OrDefault'), 'skewSampOrDefault': ('skewSamp', 'OrDefault'), 'covarPopOrDefault': ('covarPop', 'OrDefault'), 'groupArrayMovingSumOrDefault': ('groupArrayMovingSum', 'OrDefault'), 'uniqCombinedOrDefault': ('uniqCombined', 'OrDefault'), 'sumCountOrDefault': ('sumCount', 'OrDefault'), 'groupBitmapOrDefault': ('groupBitmap', 'OrDefault'), 'cramersVBiasCorrectedOrDefault': ('cramersVBiasCorrected', 'OrDefault'), 'uniqThetaOrDefault': ('uniqTheta', 'OrDefault'), 'quantileExactWeightedOrDefault': ('quantileExactWeighted', 'OrDefault'), 'groupArrayMovingAvgOrDefault': ('groupArrayMovingAvg', 'OrDefault'), 'quantileGKOrDefault': ('quantileGK', 'OrDefault'), 'quantilesExactLowOrDefault': ('quantilesExactLow', 'OrDefault'), 'sequenceNextNodeOrDefault': ('sequenceNextNode', 'OrDefault'), 'simpleLinearRegressionOrDefault': ('simpleLinearRegression', 'OrDefault'), 'quantileBFloat16WeightedOrDefault': ('quantileBFloat16Weighted', 'OrDefault'), 'avgOrDefault': ('avg', 'OrDefault'), 'kurtSampOrDefault': ('kurtSamp', 'OrDefault'), 'avgWeightedOrDefault': ('avgWeighted', 'OrDefault'), 'maxOrDefault': ('max', 'OrDefault'), 'histogramOrDefault': ('histogram', 'OrDefault'), 'quantilesBFloat16OrDefault': ('quantilesBFloat16', 'OrDefault'), 'varSampOrDefault': ('varSamp', 'OrDefault'), 'sequenceCountOrDefault': ('sequenceCount', 'OrDefault'), 'anyOrDefault': ('any', 'OrDefault'), 'categoricalInformationValueOrDefault': ('categoricalInformationValue', 'OrDefault'), 'topKWeightedOrDefault': ('topKWeighted', 'OrDefault'), 'groupArrayLastOrDefault': ('groupArrayLast', 'OrDefault'), 'corrOrDefault': ('corr', 'OrDefault'), 'sumKahanOrDefault': ('sumKahan', 'OrDefault'), 'boundingRatioOrDefault': ('boundingRatio', 'OrDefault'), 'meanZTestOrDefault': ('meanZTest', 'OrDefault'), 'quantilesGKOrDefault': ('quantilesGK', 'OrDefault'), 'groupBitmapOrOrDefault': ('groupBitmapOr', 'OrDefault'), 'first_valueOrDefault': ('first_value', 'OrDefault'), 'argMaxOrDefault': ('argMax', 'OrDefault'), 'groupArraySampleOrDefault': ('groupArraySample', 'OrDefault'), 'anyHeavyOrDefault': ('anyHeavy', 'OrDefault'), 'quantilesTDigestOrDefault': ('quantilesTDigest', 'OrDefault'), 'deltaSumTimestampOrDefault': ('deltaSumTimestamp', 'OrDefault'), 'quantileExactHighOrDefault': ('quantileExactHigh', 'OrDefault'), 'topKOrDefault': ('topK', 'OrDefault'), 'theilsUOrDefault': ('theilsU', 'OrDefault'), 'quantileInterpolatedWeightedOrDefault': ('quantileInterpolatedWeighted', 'OrDefault'), 'uniqCombined64OrDefault': ('uniqCombined64', 'OrDefault'), 'studentTTestOrDefault': ('studentTTest', 'OrDefault'), 'quantilesTDigestWeightedOrDefault': ('quantilesTDigestWeighted', 'OrDefault'), 'sequenceMatchOrDefault': ('sequenceMatch', 'OrDefault'), 'mannWhitneyUTestOrDefault': ('mannWhitneyUTest', 'OrDefault'), 'uniqExactOrDefault': ('uniqExact', 'OrDefault'), 'last_valueOrDefault': ('last_value', 'OrDefault'), 'quantilesInterpolatedWeightedOrDefault': ('quantilesInterpolatedWeighted', 'OrDefault'), 'kurtPopOrDefault': ('kurtPop', 'OrDefault'), 'argMinOrDefault': ('argMin', 'OrDefault'), 'exponentialTimeDecayedAvgOrDefault': ('exponentialTimeDecayedAvg', 'OrDefault'), 'covarSampOrDefault': ('covarSamp', 'OrDefault'), 'groupBitXorOrDefault': ('groupBitXor', 'OrDefault'), 'groupBitOrOrDefault': ('groupBitOr', 'OrDefault'), 'maxIntersectionsOrDefault': ('maxIntersections', 'OrDefault'), 'quantileExactLowOrDefault': ('quantileExactLow', 'OrDefault'), 'quantilesBFloat16WeightedOrDefault': ('quantilesBFloat16Weighted', 'OrDefault'), 'groupBitAndOrDefault': ('groupBitAnd', 'OrDefault'), 'quantilesExactHighOrDefault': ('quantilesExactHigh', 'OrDefault'), 'quantileTDigestWeightedOrDefault': ('quantileTDigestWeighted', 'OrDefault'), 'countOrDefault': ('count', 'OrDefault'), 'groupUniqArrayOrDefault': ('groupUniqArray', 'OrDefault'), 'minOrDefault': ('min', 'OrDefault'), 'sparkBarOrDefault': ('sparkBar', 'OrDefault'), 'windowFunnelOrDefault': ('windowFunnel', 'OrDefault'), 'stochasticLogisticRegressionOrDefault': ('stochasticLogisticRegression', 'OrDefault'), 'kolmogorovSmirnovTestOrDefault': ('kolmogorovSmirnovTest', 'OrDefault'), 'maxIntersectionsPositionOrDefault': ('maxIntersectionsPosition', 'OrDefault'), 'quantileBFloat16OrDefault': ('quantileBFloat16', 'OrDefault'), 'quantilesTimingOrDefault': ('quantilesTiming', 'OrDefault'), 'quantileTimingOrDefault': ('quantileTiming', 'OrDefault'), 'groupArrayInsertAtOrDefault': ('groupArrayInsertAt', 'OrDefault'), 'welchTTestOrDefault': ('welchTTest', 'OrDefault'), 'sumMapOrDefault': ('sumMap', 'OrDefault'), 'quantilesDeterministicOrDefault': ('quantilesDeterministic', 'OrDefault'), 'sumOrDefault': ('sum', 'OrDefault'), 'uniqUpToOrDefault': ('uniqUpTo', 'OrDefault'), 'stochasticLinearRegressionOrDefault': ('stochasticLinearRegression', 'OrDefault'), 'contingencyOrDefault': ('contingency', 'OrDefault'), 'minMapOrDefault': ('minMap', 'OrDefault'), 'largestTriangleThreeBucketsOrDefault': ('largestTriangleThreeBuckets', 'OrDefault'), 'anyLastOrDefault': ('anyLast', 'OrDefault'), 'quantileTimingWeightedOrDefault': ('quantileTimingWeighted', 'OrDefault'), 'skewPopOrDefault': ('skewPop', 'OrDefault'), 'uniqHLL12OrDefault': ('uniqHLL12', 'OrDefault'), 'quantilesExactOrDefault': ('quantilesExact', 'OrDefault'), 'quantileTDigestOrDefault': ('quantileTDigest', 'OrDefault'), 'deltaSumOrDefault': ('deltaSum', 'OrDefault'), 'entropyOrDefault': ('entropy', 'OrDefault'), 'groupBitmapAndOrDefault': ('groupBitmapAnd', 'OrDefault'), 'maxMapOrDefault': ('maxMap', 'OrDefault'), 'quantileOrDefault': ('quantile', 'OrDefault'), 'groupArrayOrDefault': ('groupArray', 'OrDefault'), 'stddevSampOrDefault': ('stddevSamp', 'OrDefault'), 'uniqOrDefault': ('uniq', 'OrDefault'), 'intervalLengthSumOrDefault': ('intervalLengthSum', 'OrDefault'), 'medianOrDefault': ('median', 'OrDefault'), 'varPopOrDefault': ('varPop', 'OrDefault'), 'quantileExactOrDefault': ('quantileExact', 'OrDefault'), 'quantileDeterministicOrDefault': ('quantileDeterministic', 'OrDefault'), 'stddevPopOrDefault': ('stddevPop', 'OrDefault'), 'exponentialMovingAverageOrNull': ('exponentialMovingAverage', 'OrNull'), 'quantilesOrNull': ('quantiles', 'OrNull'), 'cramersVOrNull': ('cramersV', 'OrNull'), 'quantilesTimingWeightedOrNull': ('quantilesTimingWeighted', 'OrNull'), 'sumWithOverflowOrNull': ('sumWithOverflow', 'OrNull'), 'retentionOrNull': ('retention', 'OrNull'), 'rankCorrOrNull': ('rankCorr', 'OrNull'), 'quantilesExactWeightedOrNull': ('quantilesExactWeighted', 'OrNull'), 'groupBitmapXorOrNull': ('groupBitmapXor', 'OrNull'), 'skewSampOrNull': ('skewSamp', 'OrNull'), 'covarPopOrNull': ('covarPop', 'OrNull'), 'groupArrayMovingSumOrNull': ('groupArrayMovingSum', 'OrNull'), 'uniqCombinedOrNull': ('uniqCombined', 'OrNull'), 'sumCountOrNull': ('sumCount', 'OrNull'), 'groupBitmapOrNull': ('groupBitmap', 'OrNull'), 'cramersVBiasCorrectedOrNull': ('cramersVBiasCorrected', 'OrNull'), 'uniqThetaOrNull': ('uniqTheta', 'OrNull'), 'quantileExactWeightedOrNull': ('quantileExactWeighted', 'OrNull'), 'groupArrayMovingAvgOrNull': ('groupArrayMovingAvg', 'OrNull'), 'quantileGKOrNull': ('quantileGK', 'OrNull'), 'quantilesExactLowOrNull': ('quantilesExactLow', 'OrNull'), 'sequenceNextNodeOrNull': ('sequenceNextNode', 'OrNull'), 'simpleLinearRegressionOrNull': ('simpleLinearRegression', 'OrNull'), 'quantileBFloat16WeightedOrNull': ('quantileBFloat16Weighted', 'OrNull'), 'avgOrNull': ('avg', 'OrNull'), 'kurtSampOrNull': ('kurtSamp', 'OrNull'), 'avgWeightedOrNull': ('avgWeighted', 'OrNull'), 'maxOrNull': ('max', 'OrNull'), 'histogramOrNull': ('histogram', 'OrNull'), 'quantilesBFloat16OrNull': ('quantilesBFloat16', 'OrNull'), 'varSampOrNull': ('varSamp', 'OrNull'), 'sequenceCountOrNull': ('sequenceCount', 'OrNull'), 'anyOrNull': ('any', 'OrNull'), 'categoricalInformationValueOrNull': ('categoricalInformationValue', 'OrNull'), 'topKWeightedOrNull': ('topKWeighted', 'OrNull'), 'groupArrayLastOrNull': ('groupArrayLast', 'OrNull'), 'corrOrNull': ('corr', 'OrNull'), 'sumKahanOrNull': ('sumKahan', 'OrNull'), 'boundingRatioOrNull': ('boundingRatio', 'OrNull'), 'meanZTestOrNull': ('meanZTest', 'OrNull'), 'quantilesGKOrNull': ('quantilesGK', 'OrNull'), 'groupBitmapOrOrNull': ('groupBitmapOr', 'OrNull'), 'first_valueOrNull': ('first_value', 'OrNull'), 'argMaxOrNull': ('argMax', 'OrNull'), 'groupArraySampleOrNull': ('groupArraySample', 'OrNull'), 'anyHeavyOrNull': ('anyHeavy', 'OrNull'), 'quantilesTDigestOrNull': ('quantilesTDigest', 'OrNull'), 'deltaSumTimestampOrNull': ('deltaSumTimestamp', 'OrNull'), 'quantileExactHighOrNull': ('quantileExactHigh', 'OrNull'), 'topKOrNull': ('topK', 'OrNull'), 'theilsUOrNull': ('theilsU', 'OrNull'), 'quantileInterpolatedWeightedOrNull': ('quantileInterpolatedWeighted', 'OrNull'), 'uniqCombined64OrNull': ('uniqCombined64', 'OrNull'), 'studentTTestOrNull': ('studentTTest', 'OrNull'), 'quantilesTDigestWeightedOrNull': ('quantilesTDigestWeighted', 'OrNull'), 'sequenceMatchOrNull': ('sequenceMatch', 'OrNull'), 'mannWhitneyUTestOrNull': ('mannWhitneyUTest', 'OrNull'), 'uniqExactOrNull': ('uniqExact', 'OrNull'), 'last_valueOrNull': ('last_value', 'OrNull'), 'quantilesInterpolatedWeightedOrNull': ('quantilesInterpolatedWeighted', 'OrNull'), 'kurtPopOrNull': ('kurtPop', 'OrNull'), 'argMinOrNull': ('argMin', 'OrNull'), 'exponentialTimeDecayedAvgOrNull': ('exponentialTimeDecayedAvg', 'OrNull'), 'covarSampOrNull': ('covarSamp', 'OrNull'), 'groupBitXorOrNull': ('groupBitXor', 'OrNull'), 'groupBitOrOrNull': ('groupBitOr', 'OrNull'), 'maxIntersectionsOrNull': ('maxIntersections', 'OrNull'), 'quantileExactLowOrNull': ('quantileExactLow', 'OrNull'), 'quantilesBFloat16WeightedOrNull': ('quantilesBFloat16Weighted', 'OrNull'), 'groupBitAndOrNull': ('groupBitAnd', 'OrNull'), 'quantilesExactHighOrNull': ('quantilesExactHigh', 'OrNull'), 'quantileTDigestWeightedOrNull': ('quantileTDigestWeighted', 'OrNull'), 'countOrNull': ('count', 'OrNull'), 'groupUniqArrayOrNull': ('groupUniqArray', 'OrNull'), 'minOrNull': ('min', 'OrNull'), 'sparkBarOrNull': ('sparkBar', 'OrNull'), 'windowFunnelOrNull': ('windowFunnel', 'OrNull'), 'stochasticLogisticRegressionOrNull': ('stochasticLogisticRegression', 'OrNull'), 'kolmogorovSmirnovTestOrNull': ('kolmogorovSmirnovTest', 'OrNull'), 'maxIntersectionsPositionOrNull': ('maxIntersectionsPosition', 'OrNull'), 'quantileBFloat16OrNull': ('quantileBFloat16', 'OrNull'), 'quantilesTimingOrNull': ('quantilesTiming', 'OrNull'), 'quantileTimingOrNull': ('quantileTiming', 'OrNull'), 'groupArrayInsertAtOrNull': ('groupArrayInsertAt', 'OrNull'), 'welchTTestOrNull': ('welchTTest', 'OrNull'), 'sumMapOrNull': ('sumMap', 'OrNull'), 'quantilesDeterministicOrNull': ('quantilesDeterministic', 'OrNull'), 'sumOrNull': ('sum', 'OrNull'), 'uniqUpToOrNull': ('uniqUpTo', 'OrNull'), 'stochasticLinearRegressionOrNull': ('stochasticLinearRegression', 'OrNull'), 'contingencyOrNull': ('contingency', 'OrNull'), 'minMapOrNull': ('minMap', 'OrNull'), 'largestTriangleThreeBucketsOrNull': ('largestTriangleThreeBuckets', 'OrNull'), 'anyLastOrNull': ('anyLast', 'OrNull'), 'quantileTimingWeightedOrNull': ('quantileTimingWeighted', 'OrNull'), 'skewPopOrNull': ('skewPop', 'OrNull'), 'uniqHLL12OrNull': ('uniqHLL12', 'OrNull'), 'quantilesExactOrNull': ('quantilesExact', 'OrNull'), 'quantileTDigestOrNull': ('quantileTDigest', 'OrNull'), 'deltaSumOrNull': ('deltaSum', 'OrNull'), 'entropyOrNull': ('entropy', 'OrNull'), 'groupBitmapAndOrNull': ('groupBitmapAnd', 'OrNull'), 'maxMapOrNull': ('maxMap', 'OrNull'), 'quantileOrNull': ('quantile', 'OrNull'), 'groupArrayOrNull': ('groupArray', 'OrNull'), 'stddevSampOrNull': ('stddevSamp', 'OrNull'), 'uniqOrNull': ('uniq', 'OrNull'), 'intervalLengthSumOrNull': ('intervalLengthSum', 'OrNull'), 'medianOrNull': ('median', 'OrNull'), 'varPopOrNull': ('varPop', 'OrNull'), 'quantileExactOrNull': ('quantileExact', 'OrNull'), 'quantileDeterministicOrNull': ('quantileDeterministic', 'OrNull'), 'stddevPopOrNull': ('stddevPop', 'OrNull'), 'exponentialMovingAverageResample': ('exponentialMovingAverage', 'Resample'), 'quantilesResample': ('quantiles', 'Resample'), 'cramersVResample': ('cramersV', 'Resample'), 'quantilesTimingWeightedResample': ('quantilesTimingWeighted', 'Resample'), 'sumWithOverflowResample': ('sumWithOverflow', 'Resample'), 'retentionResample': ('retention', 'Resample'), 'rankCorrResample': ('rankCorr', 'Resample'), 'quantilesExactWeightedResample': ('quantilesExactWeighted', 'Resample'), 'groupBitmapXorResample': ('groupBitmapXor', 'Resample'), 'skewSampResample': ('skewSamp', 'Resample'), 'covarPopResample': ('covarPop', 'Resample'), 'groupArrayMovingSumResample': ('groupArrayMovingSum', 'Resample'), 'uniqCombinedResample': ('uniqCombined', 'Resample'), 'sumCountResample': ('sumCount', 'Resample'), 'groupBitmapResample': ('groupBitmap', 'Resample'), 'cramersVBiasCorrectedResample': ('cramersVBiasCorrected', 'Resample'), 'uniqThetaResample': ('uniqTheta', 'Resample'), 'quantileExactWeightedResample': ('quantileExactWeighted', 'Resample'), 'groupArrayMovingAvgResample': ('groupArrayMovingAvg', 'Resample'), 'quantileGKResample': ('quantileGK', 'Resample'), 'quantilesExactLowResample': ('quantilesExactLow', 'Resample'), 'sequenceNextNodeResample': ('sequenceNextNode', 'Resample'), 'simpleLinearRegressionResample': ('simpleLinearRegression', 'Resample'), 'quantileBFloat16WeightedResample': ('quantileBFloat16Weighted', 'Resample'), 'avgResample': ('avg', 'Resample'), 'kurtSampResample': ('kurtSamp', 'Resample'), 'avgWeightedResample': ('avgWeighted', 'Resample'), 'maxResample': ('max', 'Resample'), 'histogramResample': ('histogram', 'Resample'), 'quantilesBFloat16Resample': ('quantilesBFloat16', 'Resample'), 'varSampResample': ('varSamp', 'Resample'), 'sequenceCountResample': ('sequenceCount', 'Resample'), 'anyResample': ('any', 'Resample'), 'categoricalInformationValueResample': ('categoricalInformationValue', 'Resample'), 'topKWeightedResample': ('topKWeighted', 'Resample'), 'groupArrayLastResample': ('groupArrayLast', 'Resample'), 'corrResample': ('corr', 'Resample'), 'sumKahanResample': ('sumKahan', 'Resample'), 'boundingRatioResample': ('boundingRatio', 'Resample'), 'meanZTestResample': ('meanZTest', 'Resample'), 'quantilesGKResample': ('quantilesGK', 'Resample'), 'groupBitmapOrResample': ('groupBitmapOr', 'Resample'), 'first_valueResample': ('first_value', 'Resample'), 'argMaxResample': ('argMax', 'Resample'), 'groupArraySampleResample': ('groupArraySample', 'Resample'), 'anyHeavyResample': ('anyHeavy', 'Resample'), 'quantilesTDigestResample': ('quantilesTDigest', 'Resample'), 'deltaSumTimestampResample': ('deltaSumTimestamp', 'Resample'), 'quantileExactHighResample': ('quantileExactHigh', 'Resample'), 'topKResample': ('topK', 'Resample'), 'theilsUResample': ('theilsU', 'Resample'), 'quantileInterpolatedWeightedResample': ('quantileInterpolatedWeighted', 'Resample'), 'uniqCombined64Resample': ('uniqCombined64', 'Resample'), 'studentTTestResample': ('studentTTest', 'Resample'), 'quantilesTDigestWeightedResample': ('quantilesTDigestWeighted', 'Resample'), 'sequenceMatchResample': ('sequenceMatch', 'Resample'), 'mannWhitneyUTestResample': ('mannWhitneyUTest', 'Resample'), 'uniqExactResample': ('uniqExact', 'Resample'), 'last_valueResample': ('last_value', 'Resample'), 'quantilesInterpolatedWeightedResample': ('quantilesInterpolatedWeighted', 'Resample'), 'kurtPopResample': ('kurtPop', 'Resample'), 'argMinResample': ('argMin', 'Resample'), 'exponentialTimeDecayedAvgResample': ('exponentialTimeDecayedAvg', 'Resample'), 'covarSampResample': ('covarSamp', 'Resample'), 'groupBitXorResample': ('groupBitXor', 'Resample'), 'groupBitOrResample': ('groupBitOr', 'Resample'), 'maxIntersectionsResample': ('maxIntersections', 'Resample'), 'quantileExactLowResample': ('quantileExactLow', 'Resample'), 'quantilesBFloat16WeightedResample': ('quantilesBFloat16Weighted', 'Resample'), 'groupBitAndResample': ('groupBitAnd', 'Resample'), 'quantilesExactHighResample': ('quantilesExactHigh', 'Resample'), 'quantileTDigestWeightedResample': ('quantileTDigestWeighted', 'Resample'), 'countResample': ('count', 'Resample'), 'groupUniqArrayResample': ('groupUniqArray', 'Resample'), 'minResample': ('min', 'Resample'), 'sparkBarResample': ('sparkBar', 'Resample'), 'windowFunnelResample': ('windowFunnel', 'Resample'), 'stochasticLogisticRegressionResample': ('stochasticLogisticRegression', 'Resample'), 'kolmogorovSmirnovTestResample': ('kolmogorovSmirnovTest', 'Resample'), 'maxIntersectionsPositionResample': ('maxIntersectionsPosition', 'Resample'), 'quantileBFloat16Resample': ('quantileBFloat16', 'Resample'), 'quantilesTimingResample': ('quantilesTiming', 'Resample'), 'quantileTimingResample': ('quantileTiming', 'Resample'), 'groupArrayInsertAtResample': ('groupArrayInsertAt', 'Resample'), 'welchTTestResample': ('welchTTest', 'Resample'), 'sumMapResample': ('sumMap', 'Resample'), 'quantilesDeterministicResample': ('quantilesDeterministic', 'Resample'), 'sumResample': ('sum', 'Resample'), 'uniqUpToResample': ('uniqUpTo', 'Resample'), 'stochasticLinearRegressionResample': ('stochasticLinearRegression', 'Resample'), 'contingencyResample': ('contingency', 'Resample'), 'minMapResample': ('minMap', 'Resample'), 'largestTriangleThreeBucketsResample': ('largestTriangleThreeBuckets', 'Resample'), 'anyLastResample': ('anyLast', 'Resample'), 'quantileTimingWeightedResample': ('quantileTimingWeighted', 'Resample'), 'skewPopResample': ('skewPop', 'Resample'), 'uniqHLL12Resample': ('uniqHLL12', 'Resample'), 'quantilesExactResample': ('quantilesExact', 'Resample'), 'quantileTDigestResample': ('quantileTDigest', 'Resample'), 'deltaSumResample': ('deltaSum', 'Resample'), 'entropyResample': ('entropy', 'Resample'), 'groupBitmapAndResample': ('groupBitmapAnd', 'Resample'), 'maxMapResample': ('maxMap', 'Resample'), 'quantileResample': ('quantile', 'Resample'), 'groupArrayResample': ('groupArray', 'Resample'), 'stddevSampResample': ('stddevSamp', 'Resample'), 'uniqResample': ('uniq', 'Resample'), 'intervalLengthSumResample': ('intervalLengthSum', 'Resample'), 'medianResample': ('median', 'Resample'), 'varPopResample': ('varPop', 'Resample'), 'quantileExactResample': ('quantileExact', 'Resample'), 'quantileDeterministicResample': ('quantileDeterministic', 'Resample'), 'stddevPopResample': ('stddevPop', 'Resample'), 'exponentialMovingAverageArgMin': ('exponentialMovingAverage', 'ArgMin'), 'quantilesArgMin': ('quantiles', 'ArgMin'), 'cramersVArgMin': ('cramersV', 'ArgMin'), 'quantilesTimingWeightedArgMin': ('quantilesTimingWeighted', 'ArgMin'), 'sumWithOverflowArgMin': ('sumWithOverflow', 'ArgMin'), 'retentionArgMin': ('retention', 'ArgMin'), 'rankCorrArgMin': ('rankCorr', 'ArgMin'), 'quantilesExactWeightedArgMin': ('quantilesExactWeighted', 'ArgMin'), 'groupBitmapXorArgMin': ('groupBitmapXor', 'ArgMin'), 'skewSampArgMin': ('skewSamp', 'ArgMin'), 'covarPopArgMin': ('covarPop', 'ArgMin'), 'groupArrayMovingSumArgMin': ('groupArrayMovingSum', 'ArgMin'), 'uniqCombinedArgMin': ('uniqCombined', 'ArgMin'), 'sumCountArgMin': ('sumCount', 'ArgMin'), 'groupBitmapArgMin': ('groupBitmap', 'ArgMin'), 'cramersVBiasCorrectedArgMin': ('cramersVBiasCorrected', 'ArgMin'), 'uniqThetaArgMin': ('uniqTheta', 'ArgMin'), 'quantileExactWeightedArgMin': ('quantileExactWeighted', 'ArgMin'), 'groupArrayMovingAvgArgMin': ('groupArrayMovingAvg', 'ArgMin'), 'quantileGKArgMin': ('quantileGK', 'ArgMin'), 'quantilesExactLowArgMin': ('quantilesExactLow', 'ArgMin'), 'sequenceNextNodeArgMin': ('sequenceNextNode', 'ArgMin'), 'simpleLinearRegressionArgMin': ('simpleLinearRegression', 'ArgMin'), 'quantileBFloat16WeightedArgMin': ('quantileBFloat16Weighted', 'ArgMin'), 'avgArgMin': ('avg', 'ArgMin'), 'kurtSampArgMin': ('kurtSamp', 'ArgMin'), 'avgWeightedArgMin': ('avgWeighted', 'ArgMin'), 'maxArgMin': ('max', 'ArgMin'), 'histogramArgMin': ('histogram', 'ArgMin'), 'quantilesBFloat16ArgMin': ('quantilesBFloat16', 'ArgMin'), 'varSampArgMin': ('varSamp', 'ArgMin'), 'sequenceCountArgMin': ('sequenceCount', 'ArgMin'), 'anyArgMin': ('any', 'ArgMin'), 'categoricalInformationValueArgMin': ('categoricalInformationValue', 'ArgMin'), 'topKWeightedArgMin': ('topKWeighted', 'ArgMin'), 'groupArrayLastArgMin': ('groupArrayLast', 'ArgMin'), 'corrArgMin': ('corr', 'ArgMin'), 'sumKahanArgMin': ('sumKahan', 'ArgMin'), 'boundingRatioArgMin': ('boundingRatio', 'ArgMin'), 'meanZTestArgMin': ('meanZTest', 'ArgMin'), 'quantilesGKArgMin': ('quantilesGK', 'ArgMin'), 'groupBitmapOrArgMin': ('groupBitmapOr', 'ArgMin'), 'first_valueArgMin': ('first_value', 'ArgMin'), 'argMaxArgMin': ('argMax', 'ArgMin'), 'groupArraySampleArgMin': ('groupArraySample', 'ArgMin'), 'anyHeavyArgMin': ('anyHeavy', 'ArgMin'), 'quantilesTDigestArgMin': ('quantilesTDigest', 'ArgMin'), 'deltaSumTimestampArgMin': ('deltaSumTimestamp', 'ArgMin'), 'quantileExactHighArgMin': ('quantileExactHigh', 'ArgMin'), 'topKArgMin': ('topK', 'ArgMin'), 'theilsUArgMin': ('theilsU', 'ArgMin'), 'quantileInterpolatedWeightedArgMin': ('quantileInterpolatedWeighted', 'ArgMin'), 'uniqCombined64ArgMin': ('uniqCombined64', 'ArgMin'), 'studentTTestArgMin': ('studentTTest', 'ArgMin'), 'quantilesTDigestWeightedArgMin': ('quantilesTDigestWeighted', 'ArgMin'), 'sequenceMatchArgMin': ('sequenceMatch', 'ArgMin'), 'mannWhitneyUTestArgMin': ('mannWhitneyUTest', 'ArgMin'), 'uniqExactArgMin': ('uniqExact', 'ArgMin'), 'last_valueArgMin': ('last_value', 'ArgMin'), 'quantilesInterpolatedWeightedArgMin': ('quantilesInterpolatedWeighted', 'ArgMin'), 'kurtPopArgMin': ('kurtPop', 'ArgMin'), 'argMinArgMin': ('argMin', 'ArgMin'), 'exponentialTimeDecayedAvgArgMin': ('exponentialTimeDecayedAvg', 'ArgMin'), 'covarSampArgMin': ('covarSamp', 'ArgMin'), 'groupBitXorArgMin': ('groupBitXor', 'ArgMin'), 'groupBitOrArgMin': ('groupBitOr', 'ArgMin'), 'maxIntersectionsArgMin': ('maxIntersections', 'ArgMin'), 'quantileExactLowArgMin': ('quantileExactLow', 'ArgMin'), 'quantilesBFloat16WeightedArgMin': ('quantilesBFloat16Weighted', 'ArgMin'), 'groupBitAndArgMin': ('groupBitAnd', 'ArgMin'), 'quantilesExactHighArgMin': ('quantilesExactHigh', 'ArgMin'), 'quantileTDigestWeightedArgMin': ('quantileTDigestWeighted', 'ArgMin'), 'countArgMin': ('count', 'ArgMin'), 'groupUniqArrayArgMin': ('groupUniqArray', 'ArgMin'), 'minArgMin': ('min', 'ArgMin'), 'sparkBarArgMin': ('sparkBar', 'ArgMin'), 'windowFunnelArgMin': ('windowFunnel', 'ArgMin'), 'stochasticLogisticRegressionArgMin': ('stochasticLogisticRegression', 'ArgMin'), 'kolmogorovSmirnovTestArgMin': ('kolmogorovSmirnovTest', 'ArgMin'), 'maxIntersectionsPositionArgMin': ('maxIntersectionsPosition', 'ArgMin'), 'quantileBFloat16ArgMin': ('quantileBFloat16', 'ArgMin'), 'quantilesTimingArgMin': ('quantilesTiming', 'ArgMin'), 'quantileTimingArgMin': ('quantileTiming', 'ArgMin'), 'groupArrayInsertAtArgMin': ('groupArrayInsertAt', 'ArgMin'), 'welchTTestArgMin': ('welchTTest', 'ArgMin'), 'sumMapArgMin': ('sumMap', 'ArgMin'), 'quantilesDeterministicArgMin': ('quantilesDeterministic', 'ArgMin'), 'sumArgMin': ('sum', 'ArgMin'), 'uniqUpToArgMin': ('uniqUpTo', 'ArgMin'), 'stochasticLinearRegressionArgMin': ('stochasticLinearRegression', 'ArgMin'), 'contingencyArgMin': ('contingency', 'ArgMin'), 'minMapArgMin': ('minMap', 'ArgMin'), 'largestTriangleThreeBucketsArgMin': ('largestTriangleThreeBuckets', 'ArgMin'), 'anyLastArgMin': ('anyLast', 'ArgMin'), 'quantileTimingWeightedArgMin': ('quantileTimingWeighted', 'ArgMin'), 'skewPopArgMin': ('skewPop', 'ArgMin'), 'uniqHLL12ArgMin': ('uniqHLL12', 'ArgMin'), 'quantilesExactArgMin': ('quantilesExact', 'ArgMin'), 'quantileTDigestArgMin': ('quantileTDigest', 'ArgMin'), 'deltaSumArgMin': ('deltaSum', 'ArgMin'), 'entropyArgMin': ('entropy', 'ArgMin'), 'groupBitmapAndArgMin': ('groupBitmapAnd', 'ArgMin'), 'maxMapArgMin': ('maxMap', 'ArgMin'), 'quantileArgMin': ('quantile', 'ArgMin'), 'groupArrayArgMin': ('groupArray', 'ArgMin'), 'stddevSampArgMin': ('stddevSamp', 'ArgMin'), 'uniqArgMin': ('uniq', 'ArgMin'), 'intervalLengthSumArgMin': ('intervalLengthSum', 'ArgMin'), 'medianArgMin': ('median', 'ArgMin'), 'varPopArgMin': ('varPop', 'ArgMin'), 'quantileExactArgMin': ('quantileExact', 'ArgMin'), 'quantileDeterministicArgMin': ('quantileDeterministic', 'ArgMin'), 'stddevPopArgMin': ('stddevPop', 'ArgMin'), 'exponentialMovingAverageArgMax': ('exponentialMovingAverage', 'ArgMax'), 'quantilesArgMax': ('quantiles', 'ArgMax'), 'cramersVArgMax': ('cramersV', 'ArgMax'), 'quantilesTimingWeightedArgMax': ('quantilesTimingWeighted', 'ArgMax'), 'sumWithOverflowArgMax': ('sumWithOverflow', 'ArgMax'), 'retentionArgMax': ('retention', 'ArgMax'), 'rankCorrArgMax': ('rankCorr', 'ArgMax'), 'quantilesExactWeightedArgMax': ('quantilesExactWeighted', 'ArgMax'), 'groupBitmapXorArgMax': ('groupBitmapXor', 'ArgMax'), 'skewSampArgMax': ('skewSamp', 'ArgMax'), 'covarPopArgMax': ('covarPop', 'ArgMax'), 'groupArrayMovingSumArgMax': ('groupArrayMovingSum', 'ArgMax'), 'uniqCombinedArgMax': ('uniqCombined', 'ArgMax'), 'sumCountArgMax': ('sumCount', 'ArgMax'), 'groupBitmapArgMax': ('groupBitmap', 'ArgMax'), 'cramersVBiasCorrectedArgMax': ('cramersVBiasCorrected', 'ArgMax'), 'uniqThetaArgMax': ('uniqTheta', 'ArgMax'), 'quantileExactWeightedArgMax': ('quantileExactWeighted', 'ArgMax'), 'groupArrayMovingAvgArgMax': ('groupArrayMovingAvg', 'ArgMax'), 'quantileGKArgMax': ('quantileGK', 'ArgMax'), 'quantilesExactLowArgMax': ('quantilesExactLow', 'ArgMax'), 'sequenceNextNodeArgMax': ('sequenceNextNode', 'ArgMax'), 'simpleLinearRegressionArgMax': ('simpleLinearRegression', 'ArgMax'), 'quantileBFloat16WeightedArgMax': ('quantileBFloat16Weighted', 'ArgMax'), 'avgArgMax': ('avg', 'ArgMax'), 'kurtSampArgMax': ('kurtSamp', 'ArgMax'), 'avgWeightedArgMax': ('avgWeighted', 'ArgMax'), 'maxArgMax': ('max', 'ArgMax'), 'histogramArgMax': ('histogram', 'ArgMax'), 'quantilesBFloat16ArgMax': ('quantilesBFloat16', 'ArgMax'), 'varSampArgMax': ('varSamp', 'ArgMax'), 'sequenceCountArgMax': ('sequenceCount', 'ArgMax'), 'anyArgMax': ('any', 'ArgMax'), 'categoricalInformationValueArgMax': ('categoricalInformationValue', 'ArgMax'), 'topKWeightedArgMax': ('topKWeighted', 'ArgMax'), 'groupArrayLastArgMax': ('groupArrayLast', 'ArgMax'), 'corrArgMax': ('corr', 'ArgMax'), 'sumKahanArgMax': ('sumKahan', 'ArgMax'), 'boundingRatioArgMax': ('boundingRatio', 'ArgMax'), 'meanZTestArgMax': ('meanZTest', 'ArgMax'), 'quantilesGKArgMax': ('quantilesGK', 'ArgMax'), 'groupBitmapOrArgMax': ('groupBitmapOr', 'ArgMax'), 'first_valueArgMax': ('first_value', 'ArgMax'), 'argMaxArgMax': ('argMax', 'ArgMax'), 'groupArraySampleArgMax': ('groupArraySample', 'ArgMax'), 'anyHeavyArgMax': ('anyHeavy', 'ArgMax'), 'quantilesTDigestArgMax': ('quantilesTDigest', 'ArgMax'), 'deltaSumTimestampArgMax': ('deltaSumTimestamp', 'ArgMax'), 'quantileExactHighArgMax': ('quantileExactHigh', 'ArgMax'), 'topKArgMax': ('topK', 'ArgMax'), 'theilsUArgMax': ('theilsU', 'ArgMax'), 'quantileInterpolatedWeightedArgMax': ('quantileInterpolatedWeighted', 'ArgMax'), 'uniqCombined64ArgMax': ('uniqCombined64', 'ArgMax'), 'studentTTestArgMax': ('studentTTest', 'ArgMax'), 'quantilesTDigestWeightedArgMax': ('quantilesTDigestWeighted', 'ArgMax'), 'sequenceMatchArgMax': ('sequenceMatch', 'ArgMax'), 'mannWhitneyUTestArgMax': ('mannWhitneyUTest', 'ArgMax'), 'uniqExactArgMax': ('uniqExact', 'ArgMax'), 'last_valueArgMax': ('last_value', 'ArgMax'), 'quantilesInterpolatedWeightedArgMax': ('quantilesInterpolatedWeighted', 'ArgMax'), 'kurtPopArgMax': ('kurtPop', 'ArgMax'), 'argMinArgMax': ('argMin', 'ArgMax'), 'exponentialTimeDecayedAvgArgMax': ('exponentialTimeDecayedAvg', 'ArgMax'), 'covarSampArgMax': ('covarSamp', 'ArgMax'), 'groupBitXorArgMax': ('groupBitXor', 'ArgMax'), 'groupBitOrArgMax': ('groupBitOr', 'ArgMax'), 'maxIntersectionsArgMax': ('maxIntersections', 'ArgMax'), 'quantileExactLowArgMax': ('quantileExactLow', 'ArgMax'), 'quantilesBFloat16WeightedArgMax': ('quantilesBFloat16Weighted', 'ArgMax'), 'groupBitAndArgMax': ('groupBitAnd', 'ArgMax'), 'quantilesExactHighArgMax': ('quantilesExactHigh', 'ArgMax'), 'quantileTDigestWeightedArgMax': ('quantileTDigestWeighted', 'ArgMax'), 'countArgMax': ('count', 'ArgMax'), 'groupUniqArrayArgMax': ('groupUniqArray', 'ArgMax'), 'minArgMax': ('min', 'ArgMax'), 'sparkBarArgMax': ('sparkBar', 'ArgMax'), 'windowFunnelArgMax': ('windowFunnel', 'ArgMax'), 'stochasticLogisticRegressionArgMax': ('stochasticLogisticRegression', 'ArgMax'), 'kolmogorovSmirnovTestArgMax': ('kolmogorovSmirnovTest', 'ArgMax'), 'maxIntersectionsPositionArgMax': ('maxIntersectionsPosition', 'ArgMax'), 'quantileBFloat16ArgMax': ('quantileBFloat16', 'ArgMax'), 'quantilesTimingArgMax': ('quantilesTiming', 'ArgMax'), 'quantileTimingArgMax': ('quantileTiming', 'ArgMax'), 'groupArrayInsertAtArgMax': ('groupArrayInsertAt', 'ArgMax'), 'welchTTestArgMax': ('welchTTest', 'ArgMax'), 'sumMapArgMax': ('sumMap', 'ArgMax'), 'quantilesDeterministicArgMax': ('quantilesDeterministic', 'ArgMax'), 'sumArgMax': ('sum', 'ArgMax'), 'uniqUpToArgMax': ('uniqUpTo', 'ArgMax'), 'stochasticLinearRegressionArgMax': ('stochasticLinearRegression', 'ArgMax'), 'contingencyArgMax': ('contingency', 'ArgMax'), 'minMapArgMax': ('minMap', 'ArgMax'), 'largestTriangleThreeBucketsArgMax': ('largestTriangleThreeBuckets', 'ArgMax'), 'anyLastArgMax': ('anyLast', 'ArgMax'), 'quantileTimingWeightedArgMax': ('quantileTimingWeighted', 'ArgMax'), 'skewPopArgMax': ('skewPop', 'ArgMax'), 'uniqHLL12ArgMax': ('uniqHLL12', 'ArgMax'), 'quantilesExactArgMax': ('quantilesExact', 'ArgMax'), 'quantileTDigestArgMax': ('quantileTDigest', 'ArgMax'), 'deltaSumArgMax': ('deltaSum', 'ArgMax'), 'entropyArgMax': ('entropy', 'ArgMax'), 'groupBitmapAndArgMax': ('groupBitmapAnd', 'ArgMax'), 'maxMapArgMax': ('maxMap', 'ArgMax'), 'quantileArgMax': ('quantile', 'ArgMax'), 'groupArrayArgMax': ('groupArray', 'ArgMax'), 'stddevSampArgMax': ('stddevSamp', 'ArgMax'), 'uniqArgMax': ('uniq', 'ArgMax'), 'intervalLengthSumArgMax': ('intervalLengthSum', 'ArgMax'), 'medianArgMax': ('median', 'ArgMax'), 'varPopArgMax': ('varPop', 'ArgMax'), 'quantileExactArgMax': ('quantileExact', 'ArgMax'), 'quantileDeterministicArgMax': ('quantileDeterministic', 'ArgMax'), 'stddevPopArgMax': ('stddevPop', 'ArgMax'), 'exponentialMovingAverage': ('exponentialMovingAverage', ''), 'quantiles': ('quantiles', ''), 'cramersV': ('cramersV', ''), 'quantilesTimingWeighted': ('quantilesTimingWeighted', ''), 'sumWithOverflow': ('sumWithOverflow', ''), 'retention': ('retention', ''), 'rankCorr': ('rankCorr', ''), 'quantilesExactWeighted': ('quantilesExactWeighted', ''), 'groupBitmapXor': ('groupBitmapXor', ''), 'skewSamp': ('skewSamp', ''), 'covarPop': ('covarPop', ''), 'groupArrayMovingSum': ('groupArrayMovingSum', ''), 'uniqCombined': ('uniqCombined', ''), 'sumCount': ('sumCount', ''), 'groupBitmap': ('groupBitmap', ''), 'cramersVBiasCorrected': ('cramersVBiasCorrected', ''), 'uniqTheta': ('uniqTheta', ''), 'quantileExactWeighted': ('quantileExactWeighted', ''), 'groupArrayMovingAvg': ('groupArrayMovingAvg', ''), 'quantileGK': ('quantileGK', ''), 'quantilesExactLow': ('quantilesExactLow', ''), 'sequenceNextNode': ('sequenceNextNode', ''), 'simpleLinearRegression': ('simpleLinearRegression', ''), 'quantileBFloat16Weighted': ('quantileBFloat16Weighted', ''), 'avg': ('avg', ''), 'kurtSamp': ('kurtSamp', ''), 'avgWeighted': ('avgWeighted', ''), 'max': ('max', ''), 'histogram': ('histogram', ''), 'quantilesBFloat16': ('quantilesBFloat16', ''), 'varSamp': ('varSamp', ''), 'sequenceCount': ('sequenceCount', ''), 'any': ('any', ''), 'categoricalInformationValue': ('categoricalInformationValue', ''), 'topKWeighted': ('topKWeighted', ''), 'groupArrayLast': ('groupArrayLast', ''), 'corr': ('corr', ''), 'sumKahan': ('sumKahan', ''), 'boundingRatio': ('boundingRatio', ''), 'meanZTest': ('meanZTest', ''), 'quantilesGK': ('quantilesGK', ''), 'groupBitmapOr': ('groupBitmapOr', ''), 'first_value': ('first_value', ''), 'argMax': ('argMax', ''), 'groupArraySample': ('groupArraySample', ''), 'anyHeavy': ('anyHeavy', ''), 'quantilesTDigest': ('quantilesTDigest', ''), 'deltaSumTimestamp': ('deltaSumTimestamp', ''), 'quantileExactHigh': ('quantileExactHigh', ''), 'topK': ('topK', ''), 'theilsU': ('theilsU', ''), 'quantileInterpolatedWeighted': ('quantileInterpolatedWeighted', ''), 'uniqCombined64': ('uniqCombined64', ''), 'studentTTest': ('studentTTest', ''), 'quantilesTDigestWeighted': ('quantilesTDigestWeighted', ''), 'sequenceMatch': ('sequenceMatch', ''), 'mannWhitneyUTest': ('mannWhitneyUTest', ''), 'uniqExact': ('uniqExact', ''), 'last_value': ('last_value', ''), 'quantilesInterpolatedWeighted': ('quantilesInterpolatedWeighted', ''), 'kurtPop': ('kurtPop', ''), 'argMin': ('argMin', ''), 'exponentialTimeDecayedAvg': ('exponentialTimeDecayedAvg', ''), 'covarSamp': ('covarSamp', ''), 'groupBitXor': ('groupBitXor', ''), 'groupBitOr': ('groupBitOr', ''), 'maxIntersections': ('maxIntersections', ''), 'quantileExactLow': ('quantileExactLow', ''), 'quantilesBFloat16Weighted': ('quantilesBFloat16Weighted', ''), 'groupBitAnd': ('groupBitAnd', ''), 'quantilesExactHigh': ('quantilesExactHigh', ''), 'quantileTDigestWeighted': ('quantileTDigestWeighted', ''), 'count': ('count', ''), 'groupUniqArray': ('groupUniqArray', ''), 'min': ('min', ''), 'sparkBar': ('sparkBar', ''), 'windowFunnel': ('windowFunnel', ''), 'stochasticLogisticRegression': ('stochasticLogisticRegression', ''), 'kolmogorovSmirnovTest': ('kolmogorovSmirnovTest', ''), 'maxIntersectionsPosition': ('maxIntersectionsPosition', ''), 'quantileBFloat16': ('quantileBFloat16', ''), 'quantilesTiming': ('quantilesTiming', ''), 'quantileTiming': ('quantileTiming', ''), 'groupArrayInsertAt': ('groupArrayInsertAt', ''), 'welchTTest': ('welchTTest', ''), 'quantilesDeterministic': ('quantilesDeterministic', ''), 'sum': ('sum', ''), 'uniqUpTo': ('uniqUpTo', ''), 'stochasticLinearRegression': ('stochasticLinearRegression', ''), 'contingency': ('contingency', ''), 'largestTriangleThreeBuckets': ('largestTriangleThreeBuckets', ''), 'anyLast': ('anyLast', ''), 'quantileTimingWeighted': ('quantileTimingWeighted', ''), 'skewPop': ('skewPop', ''), 'uniqHLL12': ('uniqHLL12', ''), 'quantilesExact': ('quantilesExact', ''), 'quantileTDigest': ('quantileTDigest', ''), 'deltaSum': ('deltaSum', ''), 'entropy': ('entropy', ''), 'groupBitmapAnd': ('groupBitmapAnd', ''), 'quantile': ('quantile', ''), 'groupArray': ('groupArray', ''), 'stddevSamp': ('stddevSamp', ''), 'uniq': ('uniq', ''), 'intervalLengthSum': ('intervalLengthSum', ''), 'median': ('median', ''), 'varPop': ('varPop', ''), 'quantileExact': ('quantileExact', ''), 'quantileDeterministic': ('quantileDeterministic', ''), 'stddevPop': ('stddevPop', '')}
FUNCTION_PARSERS =
{'CAST': <function Parser.<lambda>>, 'CONVERT': <function Parser.<lambda>>, 'DECODE': <function Parser.<lambda>>, 'EXTRACT': <function Parser.<lambda>>, 'JSON_OBJECT': <function Parser.<lambda>>, 'JSON_OBJECTAGG': <function Parser.<lambda>>, 'JSON_TABLE': <function Parser.<lambda>>, 'OPENJSON': <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>>, 'ARRAYJOIN': <function ClickHouse.Parser.<lambda>>, 'QUANTILE': <function ClickHouse.Parser.<lambda>>}
NO_PAREN_FUNCTION_PARSERS =
{'CASE': <function Parser.<lambda>>, 'IF': <function Parser.<lambda>>, 'NEXT': <function Parser.<lambda>>}
RANGE_PARSERS =
{<TokenType.BETWEEN: 'BETWEEN'>: <function Parser.<lambda>>, <TokenType.GLOB: 'GLOB'>: <function binary_range_parser.<locals>.<lambda>>, <TokenType.ILIKE: 'ILIKE'>: <function binary_range_parser.<locals>.<lambda>>, <TokenType.IN: 'IN'>: <function Parser.<lambda>>, <TokenType.IRLIKE: 'IRLIKE'>: <function binary_range_parser.<locals>.<lambda>>, <TokenType.IS: 'IS'>: <function Parser.<lambda>>, <TokenType.LIKE: 'LIKE'>: <function binary_range_parser.<locals>.<lambda>>, <TokenType.OVERLAPS: 'OVERLAPS'>: <function binary_range_parser.<locals>.<lambda>>, <TokenType.RLIKE: 'RLIKE'>: <function binary_range_parser.<locals>.<lambda>>, <TokenType.SIMILAR_TO: 'SIMILAR_TO'>: <function binary_range_parser.<locals>.<lambda>>, <TokenType.FOR: 'FOR'>: <function Parser.<lambda>>, <TokenType.GLOBAL: 'GLOBAL'>: <function ClickHouse.Parser.<lambda>>}
COLUMN_OPERATORS =
{<TokenType.DOT: 'DOT'>: None, <TokenType.DCOLON: 'DCOLON'>: <function Parser.<lambda>>, <TokenType.ARROW: 'ARROW'>: <function Parser.<lambda>>, <TokenType.DARROW: 'DARROW'>: <function Parser.<lambda>>, <TokenType.HASH_ARROW: 'HASH_ARROW'>: <function Parser.<lambda>>, <TokenType.DHASH_ARROW: 'DHASH_ARROW'>: <function Parser.<lambda>>}
JOIN_KINDS =
{<TokenType.ANTI: 'ANTI'>, <TokenType.ASOF: 'ASOF'>, <TokenType.INNER: 'INNER'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.OUTER: 'OUTER'>, <TokenType.SEMI: 'SEMI'>, <TokenType.ANY: 'ANY'>, <TokenType.CROSS: 'CROSS'>}
TABLE_ALIAS_TOKENS =
{<TokenType.TINYINT: 'TINYINT'>, <TokenType.UINT256: 'UINT256'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.CASE: 'CASE'>, <TokenType.DATE32: 'DATE32'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.MERGE: 'MERGE'>, <TokenType.TEXT: 'TEXT'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.TRUE: 'TRUE'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.NAME: 'NAME'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.ALL: 'ALL'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.KILL: 'KILL'>, <TokenType.RANGE: 'RANGE'>, <TokenType.BINARY: 'BINARY'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.IS: 'IS'>, <TokenType.DESC: 'DESC'>, <TokenType.PROCEDURE: 'PROCEDURE'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.DIV: 'DIV'>, <TokenType.XML: 'XML'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.IPV4: 'IPV4'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.IPV6: 'IPV6'>, <TokenType.VAR: 'VAR'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.STORAGE_INTEGRATION: 'STORAGE_INTEGRATION'>, <TokenType.SHOW: 'SHOW'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.UNIQUEIDENTIFIER: 'UNIQUEIDENTIFIER'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.UNIQUE: 'UNIQUE'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.SOME: 'SOME'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.KEEP: 'KEEP'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.JSON: 'JSON'>, <TokenType.SUPER: 'SUPER'>, <TokenType.TIME: 'TIME'>, <TokenType.INT256: 'INT256'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.USE: 'USE'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.ASC: 'ASC'>, <TokenType.YEAR: 'YEAR'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.FALSE: 'FALSE'>, <TokenType.JSONB: 'JSONB'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.CACHE: 'CACHE'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.MODEL: 'MODEL'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.MONEY: 'MONEY'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.DATE: 'DATE'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.VIEW: 'VIEW'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.DELETE: 'DELETE'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.UUID: 'UUID'>, <TokenType.SET: 'SET'>, <TokenType.LOAD: 'LOAD'>, <TokenType.FIRST: 'FIRST'>, <TokenType.INDEX: 'INDEX'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.REFERENCES: 'REFERENCES'>, <TokenType.NESTED: 'NESTED'>, <TokenType.FILTER: 'FILTER'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.COPY: 'COPY'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.INT128: 'INT128'>, <TokenType.INET: 'INET'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.UINT128: 'UINT128'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.ENUM: 'ENUM'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.MAP: 'MAP'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.NEXT: 'NEXT'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.UINT: 'UINT'>, <TokenType.ROW: 'ROW'>, <TokenType.TABLE: 'TABLE'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.END: 'END'>, <TokenType.ROWS: 'ROWS'>, <TokenType.TOP: 'TOP'>, <TokenType.NULL: 'NULL'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.ORDINALITY: 'ORDINALITY'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.CHAR: 'CHAR'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.BIT: 'BIT'>, <TokenType.INT: 'INT'>}
ALIAS_TOKENS =
{<TokenType.WINDOW: 'WINDOW'>, <TokenType.UINT256: 'UINT256'>, <TokenType.APPLY: 'APPLY'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.CASE: 'CASE'>, <TokenType.DATE32: 'DATE32'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.BIT: 'BIT'>, <TokenType.MERGE: 'MERGE'>, <TokenType.TEXT: 'TEXT'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.TRUE: 'TRUE'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.NAME: 'NAME'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.ALL: 'ALL'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.SEMI: 'SEMI'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.KILL: 'KILL'>, <TokenType.RANGE: 'RANGE'>, <TokenType.BINARY: 'BINARY'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.IS: 'IS'>, <TokenType.DESC: 'DESC'>, <TokenType.PROCEDURE: 'PROCEDURE'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.DIV: 'DIV'>, <TokenType.XML: 'XML'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.IPV4: 'IPV4'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.IPV6: 'IPV6'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.STORAGE_INTEGRATION: 'STORAGE_INTEGRATION'>, <TokenType.SHOW: 'SHOW'>, <TokenType.INT: 'INT'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.UNIQUEIDENTIFIER: 'UNIQUEIDENTIFIER'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.UNIQUE: 'UNIQUE'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.SOME: 'SOME'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.KEEP: 'KEEP'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.JSON: 'JSON'>, <TokenType.ANY: 'ANY'>, <TokenType.SUPER: 'SUPER'>, <TokenType.TIME: 'TIME'>, <TokenType.INT256: 'INT256'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.ANTI: 'ANTI'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.USE: 'USE'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.ASC: 'ASC'>, <TokenType.YEAR: 'YEAR'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.FALSE: 'FALSE'>, <TokenType.JSONB: 'JSONB'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.CACHE: 'CACHE'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.MODEL: 'MODEL'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.MONEY: 'MONEY'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.DATE: 'DATE'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.VIEW: 'VIEW'>, <TokenType.RIGHT: 'RIGHT'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.DELETE: 'DELETE'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.UUID: 'UUID'>, <TokenType.NATURAL: 'NATURAL'>, <TokenType.SET: 'SET'>, <TokenType.LOAD: 'LOAD'>, <TokenType.FIRST: 'FIRST'>, <TokenType.INDEX: 'INDEX'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.REFERENCES: 'REFERENCES'>, <TokenType.NESTED: 'NESTED'>, <TokenType.FILTER: 'FILTER'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.COPY: 'COPY'>, <TokenType.FINAL: 'FINAL'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.INT128: 'INT128'>, <TokenType.INET: 'INET'>, <TokenType.LEFT: 'LEFT'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.UINT128: 'UINT128'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.ENUM: 'ENUM'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.MAP: 'MAP'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.NEXT: 'NEXT'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.UINT: 'UINT'>, <TokenType.FULL: 'FULL'>, <TokenType.ROW: 'ROW'>, <TokenType.TABLE: 'TABLE'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.END: 'END'>, <TokenType.ROWS: 'ROWS'>, <TokenType.TOP: 'TOP'>, <TokenType.NULL: 'NULL'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.ORDINALITY: 'ORDINALITY'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.CHAR: 'CHAR'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.ASOF: 'ASOF'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.VAR: 'VAR'>, <TokenType.SETTINGS: 'SETTINGS'>}
QUERY_MODIFIER_PARSERS =
{<TokenType.MATCH_RECOGNIZE: 'MATCH_RECOGNIZE'>: <function Parser.<lambda>>, <TokenType.PREWHERE: 'PREWHERE'>: <function Parser.<lambda>>, <TokenType.WHERE: 'WHERE'>: <function Parser.<lambda>>, <TokenType.GROUP_BY: 'GROUP_BY'>: <function Parser.<lambda>>, <TokenType.HAVING: 'HAVING'>: <function Parser.<lambda>>, <TokenType.QUALIFY: 'QUALIFY'>: <function Parser.<lambda>>, <TokenType.WINDOW: 'WINDOW'>: <function Parser.<lambda>>, <TokenType.ORDER_BY: 'ORDER_BY'>: <function Parser.<lambda>>, <TokenType.LIMIT: 'LIMIT'>: <function Parser.<lambda>>, <TokenType.FETCH: 'FETCH'>: <function Parser.<lambda>>, <TokenType.OFFSET: 'OFFSET'>: <function Parser.<lambda>>, <TokenType.FOR: 'FOR'>: <function Parser.<lambda>>, <TokenType.LOCK: 'LOCK'>: <function Parser.<lambda>>, <TokenType.TABLE_SAMPLE: 'TABLE_SAMPLE'>: <function Parser.<lambda>>, <TokenType.USING: 'USING'>: <function Parser.<lambda>>, <TokenType.CLUSTER_BY: 'CLUSTER_BY'>: <function Parser.<lambda>>, <TokenType.DISTRIBUTE_BY: 'DISTRIBUTE_BY'>: <function Parser.<lambda>>, <TokenType.SORT_BY: 'SORT_BY'>: <function Parser.<lambda>>, <TokenType.CONNECT_BY: 'CONNECT_BY'>: <function Parser.<lambda>>, <TokenType.START_WITH: 'START_WITH'>: <function Parser.<lambda>>, <TokenType.SETTINGS: 'SETTINGS'>: <function ClickHouse.Parser.<lambda>>, <TokenType.FORMAT: 'FORMAT'>: <function ClickHouse.Parser.<lambda>>}
CONSTRAINT_PARSERS =
{'AUTOINCREMENT': <function Parser.<lambda>>, 'AUTO_INCREMENT': <function Parser.<lambda>>, 'CASESPECIFIC': <function Parser.<lambda>>, 'CHARACTER SET': <function Parser.<lambda>>, 'CHECK': <function Parser.<lambda>>, 'COLLATE': <function Parser.<lambda>>, 'COMMENT': <function Parser.<lambda>>, 'COMPRESS': <function Parser.<lambda>>, 'CLUSTERED': <function Parser.<lambda>>, 'NONCLUSTERED': <function Parser.<lambda>>, 'DEFAULT': <function Parser.<lambda>>, 'ENCODE': <function Parser.<lambda>>, 'EPHEMERAL': <function Parser.<lambda>>, 'EXCLUDE': <function Parser.<lambda>>, 'FOREIGN KEY': <function Parser.<lambda>>, 'FORMAT': <function Parser.<lambda>>, 'GENERATED': <function Parser.<lambda>>, 'IDENTITY': <function Parser.<lambda>>, 'INLINE': <function Parser.<lambda>>, 'LIKE': <function Parser.<lambda>>, 'NOT': <function Parser.<lambda>>, 'NULL': <function Parser.<lambda>>, 'ON': <function Parser.<lambda>>, 'PATH': <function Parser.<lambda>>, 'PERIOD': <function Parser.<lambda>>, 'PRIMARY KEY': <function Parser.<lambda>>, 'REFERENCES': <function Parser.<lambda>>, 'TITLE': <function Parser.<lambda>>, 'TTL': <function Parser.<lambda>>, 'UNIQUE': <function Parser.<lambda>>, 'UPPERCASE': <function Parser.<lambda>>, 'WITH': <function Parser.<lambda>>, 'INDEX': <function ClickHouse.Parser.<lambda>>, 'CODEC': <function ClickHouse.Parser.<lambda>>}
ALTER_PARSERS =
{'ADD': <function Parser.<lambda>>, 'ALTER': <function Parser.<lambda>>, 'CLUSTER BY': <function Parser.<lambda>>, 'DELETE': <function Parser.<lambda>>, 'DROP': <function Parser.<lambda>>, 'RENAME': <function Parser.<lambda>>, 'REPLACE': <function ClickHouse.Parser.<lambda>>}
SCHEMA_UNNAMED_CONSTRAINTS =
{'EXCLUDE', 'PERIOD', 'INDEX', 'UNIQUE', 'PRIMARY KEY', 'LIKE', 'CHECK', 'FOREIGN KEY'}
SET_TRIE: Dict =
{'GLOBAL': {0: True}, 'LOCAL': {0: True}, 'SESSION': {0: True}, 'TRANSACTION': {0: True}}
Inherited Members
- sqlglot.parser.Parser
- Parser
- NO_PAREN_FUNCTIONS
- STRUCT_TYPE_TOKENS
- NESTED_TYPE_TOKENS
- ENUM_TYPE_TOKENS
- AGGREGATE_TYPE_TOKENS
- TYPE_TOKENS
- SIGNED_TO_UNSIGNED_TYPE_TOKEN
- SUBQUERY_PREDICATES
- RESERVED_TOKENS
- DB_CREATABLES
- CREATABLES
- ID_VAR_TOKENS
- INTERVAL_VARS
- COMMENT_TABLE_ALIAS_TOKENS
- UPDATE_ALIAS_TOKENS
- TRIM_TYPES
- CONJUNCTION
- EQUALITY
- COMPARISON
- BITWISE
- TERM
- FACTOR
- EXPONENT
- TIMES
- TIMESTAMPS
- SET_OPERATIONS
- JOIN_METHODS
- JOIN_SIDES
- JOIN_HINTS
- LAMBDAS
- EXPRESSION_PARSERS
- STATEMENT_PARSERS
- UNARY_PARSERS
- STRING_PARSERS
- NUMERIC_PARSERS
- PRIMARY_PARSERS
- PLACEHOLDER_PARSERS
- PROPERTY_PARSERS
- ALTER_ALTER_PARSERS
- INVALID_FUNC_NAME_TOKENS
- KEY_VALUE_DEFINITIONS
- SET_PARSERS
- SHOW_PARSERS
- TYPE_LITERAL_PARSERS
- DDL_SELECT_TOKENS
- PRE_VOLATILE_TOKENS
- TRANSACTION_KIND
- TRANSACTION_CHARACTERISTICS
- CONFLICT_ACTIONS
- CREATE_SEQUENCE
- ISOLATED_LOADING_OPTIONS
- USABLES
- CAST_ACTIONS
- INSERT_ALTERNATIVES
- CLONE_KEYWORDS
- 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
- STRICT_CAST
- PREFIXED_PIVOT_COLUMNS
- IDENTIFY_PIVOT_STRINGS
- ALTER_TABLE_ADD_REQUIRED_FOR_EACH_COLUMN
- TABLESAMPLE_CSV
- SET_REQUIRES_ASSIGNMENT_DELIMITER
- TRIM_PATTERN_FIRST
- STRING_ALIASES
- UNION_MODIFIERS
- NO_PAREN_IF_COMMANDS
- JSON_ARROWS_REQUIRE_JSON_TYPE
- VALUES_FOLLOWED_BY_PAREN
- SUPPORTS_IMPLICIT_UNNEST
- SUPPORTS_PARTITION_SELECTION
- error_level
- error_message_context
- max_errors
- dialect
- reset
- parse
- parse_into
- check_errors
- raise_error
- expression
- validate_expression
- errors
- sql
612 class Generator(generator.Generator): 613 QUERY_HINTS = False 614 STRUCT_DELIMITER = ("(", ")") 615 NVL2_SUPPORTED = False 616 TABLESAMPLE_REQUIRES_PARENS = False 617 TABLESAMPLE_SIZE_IS_ROWS = False 618 TABLESAMPLE_KEYWORDS = "SAMPLE" 619 LAST_DAY_SUPPORTS_DATE_PART = False 620 CAN_IMPLEMENT_ARRAY_ANY = True 621 SUPPORTS_TO_NUMBER = False 622 623 STRING_TYPE_MAPPING = { 624 exp.DataType.Type.CHAR: "String", 625 exp.DataType.Type.LONGBLOB: "String", 626 exp.DataType.Type.LONGTEXT: "String", 627 exp.DataType.Type.MEDIUMBLOB: "String", 628 exp.DataType.Type.MEDIUMTEXT: "String", 629 exp.DataType.Type.TINYBLOB: "String", 630 exp.DataType.Type.TINYTEXT: "String", 631 exp.DataType.Type.TEXT: "String", 632 exp.DataType.Type.VARBINARY: "String", 633 exp.DataType.Type.VARCHAR: "String", 634 } 635 636 SUPPORTED_JSON_PATH_PARTS = { 637 exp.JSONPathKey, 638 exp.JSONPathRoot, 639 exp.JSONPathSubscript, 640 } 641 642 TYPE_MAPPING = { 643 **generator.Generator.TYPE_MAPPING, 644 **STRING_TYPE_MAPPING, 645 exp.DataType.Type.ARRAY: "Array", 646 exp.DataType.Type.BIGINT: "Int64", 647 exp.DataType.Type.DATE32: "Date32", 648 exp.DataType.Type.DATETIME64: "DateTime64", 649 exp.DataType.Type.DOUBLE: "Float64", 650 exp.DataType.Type.ENUM: "Enum", 651 exp.DataType.Type.ENUM8: "Enum8", 652 exp.DataType.Type.ENUM16: "Enum16", 653 exp.DataType.Type.FIXEDSTRING: "FixedString", 654 exp.DataType.Type.FLOAT: "Float32", 655 exp.DataType.Type.INT: "Int32", 656 exp.DataType.Type.MEDIUMINT: "Int32", 657 exp.DataType.Type.INT128: "Int128", 658 exp.DataType.Type.INT256: "Int256", 659 exp.DataType.Type.LOWCARDINALITY: "LowCardinality", 660 exp.DataType.Type.MAP: "Map", 661 exp.DataType.Type.NESTED: "Nested", 662 exp.DataType.Type.NULLABLE: "Nullable", 663 exp.DataType.Type.SMALLINT: "Int16", 664 exp.DataType.Type.STRUCT: "Tuple", 665 exp.DataType.Type.TINYINT: "Int8", 666 exp.DataType.Type.UBIGINT: "UInt64", 667 exp.DataType.Type.UINT: "UInt32", 668 exp.DataType.Type.UINT128: "UInt128", 669 exp.DataType.Type.UINT256: "UInt256", 670 exp.DataType.Type.USMALLINT: "UInt16", 671 exp.DataType.Type.UTINYINT: "UInt8", 672 exp.DataType.Type.IPV4: "IPv4", 673 exp.DataType.Type.IPV6: "IPv6", 674 exp.DataType.Type.AGGREGATEFUNCTION: "AggregateFunction", 675 exp.DataType.Type.SIMPLEAGGREGATEFUNCTION: "SimpleAggregateFunction", 676 } 677 678 TRANSFORMS = { 679 **generator.Generator.TRANSFORMS, 680 exp.AnyValue: rename_func("any"), 681 exp.ApproxDistinct: rename_func("uniq"), 682 exp.ArrayFilter: lambda self, e: self.func("arrayFilter", e.expression, e.this), 683 exp.ArraySize: rename_func("LENGTH"), 684 exp.ArraySum: rename_func("arraySum"), 685 exp.ArgMax: arg_max_or_min_no_count("argMax"), 686 exp.ArgMin: arg_max_or_min_no_count("argMin"), 687 exp.Array: inline_array_sql, 688 exp.CastToStrType: rename_func("CAST"), 689 exp.CountIf: rename_func("countIf"), 690 exp.CompressColumnConstraint: lambda self, 691 e: f"CODEC({self.expressions(e, key='this', flat=True)})", 692 exp.ComputedColumnConstraint: lambda self, 693 e: f"{'MATERIALIZED' if e.args.get('persisted') else 'ALIAS'} {self.sql(e, 'this')}", 694 exp.CurrentDate: lambda self, e: self.func("CURRENT_DATE"), 695 exp.DateAdd: date_delta_sql("DATE_ADD"), 696 exp.DateDiff: date_delta_sql("DATE_DIFF"), 697 exp.Explode: rename_func("arrayJoin"), 698 exp.Final: lambda self, e: f"{self.sql(e, 'this')} FINAL", 699 exp.IsNan: rename_func("isNaN"), 700 exp.JSONExtract: json_extract_segments("JSONExtractString", quoted_index=False), 701 exp.JSONExtractScalar: json_extract_segments("JSONExtractString", quoted_index=False), 702 exp.JSONPathKey: json_path_key_only_name, 703 exp.JSONPathRoot: lambda *_: "", 704 exp.Map: lambda self, e: _lower_func(var_map_sql(self, e)), 705 exp.Nullif: rename_func("nullIf"), 706 exp.PartitionedByProperty: lambda self, e: f"PARTITION BY {self.sql(e, 'this')}", 707 exp.Pivot: no_pivot_sql, 708 exp.Quantile: _quantile_sql, 709 exp.RegexpLike: lambda self, e: self.func("match", e.this, e.expression), 710 exp.Rand: rename_func("randCanonical"), 711 exp.Select: transforms.preprocess([transforms.eliminate_qualify]), 712 exp.StartsWith: rename_func("startsWith"), 713 exp.StrPosition: lambda self, e: self.func( 714 "position", e.this, e.args.get("substr"), e.args.get("position") 715 ), 716 exp.TimeToStr: lambda self, e: self.func( 717 "DATE_FORMAT", e.this, self.format_time(e), e.args.get("timezone") 718 ), 719 exp.VarMap: lambda self, e: _lower_func(var_map_sql(self, e)), 720 exp.Xor: lambda self, e: self.func("xor", e.this, e.expression, *e.expressions), 721 } 722 723 PROPERTIES_LOCATION = { 724 **generator.Generator.PROPERTIES_LOCATION, 725 exp.VolatileProperty: exp.Properties.Location.UNSUPPORTED, 726 exp.PartitionedByProperty: exp.Properties.Location.POST_SCHEMA, 727 exp.OnCluster: exp.Properties.Location.POST_NAME, 728 } 729 730 JOIN_HINTS = False 731 TABLE_HINTS = False 732 EXPLICIT_UNION = True 733 GROUPINGS_SEP = "" 734 OUTER_UNION_MODIFIERS = False 735 736 # there's no list in docs, but it can be found in Clickhouse code 737 # see `ClickHouse/src/Parsers/ParserCreate*.cpp` 738 ON_CLUSTER_TARGETS = { 739 "DATABASE", 740 "TABLE", 741 "VIEW", 742 "DICTIONARY", 743 "INDEX", 744 "FUNCTION", 745 "NAMED COLLECTION", 746 } 747 748 def _jsonpathsubscript_sql(self, expression: exp.JSONPathSubscript) -> str: 749 this = self.json_path_part(expression.this) 750 return str(int(this) + 1) if is_int(this) else this 751 752 def likeproperty_sql(self, expression: exp.LikeProperty) -> str: 753 return f"AS {self.sql(expression, 'this')}" 754 755 def _any_to_has( 756 self, 757 expression: exp.EQ | exp.NEQ, 758 default: t.Callable[[t.Any], str], 759 prefix: str = "", 760 ) -> str: 761 if isinstance(expression.left, exp.Any): 762 arr = expression.left 763 this = expression.right 764 elif isinstance(expression.right, exp.Any): 765 arr = expression.right 766 this = expression.left 767 else: 768 return default(expression) 769 770 return prefix + self.func("has", arr.this.unnest(), this) 771 772 def eq_sql(self, expression: exp.EQ) -> str: 773 return self._any_to_has(expression, super().eq_sql) 774 775 def neq_sql(self, expression: exp.NEQ) -> str: 776 return self._any_to_has(expression, super().neq_sql, "NOT ") 777 778 def regexpilike_sql(self, expression: exp.RegexpILike) -> str: 779 # Manually add a flag to make the search case-insensitive 780 regex = self.func("CONCAT", "'(?i)'", expression.expression) 781 return self.func("match", expression.this, regex) 782 783 def datatype_sql(self, expression: exp.DataType) -> str: 784 # String is the standard ClickHouse type, every other variant is just an alias. 785 # Additionally, any supplied length parameter will be ignored. 786 # 787 # https://clickhouse.com/docs/en/sql-reference/data-types/string 788 if expression.this in self.STRING_TYPE_MAPPING: 789 return "String" 790 791 return super().datatype_sql(expression) 792 793 def cte_sql(self, expression: exp.CTE) -> str: 794 if expression.args.get("scalar"): 795 this = self.sql(expression, "this") 796 alias = self.sql(expression, "alias") 797 return f"{this} AS {alias}" 798 799 return super().cte_sql(expression) 800 801 def after_limit_modifiers(self, expression: exp.Expression) -> t.List[str]: 802 return super().after_limit_modifiers(expression) + [ 803 ( 804 self.seg("SETTINGS ") + self.expressions(expression, key="settings", flat=True) 805 if expression.args.get("settings") 806 else "" 807 ), 808 ( 809 self.seg("FORMAT ") + self.sql(expression, "format") 810 if expression.args.get("format") 811 else "" 812 ), 813 ] 814 815 def parameterizedagg_sql(self, expression: exp.ParameterizedAgg) -> str: 816 params = self.expressions(expression, key="params", flat=True) 817 return self.func(expression.name, *expression.expressions) + f"({params})" 818 819 def anonymousaggfunc_sql(self, expression: exp.AnonymousAggFunc) -> str: 820 return self.func(expression.name, *expression.expressions) 821 822 def combinedaggfunc_sql(self, expression: exp.CombinedAggFunc) -> str: 823 return self.anonymousaggfunc_sql(expression) 824 825 def combinedparameterizedagg_sql(self, expression: exp.CombinedParameterizedAgg) -> str: 826 return self.parameterizedagg_sql(expression) 827 828 def placeholder_sql(self, expression: exp.Placeholder) -> str: 829 return f"{{{expression.name}: {self.sql(expression, 'kind')}}}" 830 831 def oncluster_sql(self, expression: exp.OnCluster) -> str: 832 return f"ON CLUSTER {self.sql(expression, 'this')}" 833 834 def createable_sql(self, expression: exp.Create, locations: t.DefaultDict) -> str: 835 if expression.kind in self.ON_CLUSTER_TARGETS and locations.get( 836 exp.Properties.Location.POST_NAME 837 ): 838 this_name = self.sql(expression.this, "this") 839 this_properties = " ".join( 840 [self.sql(prop) for prop in locations[exp.Properties.Location.POST_NAME]] 841 ) 842 this_schema = self.schema_columns_sql(expression.this) 843 return f"{this_name}{self.sep()}{this_properties}{self.sep()}{this_schema}" 844 845 return super().createable_sql(expression, locations) 846 847 def prewhere_sql(self, expression: exp.PreWhere) -> str: 848 this = self.indent(self.sql(expression, "this")) 849 return f"{self.seg('PREWHERE')}{self.sep()}{this}" 850 851 def indexcolumnconstraint_sql(self, expression: exp.IndexColumnConstraint) -> str: 852 this = self.sql(expression, "this") 853 this = f" {this}" if this else "" 854 expr = self.sql(expression, "expression") 855 expr = f" {expr}" if expr else "" 856 index_type = self.sql(expression, "index_type") 857 index_type = f" TYPE {index_type}" if index_type else "" 858 granularity = self.sql(expression, "granularity") 859 granularity = f" GRANULARITY {granularity}" if granularity else "" 860 861 return f"INDEX{this}{expr}{index_type}{granularity}" 862 863 def partition_sql(self, expression: exp.Partition) -> str: 864 return f"PARTITION {self.expressions(expression, flat=True)}" 865 866 def partitionid_sql(self, expression: exp.PartitionId) -> str: 867 return f"ID {self.sql(expression.this)}" 868 869 def replacepartition_sql(self, expression: exp.ReplacePartition) -> str: 870 return ( 871 f"REPLACE {self.sql(expression.expression)} FROM {self.sql(expression, 'source')}" 872 )
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
STRING_TYPE_MAPPING =
{<Type.CHAR: 'CHAR'>: 'String', <Type.LONGBLOB: 'LONGBLOB'>: 'String', <Type.LONGTEXT: 'LONGTEXT'>: 'String', <Type.MEDIUMBLOB: 'MEDIUMBLOB'>: 'String', <Type.MEDIUMTEXT: 'MEDIUMTEXT'>: 'String', <Type.TINYBLOB: 'TINYBLOB'>: 'String', <Type.TINYTEXT: 'TINYTEXT'>: 'String', <Type.TEXT: 'TEXT'>: 'String', <Type.VARBINARY: 'VARBINARY'>: 'String', <Type.VARCHAR: 'VARCHAR'>: 'String'}
SUPPORTED_JSON_PATH_PARTS =
{<class 'sqlglot.expressions.JSONPathRoot'>, <class 'sqlglot.expressions.JSONPathKey'>, <class 'sqlglot.expressions.JSONPathSubscript'>}
TYPE_MAPPING =
{<Type.NCHAR: 'NCHAR'>: 'CHAR', <Type.NVARCHAR: 'NVARCHAR'>: 'VARCHAR', <Type.MEDIUMTEXT: 'MEDIUMTEXT'>: 'String', <Type.LONGTEXT: 'LONGTEXT'>: 'String', <Type.TINYTEXT: 'TINYTEXT'>: 'String', <Type.MEDIUMBLOB: 'MEDIUMBLOB'>: 'String', <Type.LONGBLOB: 'LONGBLOB'>: 'String', <Type.TINYBLOB: 'TINYBLOB'>: 'String', <Type.INET: 'INET'>: 'INET', <Type.ROWVERSION: 'ROWVERSION'>: 'VARBINARY', <Type.CHAR: 'CHAR'>: 'String', <Type.TEXT: 'TEXT'>: 'String', <Type.VARBINARY: 'VARBINARY'>: 'String', <Type.VARCHAR: 'VARCHAR'>: 'String', <Type.ARRAY: 'ARRAY'>: 'Array', <Type.BIGINT: 'BIGINT'>: 'Int64', <Type.DATE32: 'DATE32'>: 'Date32', <Type.DATETIME64: 'DATETIME64'>: 'DateTime64', <Type.DOUBLE: 'DOUBLE'>: 'Float64', <Type.ENUM: 'ENUM'>: 'Enum', <Type.ENUM8: 'ENUM8'>: 'Enum8', <Type.ENUM16: 'ENUM16'>: 'Enum16', <Type.FIXEDSTRING: 'FIXEDSTRING'>: 'FixedString', <Type.FLOAT: 'FLOAT'>: 'Float32', <Type.INT: 'INT'>: 'Int32', <Type.MEDIUMINT: 'MEDIUMINT'>: 'Int32', <Type.INT128: 'INT128'>: 'Int128', <Type.INT256: 'INT256'>: 'Int256', <Type.LOWCARDINALITY: 'LOWCARDINALITY'>: 'LowCardinality', <Type.MAP: 'MAP'>: 'Map', <Type.NESTED: 'NESTED'>: 'Nested', <Type.NULLABLE: 'NULLABLE'>: 'Nullable', <Type.SMALLINT: 'SMALLINT'>: 'Int16', <Type.STRUCT: 'STRUCT'>: 'Tuple', <Type.TINYINT: 'TINYINT'>: 'Int8', <Type.UBIGINT: 'UBIGINT'>: 'UInt64', <Type.UINT: 'UINT'>: 'UInt32', <Type.UINT128: 'UINT128'>: 'UInt128', <Type.UINT256: 'UINT256'>: 'UInt256', <Type.USMALLINT: 'USMALLINT'>: 'UInt16', <Type.UTINYINT: 'UTINYINT'>: 'UInt8', <Type.IPV4: 'IPV4'>: 'IPv4', <Type.IPV6: 'IPV6'>: 'IPv6', <Type.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>: 'AggregateFunction', <Type.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>: 'SimpleAggregateFunction'}
TRANSFORMS =
{<class 'sqlglot.expressions.JSONPathKey'>: <function json_path_key_only_name>, <class 'sqlglot.expressions.JSONPathRoot'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.JSONPathSubscript'>: <function <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.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.CopyGrantsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.DateFormatColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.DefaultColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.EncodeColumnConstraint'>: <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.ExternalProperty'>: <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.IntervalSpan'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.JSONExtract'>: <function json_extract_segments.<locals>._json_extract_segments>, <class 'sqlglot.expressions.JSONExtractScalar'>: <function json_extract_segments.<locals>._json_extract_segments>, <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.OutputModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.PathColumnConstraint'>: <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.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.TemporaryProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TitleColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Timestamp'>: <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.UppercaseColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.UnloggedProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.VarMap'>: <function ClickHouse.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.WithOperator'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.AnyValue'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.ApproxDistinct'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.ArrayFilter'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.ArraySize'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.ArraySum'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.ArgMax'>: <function arg_max_or_min_no_count.<locals>._arg_max_or_min_sql>, <class 'sqlglot.expressions.ArgMin'>: <function arg_max_or_min_no_count.<locals>._arg_max_or_min_sql>, <class 'sqlglot.expressions.Array'>: <function inline_array_sql>, <class 'sqlglot.expressions.CastToStrType'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.CountIf'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.CompressColumnConstraint'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.ComputedColumnConstraint'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.CurrentDate'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.DateAdd'>: <function date_delta_sql.<locals>._delta_sql>, <class 'sqlglot.expressions.DateDiff'>: <function date_delta_sql.<locals>._delta_sql>, <class 'sqlglot.expressions.Explode'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.Final'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.IsNan'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.Map'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.Nullif'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.PartitionedByProperty'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.Pivot'>: <function no_pivot_sql>, <class 'sqlglot.expressions.Quantile'>: <function _quantile_sql>, <class 'sqlglot.expressions.RegexpLike'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.Rand'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.Select'>: <function preprocess.<locals>._to_sql>, <class 'sqlglot.expressions.StartsWith'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.StrPosition'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.TimeToStr'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.Xor'>: <function ClickHouse.Generator.<lambda>>}
PROPERTIES_LOCATION =
{<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.DataBlocksizeProperty'>: <Location.POST_NAME: 'POST_NAME'>, <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.DistKeyProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DistStyleProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.EngineProperty'>: <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.InputModelProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.IsolatedLoadingProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.JournalProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.LanguageProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.LikeProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.LocationProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.LockProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.LockingProperty'>: <Location.POST_ALIAS: 'POST_ALIAS'>, <class 'sqlglot.expressions.LogProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.MaterializedProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.MergeBlockRatioProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.NoPrimaryIndexProperty'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.OnProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.OnCommitProperty'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.Order'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.OutputModelProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.PartitionedByProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.PartitionedOfProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.PrimaryKey'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.Property'>: <Location.POST_WITH: 'POST_WITH'>, <class 'sqlglot.expressions.RemoteWithConnectionModelProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ReturnsProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.RowFormatProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.RowFormatDelimitedProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.RowFormatSerdeProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SampleProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SchemaCommentProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.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.TemporaryProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.ToTableProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.TransientProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <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.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.WithSystemVersioningProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.OnCluster'>: <Location.POST_NAME: 'POST_NAME'>}
ON_CLUSTER_TARGETS =
{'FUNCTION', 'INDEX', 'DICTIONARY', 'DATABASE', 'VIEW', 'NAMED COLLECTION', 'TABLE'}
783 def datatype_sql(self, expression: exp.DataType) -> str: 784 # String is the standard ClickHouse type, every other variant is just an alias. 785 # Additionally, any supplied length parameter will be ignored. 786 # 787 # https://clickhouse.com/docs/en/sql-reference/data-types/string 788 if expression.this in self.STRING_TYPE_MAPPING: 789 return "String" 790 791 return super().datatype_sql(expression)
801 def after_limit_modifiers(self, expression: exp.Expression) -> t.List[str]: 802 return super().after_limit_modifiers(expression) + [ 803 ( 804 self.seg("SETTINGS ") + self.expressions(expression, key="settings", flat=True) 805 if expression.args.get("settings") 806 else "" 807 ), 808 ( 809 self.seg("FORMAT ") + self.sql(expression, "format") 810 if expression.args.get("format") 811 else "" 812 ), 813 ]
def
combinedparameterizedagg_sql(self, expression: sqlglot.expressions.CombinedParameterizedAgg) -> str:
834 def createable_sql(self, expression: exp.Create, locations: t.DefaultDict) -> str: 835 if expression.kind in self.ON_CLUSTER_TARGETS and locations.get( 836 exp.Properties.Location.POST_NAME 837 ): 838 this_name = self.sql(expression.this, "this") 839 this_properties = " ".join( 840 [self.sql(prop) for prop in locations[exp.Properties.Location.POST_NAME]] 841 ) 842 this_schema = self.schema_columns_sql(expression.this) 843 return f"{this_name}{self.sep()}{this_properties}{self.sep()}{this_schema}" 844 845 return super().createable_sql(expression, locations)
851 def indexcolumnconstraint_sql(self, expression: exp.IndexColumnConstraint) -> str: 852 this = self.sql(expression, "this") 853 this = f" {this}" if this else "" 854 expr = self.sql(expression, "expression") 855 expr = f" {expr}" if expr else "" 856 index_type = self.sql(expression, "index_type") 857 index_type = f" TYPE {index_type}" if index_type else "" 858 granularity = self.sql(expression, "granularity") 859 granularity = f" GRANULARITY {granularity}" if granularity else "" 860 861 return f"INDEX{this}{expr}{index_type}{granularity}"
AFTER_HAVING_MODIFIER_TRANSFORMS =
{'qualify': <function Generator.<lambda>>, 'windows': <function Generator.<lambda>>}
Inherited Members
- sqlglot.generator.Generator
- Generator
- NULL_ORDERING_SUPPORTED
- IGNORE_NULLS_IN_FUNC
- LOCKING_READS_SUPPORTED
- WRAP_DERIVED_VALUES
- CREATE_FUNCTION_RETURN_AS
- MATCHED_BY_SOURCE
- SINGLE_STRING_INTERVAL
- INTERVAL_ALLOWS_PLURAL_FORM
- LIMIT_FETCH
- LIMIT_ONLY_LITERALS
- RENAME_TABLE_WITH_DB
- INDEX_ON
- QUERY_HINT_SEP
- IS_BOOL_ALLOWED
- DUPLICATE_KEY_UPDATE_WITH_SET
- LIMIT_IS_TOP
- RETURNING_END
- COLUMN_JOIN_MARKS_SUPPORTED
- EXTRACT_ALLOWS_QUOTES
- TZ_TO_WITH_TIME_ZONE
- VALUES_AS_TABLE
- ALTER_TABLE_INCLUDE_COLUMN_KEYWORD
- UNNEST_WITH_ORDINALITY
- AGGREGATE_FILTER_SUPPORTED
- SEMI_ANTI_JOIN_WITH_SIDE
- COMPUTED_COLUMN_WITH_TYPE
- SUPPORTS_TABLE_COPY
- 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
- JSON_KEY_VALUE_PAIR_SEP
- INSERT_OVERWRITE
- SUPPORTS_SELECT_INTO
- SUPPORTS_UNLOGGED_TABLES
- SUPPORTS_CREATE_TABLE_LIKE
- LIKE_PROPERTY_INSIDE_SCHEMA
- MULTI_ARG_DISTINCT
- JSON_TYPE_REQUIRED_FOR_EXTRACTION
- JSON_PATH_BRACKETED_KEY_SUPPORTED
- JSON_PATH_SINGLE_QUOTE_ESCAPE
- COPY_PARAMS_ARE_WRAPPED
- COPY_PARAMS_EQ_REQUIRED
- COPY_HAS_INTO_KEYWORD
- STAR_MAPPING
- TIME_PART_SINGULARS
- TOKEN_MAPPING
- PARAMETER_TOKEN
- NAMED_PLACEHOLDER_TOKEN
- RESERVED_KEYWORDS
- WITH_SEPARATED_COMMENTS
- EXCLUDE_COMMENTS
- UNWRAPPED_INTERVAL_VALUES
- PARAMETERIZABLE_TEXT_TYPES
- EXPRESSIONS_WITHOUT_NESTED_CTES
- 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
- pad_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
- computedcolumnconstraint_sql
- autoincrementcolumnconstraint_sql
- compresscolumnconstraint_sql
- generatedasidentitycolumnconstraint_sql
- generatedasrowcolumnconstraint_sql
- periodforsystemtimeconstraint_sql
- notnullcolumnconstraint_sql
- transformcolumnconstraint_sql
- primarykeycolumnconstraint_sql
- uniquecolumnconstraint_sql
- create_sql
- sequenceproperties_sql
- clone_sql
- describe_sql
- heredoc_sql
- prepend_ctes
- with_sql
- tablealias_sql
- bitstring_sql
- hexstring_sql
- bytestring_sql
- unicodestring_sql
- rawstring_sql
- datatypeparam_sql
- directory_sql
- delete_sql
- drop_sql
- except_sql
- except_op
- fetch_sql
- filter_sql
- hint_sql
- indexparameters_sql
- index_sql
- identifier_sql
- inputoutputformat_sql
- national_sql
- properties_sql
- root_properties
- properties
- with_properties
- locate_properties
- property_name
- property_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
- intersect_sql
- intersect_op
- introducer_sql
- kill_sql
- pseudotype_sql
- objectidentifier_sql
- onconflict_sql
- returning_sql
- rowformatdelimitedproperty_sql
- withtablehint_sql
- indextablehint_sql
- historicaldata_sql
- table_parts
- table_sql
- tablesample_sql
- pivot_sql
- version_sql
- tuple_sql
- update_sql
- values_sql
- var_sql
- into_sql
- from_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
- queryoption_sql
- offset_limit_modifiers
- select_sql
- schema_sql
- schema_columns_sql
- star_sql
- parameter_sql
- sessionparameter_sql
- subquery_sql
- qualify_sql
- set_operations
- union_sql
- union_op
- unnest_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
- extract_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
- 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
- attimezone_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
- cast_sql
- currentdate_sql
- currenttimestamp_sql
- collate_sql
- command_sql
- comment_sql
- mergetreettlaction_sql
- mergetreettl_sql
- transaction_sql
- commit_sql
- rollback_sql
- altercolumn_sql
- alterdiststyle_sql
- altersortkey_sql
- renametable_sql
- renamecolumn_sql
- altertable_sql
- add_column_sql
- droppartition_sql
- addconstraint_sql
- distinct_sql
- ignorenulls_sql
- respectnulls_sql
- havingmax_sql
- intdiv_sql
- dpipe_sql
- div_sql
- overlaps_sql
- distance_sql
- dot_sql
- propertyeq_sql
- escape_sql
- glob_sql
- gt_sql
- gte_sql
- ilike_sql
- ilikeany_sql
- is_sql
- like_sql
- likeany_sql
- similarto_sql
- lt_sql
- lte_sql
- mod_sql
- mul_sql
- nullsafeeq_sql
- nullsafeneq_sql
- slice_sql
- sub_sql
- trycast_sql
- try_sql
- log_sql
- use_sql
- binary
- 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
- merge_sql
- tochar_sql
- tonumber_sql
- dictproperty_sql
- dictrange_sql
- dictsubproperty_sql
- clusteredbyproperty_sql
- anyvalue_sql
- querytransform_sql
- indexconstraintoption_sql
- checkcolumnconstraint_sql
- nvl2_sql
- comprehension_sql
- columnprefix_sql
- opclass_sql
- predict_sql
- forin_sql
- refresh_sql
- operator_sql
- toarray_sql
- tsordstotime_sql
- tsordstotimestamp_sql
- tsordstodate_sql
- unixdate_sql
- lastday_sql
- dateadd_sql
- arrayany_sql
- generateseries_sql
- struct_sql
- partitionrange_sql
- truncatetable_sql
- convert_sql
- copyparameter_sql
- credentials_sql
- copy_sql