Edit on GitHub

sqlglot.dialects.clickhouse

   1from __future__ import annotations
   2
   3import typing as t
   4
   5from sqlglot import exp, generator, parser, tokens
   6from sqlglot.dialects.dialect import (
   7    Dialect,
   8    NormalizationStrategy,
   9    arg_max_or_min_no_count,
  10    build_date_delta,
  11    build_formatted_time,
  12    inline_array_sql,
  13    json_extract_segments,
  14    json_path_key_only_name,
  15    no_pivot_sql,
  16    build_json_extract_path,
  17    rename_func,
  18    sha256_sql,
  19    var_map_sql,
  20    timestamptrunc_sql,
  21    unit_to_var,
  22)
  23from sqlglot.generator import Generator
  24from sqlglot.helper import is_int, seq_get
  25from sqlglot.tokens import Token, TokenType
  26
  27DATEΤΙΜΕ_DELTA = t.Union[exp.DateAdd, exp.DateDiff, exp.DateSub, exp.TimestampSub, exp.TimestampAdd]
  28
  29
  30def _build_date_format(args: t.List) -> exp.TimeToStr:
  31    expr = build_formatted_time(exp.TimeToStr, "clickhouse")(args)
  32
  33    timezone = seq_get(args, 2)
  34    if timezone:
  35        expr.set("timezone", timezone)
  36
  37    return expr
  38
  39
  40def _unix_to_time_sql(self: ClickHouse.Generator, expression: exp.UnixToTime) -> str:
  41    scale = expression.args.get("scale")
  42    timestamp = expression.this
  43
  44    if scale in (None, exp.UnixToTime.SECONDS):
  45        return self.func("fromUnixTimestamp", exp.cast(timestamp, exp.DataType.Type.BIGINT))
  46    if scale == exp.UnixToTime.MILLIS:
  47        return self.func("fromUnixTimestamp64Milli", exp.cast(timestamp, exp.DataType.Type.BIGINT))
  48    if scale == exp.UnixToTime.MICROS:
  49        return self.func("fromUnixTimestamp64Micro", exp.cast(timestamp, exp.DataType.Type.BIGINT))
  50    if scale == exp.UnixToTime.NANOS:
  51        return self.func("fromUnixTimestamp64Nano", exp.cast(timestamp, exp.DataType.Type.BIGINT))
  52
  53    return self.func(
  54        "fromUnixTimestamp",
  55        exp.cast(
  56            exp.Div(this=timestamp, expression=exp.func("POW", 10, scale)), exp.DataType.Type.BIGINT
  57        ),
  58    )
  59
  60
  61def _lower_func(sql: str) -> str:
  62    index = sql.index("(")
  63    return sql[:index].lower() + sql[index:]
  64
  65
  66def _quantile_sql(self: ClickHouse.Generator, expression: exp.Quantile) -> str:
  67    quantile = expression.args["quantile"]
  68    args = f"({self.sql(expression, 'this')})"
  69
  70    if isinstance(quantile, exp.Array):
  71        func = self.func("quantiles", *quantile)
  72    else:
  73        func = self.func("quantile", quantile)
  74
  75    return func + args
  76
  77
  78def _build_count_if(args: t.List) -> exp.CountIf | exp.CombinedAggFunc:
  79    if len(args) == 1:
  80        return exp.CountIf(this=seq_get(args, 0))
  81
  82    return exp.CombinedAggFunc(this="countIf", expressions=args, parts=("count", "If"))
  83
  84
  85def _build_str_to_date(args: t.List) -> exp.Cast | exp.Anonymous:
  86    if len(args) == 3:
  87        return exp.Anonymous(this="STR_TO_DATE", expressions=args)
  88
  89    strtodate = exp.StrToDate.from_arg_list(args)
  90    return exp.cast(strtodate, exp.DataType.build(exp.DataType.Type.DATETIME))
  91
  92
  93def _datetime_delta_sql(name: str) -> t.Callable[[Generator, DATEΤΙΜΕ_DELTA], str]:
  94    def _delta_sql(self: Generator, expression: DATEΤΙΜΕ_DELTA) -> str:
  95        if not expression.unit:
  96            return rename_func(name)(self, expression)
  97
  98        return self.func(
  99            name,
 100            unit_to_var(expression),
 101            expression.expression,
 102            expression.this,
 103        )
 104
 105    return _delta_sql
 106
 107
 108class ClickHouse(Dialect):
 109    NORMALIZE_FUNCTIONS: bool | str = False
 110    NULL_ORDERING = "nulls_are_last"
 111    SUPPORTS_USER_DEFINED_TYPES = False
 112    SAFE_DIVISION = True
 113    LOG_BASE_FIRST: t.Optional[bool] = None
 114    FORCE_EARLY_ALIAS_REF_EXPANSION = True
 115
 116    # https://github.com/ClickHouse/ClickHouse/issues/33935#issue-1112165779
 117    NORMALIZATION_STRATEGY = NormalizationStrategy.CASE_SENSITIVE
 118
 119    UNESCAPED_SEQUENCES = {
 120        "\\0": "\0",
 121    }
 122
 123    class Tokenizer(tokens.Tokenizer):
 124        COMMENTS = ["--", "#", "#!", ("/*", "*/")]
 125        IDENTIFIERS = ['"', "`"]
 126        STRING_ESCAPES = ["'", "\\"]
 127        BIT_STRINGS = [("0b", "")]
 128        HEX_STRINGS = [("0x", ""), ("0X", "")]
 129        HEREDOC_STRINGS = ["$"]
 130
 131        KEYWORDS = {
 132            **tokens.Tokenizer.KEYWORDS,
 133            "ATTACH": TokenType.COMMAND,
 134            "DATE32": TokenType.DATE32,
 135            "DATETIME64": TokenType.DATETIME64,
 136            "DICTIONARY": TokenType.DICTIONARY,
 137            "ENUM8": TokenType.ENUM8,
 138            "ENUM16": TokenType.ENUM16,
 139            "FINAL": TokenType.FINAL,
 140            "FIXEDSTRING": TokenType.FIXEDSTRING,
 141            "FLOAT32": TokenType.FLOAT,
 142            "FLOAT64": TokenType.DOUBLE,
 143            "GLOBAL": TokenType.GLOBAL,
 144            "INT256": TokenType.INT256,
 145            "LOWCARDINALITY": TokenType.LOWCARDINALITY,
 146            "MAP": TokenType.MAP,
 147            "NESTED": TokenType.NESTED,
 148            "SAMPLE": TokenType.TABLE_SAMPLE,
 149            "TUPLE": TokenType.STRUCT,
 150            "UINT128": TokenType.UINT128,
 151            "UINT16": TokenType.USMALLINT,
 152            "UINT256": TokenType.UINT256,
 153            "UINT32": TokenType.UINT,
 154            "UINT64": TokenType.UBIGINT,
 155            "UINT8": TokenType.UTINYINT,
 156            "IPV4": TokenType.IPV4,
 157            "IPV6": TokenType.IPV6,
 158            "AGGREGATEFUNCTION": TokenType.AGGREGATEFUNCTION,
 159            "SIMPLEAGGREGATEFUNCTION": TokenType.SIMPLEAGGREGATEFUNCTION,
 160            "SYSTEM": TokenType.COMMAND,
 161            "PREWHERE": TokenType.PREWHERE,
 162        }
 163        KEYWORDS.pop("/*+")
 164
 165        SINGLE_TOKENS = {
 166            **tokens.Tokenizer.SINGLE_TOKENS,
 167            "$": TokenType.HEREDOC_STRING,
 168        }
 169
 170    class Parser(parser.Parser):
 171        # Tested in ClickHouse's playground, it seems that the following two queries do the same thing
 172        # * select x from t1 union all select x from t2 limit 1;
 173        # * select x from t1 union all (select x from t2 limit 1);
 174        MODIFIERS_ATTACHED_TO_SET_OP = False
 175        INTERVAL_SPANS = False
 176
 177        FUNCTIONS = {
 178            **parser.Parser.FUNCTIONS,
 179            "ANY": exp.AnyValue.from_arg_list,
 180            "ARRAYSUM": exp.ArraySum.from_arg_list,
 181            "COUNTIF": _build_count_if,
 182            "DATE_ADD": build_date_delta(exp.DateAdd, default_unit=None),
 183            "DATEADD": build_date_delta(exp.DateAdd, default_unit=None),
 184            "DATE_DIFF": build_date_delta(exp.DateDiff, default_unit=None),
 185            "DATEDIFF": build_date_delta(exp.DateDiff, default_unit=None),
 186            "DATE_FORMAT": _build_date_format,
 187            "DATE_SUB": build_date_delta(exp.DateSub, default_unit=None),
 188            "DATESUB": build_date_delta(exp.DateSub, default_unit=None),
 189            "FORMATDATETIME": _build_date_format,
 190            "JSONEXTRACTSTRING": build_json_extract_path(
 191                exp.JSONExtractScalar, zero_based_indexing=False
 192            ),
 193            "MAP": parser.build_var_map,
 194            "MATCH": exp.RegexpLike.from_arg_list,
 195            "RANDCANONICAL": exp.Rand.from_arg_list,
 196            "STR_TO_DATE": _build_str_to_date,
 197            "TUPLE": exp.Struct.from_arg_list,
 198            "TIMESTAMP_SUB": build_date_delta(exp.TimestampSub, default_unit=None),
 199            "TIMESTAMPSUB": build_date_delta(exp.TimestampSub, default_unit=None),
 200            "TIMESTAMP_ADD": build_date_delta(exp.TimestampAdd, default_unit=None),
 201            "TIMESTAMPADD": build_date_delta(exp.TimestampAdd, default_unit=None),
 202            "UNIQ": exp.ApproxDistinct.from_arg_list,
 203            "XOR": lambda args: exp.Xor(expressions=args),
 204            "MD5": exp.MD5Digest.from_arg_list,
 205            "SHA256": lambda args: exp.SHA2(this=seq_get(args, 0), length=exp.Literal.number(256)),
 206            "SHA512": lambda args: exp.SHA2(this=seq_get(args, 0), length=exp.Literal.number(512)),
 207        }
 208
 209        AGG_FUNCTIONS = {
 210            "count",
 211            "min",
 212            "max",
 213            "sum",
 214            "avg",
 215            "any",
 216            "stddevPop",
 217            "stddevSamp",
 218            "varPop",
 219            "varSamp",
 220            "corr",
 221            "covarPop",
 222            "covarSamp",
 223            "entropy",
 224            "exponentialMovingAverage",
 225            "intervalLengthSum",
 226            "kolmogorovSmirnovTest",
 227            "mannWhitneyUTest",
 228            "median",
 229            "rankCorr",
 230            "sumKahan",
 231            "studentTTest",
 232            "welchTTest",
 233            "anyHeavy",
 234            "anyLast",
 235            "boundingRatio",
 236            "first_value",
 237            "last_value",
 238            "argMin",
 239            "argMax",
 240            "avgWeighted",
 241            "topK",
 242            "topKWeighted",
 243            "deltaSum",
 244            "deltaSumTimestamp",
 245            "groupArray",
 246            "groupArrayLast",
 247            "groupUniqArray",
 248            "groupArrayInsertAt",
 249            "groupArrayMovingAvg",
 250            "groupArrayMovingSum",
 251            "groupArraySample",
 252            "groupBitAnd",
 253            "groupBitOr",
 254            "groupBitXor",
 255            "groupBitmap",
 256            "groupBitmapAnd",
 257            "groupBitmapOr",
 258            "groupBitmapXor",
 259            "sumWithOverflow",
 260            "sumMap",
 261            "minMap",
 262            "maxMap",
 263            "skewSamp",
 264            "skewPop",
 265            "kurtSamp",
 266            "kurtPop",
 267            "uniq",
 268            "uniqExact",
 269            "uniqCombined",
 270            "uniqCombined64",
 271            "uniqHLL12",
 272            "uniqTheta",
 273            "quantile",
 274            "quantiles",
 275            "quantileExact",
 276            "quantilesExact",
 277            "quantileExactLow",
 278            "quantilesExactLow",
 279            "quantileExactHigh",
 280            "quantilesExactHigh",
 281            "quantileExactWeighted",
 282            "quantilesExactWeighted",
 283            "quantileTiming",
 284            "quantilesTiming",
 285            "quantileTimingWeighted",
 286            "quantilesTimingWeighted",
 287            "quantileDeterministic",
 288            "quantilesDeterministic",
 289            "quantileTDigest",
 290            "quantilesTDigest",
 291            "quantileTDigestWeighted",
 292            "quantilesTDigestWeighted",
 293            "quantileBFloat16",
 294            "quantilesBFloat16",
 295            "quantileBFloat16Weighted",
 296            "quantilesBFloat16Weighted",
 297            "simpleLinearRegression",
 298            "stochasticLinearRegression",
 299            "stochasticLogisticRegression",
 300            "categoricalInformationValue",
 301            "contingency",
 302            "cramersV",
 303            "cramersVBiasCorrected",
 304            "theilsU",
 305            "maxIntersections",
 306            "maxIntersectionsPosition",
 307            "meanZTest",
 308            "quantileInterpolatedWeighted",
 309            "quantilesInterpolatedWeighted",
 310            "quantileGK",
 311            "quantilesGK",
 312            "sparkBar",
 313            "sumCount",
 314            "largestTriangleThreeBuckets",
 315            "histogram",
 316            "sequenceMatch",
 317            "sequenceCount",
 318            "windowFunnel",
 319            "retention",
 320            "uniqUpTo",
 321            "sequenceNextNode",
 322            "exponentialTimeDecayedAvg",
 323        }
 324
 325        AGG_FUNCTIONS_SUFFIXES = [
 326            "If",
 327            "Array",
 328            "ArrayIf",
 329            "Map",
 330            "SimpleState",
 331            "State",
 332            "Merge",
 333            "MergeState",
 334            "ForEach",
 335            "Distinct",
 336            "OrDefault",
 337            "OrNull",
 338            "Resample",
 339            "ArgMin",
 340            "ArgMax",
 341        ]
 342
 343        FUNC_TOKENS = {
 344            *parser.Parser.FUNC_TOKENS,
 345            TokenType.SET,
 346        }
 347
 348        RESERVED_TOKENS = parser.Parser.RESERVED_TOKENS - {TokenType.SELECT}
 349
 350        ID_VAR_TOKENS = {
 351            *parser.Parser.ID_VAR_TOKENS,
 352            TokenType.LIKE,
 353        }
 354
 355        AGG_FUNC_MAPPING = (
 356            lambda functions, suffixes: {
 357                f"{f}{sfx}": (f, sfx) for sfx in (suffixes + [""]) for f in functions
 358            }
 359        )(AGG_FUNCTIONS, AGG_FUNCTIONS_SUFFIXES)
 360
 361        FUNCTIONS_WITH_ALIASED_ARGS = {*parser.Parser.FUNCTIONS_WITH_ALIASED_ARGS, "TUPLE"}
 362
 363        FUNCTION_PARSERS = {
 364            **parser.Parser.FUNCTION_PARSERS,
 365            "ARRAYJOIN": lambda self: self.expression(exp.Explode, this=self._parse_expression()),
 366            "QUANTILE": lambda self: self._parse_quantile(),
 367        }
 368
 369        FUNCTION_PARSERS.pop("MATCH")
 370
 371        NO_PAREN_FUNCTION_PARSERS = parser.Parser.NO_PAREN_FUNCTION_PARSERS.copy()
 372        NO_PAREN_FUNCTION_PARSERS.pop("ANY")
 373
 374        RANGE_PARSERS = {
 375            **parser.Parser.RANGE_PARSERS,
 376            TokenType.GLOBAL: lambda self, this: self._match(TokenType.IN)
 377            and self._parse_in(this, is_global=True),
 378        }
 379
 380        # The PLACEHOLDER entry is popped because 1) it doesn't affect Clickhouse (it corresponds to
 381        # the postgres-specific JSONBContains parser) and 2) it makes parsing the ternary op simpler.
 382        COLUMN_OPERATORS = parser.Parser.COLUMN_OPERATORS.copy()
 383        COLUMN_OPERATORS.pop(TokenType.PLACEHOLDER)
 384
 385        JOIN_KINDS = {
 386            *parser.Parser.JOIN_KINDS,
 387            TokenType.ANY,
 388            TokenType.ASOF,
 389            TokenType.ARRAY,
 390        }
 391
 392        TABLE_ALIAS_TOKENS = parser.Parser.TABLE_ALIAS_TOKENS - {
 393            TokenType.ANY,
 394            TokenType.ARRAY,
 395            TokenType.FINAL,
 396            TokenType.FORMAT,
 397            TokenType.SETTINGS,
 398        }
 399
 400        ALIAS_TOKENS = parser.Parser.ALIAS_TOKENS - {
 401            TokenType.FORMAT,
 402        }
 403
 404        LOG_DEFAULTS_TO_LN = True
 405
 406        QUERY_MODIFIER_PARSERS = {
 407            **parser.Parser.QUERY_MODIFIER_PARSERS,
 408            TokenType.SETTINGS: lambda self: (
 409                "settings",
 410                self._advance() or self._parse_csv(self._parse_assignment),
 411            ),
 412            TokenType.FORMAT: lambda self: ("format", self._advance() or self._parse_id_var()),
 413        }
 414
 415        CONSTRAINT_PARSERS = {
 416            **parser.Parser.CONSTRAINT_PARSERS,
 417            "INDEX": lambda self: self._parse_index_constraint(),
 418            "CODEC": lambda self: self._parse_compress(),
 419        }
 420
 421        ALTER_PARSERS = {
 422            **parser.Parser.ALTER_PARSERS,
 423            "REPLACE": lambda self: self._parse_alter_table_replace(),
 424        }
 425
 426        SCHEMA_UNNAMED_CONSTRAINTS = {
 427            *parser.Parser.SCHEMA_UNNAMED_CONSTRAINTS,
 428            "INDEX",
 429        }
 430
 431        def _parse_extract(self) -> exp.Extract | exp.Anonymous:
 432            index = self._index
 433            this = self._parse_bitwise()
 434            if self._match(TokenType.FROM):
 435                self._retreat(index)
 436                return super()._parse_extract()
 437
 438            # We return Anonymous here because extract and regexpExtract have different semantics,
 439            # so parsing extract(foo, bar) into RegexpExtract can potentially break queries. E.g.,
 440            # `extract('foobar', 'b')` works, but CH crashes for `regexpExtract('foobar', 'b')`.
 441            #
 442            # TODO: can we somehow convert the former into an equivalent `regexpExtract` call?
 443            self._match(TokenType.COMMA)
 444            return self.expression(
 445                exp.Anonymous, this="extract", expressions=[this, self._parse_bitwise()]
 446            )
 447
 448        def _parse_assignment(self) -> t.Optional[exp.Expression]:
 449            this = super()._parse_assignment()
 450
 451            if self._match(TokenType.PLACEHOLDER):
 452                return self.expression(
 453                    exp.If,
 454                    this=this,
 455                    true=self._parse_assignment(),
 456                    false=self._match(TokenType.COLON) and self._parse_assignment(),
 457                )
 458
 459            return this
 460
 461        def _parse_placeholder(self) -> t.Optional[exp.Expression]:
 462            """
 463            Parse a placeholder expression like SELECT {abc: UInt32} or FROM {table: Identifier}
 464            https://clickhouse.com/docs/en/sql-reference/syntax#defining-and-using-query-parameters
 465            """
 466            if not self._match(TokenType.L_BRACE):
 467                return None
 468
 469            this = self._parse_id_var()
 470            self._match(TokenType.COLON)
 471            kind = self._parse_types(check_func=False, allow_identifiers=False) or (
 472                self._match_text_seq("IDENTIFIER") and "Identifier"
 473            )
 474
 475            if not kind:
 476                self.raise_error("Expecting a placeholder type or 'Identifier' for tables")
 477            elif not self._match(TokenType.R_BRACE):
 478                self.raise_error("Expecting }")
 479
 480            return self.expression(exp.Placeholder, this=this, kind=kind)
 481
 482        def _parse_in(self, this: t.Optional[exp.Expression], is_global: bool = False) -> exp.In:
 483            this = super()._parse_in(this)
 484            this.set("is_global", is_global)
 485            return this
 486
 487        def _parse_table(
 488            self,
 489            schema: bool = False,
 490            joins: bool = False,
 491            alias_tokens: t.Optional[t.Collection[TokenType]] = None,
 492            parse_bracket: bool = False,
 493            is_db_reference: bool = False,
 494            parse_partition: bool = False,
 495        ) -> t.Optional[exp.Expression]:
 496            this = super()._parse_table(
 497                schema=schema,
 498                joins=joins,
 499                alias_tokens=alias_tokens,
 500                parse_bracket=parse_bracket,
 501                is_db_reference=is_db_reference,
 502            )
 503
 504            if self._match(TokenType.FINAL):
 505                this = self.expression(exp.Final, this=this)
 506
 507            return this
 508
 509        def _parse_position(self, haystack_first: bool = False) -> exp.StrPosition:
 510            return super()._parse_position(haystack_first=True)
 511
 512        # https://clickhouse.com/docs/en/sql-reference/statements/select/with/
 513        def _parse_cte(self) -> exp.CTE:
 514            # WITH <identifier> AS <subquery expression>
 515            cte: t.Optional[exp.CTE] = self._try_parse(super()._parse_cte)
 516
 517            if not cte:
 518                # WITH <expression> AS <identifier>
 519                cte = self.expression(
 520                    exp.CTE,
 521                    this=self._parse_assignment(),
 522                    alias=self._parse_table_alias(),
 523                    scalar=True,
 524                )
 525
 526            return cte
 527
 528        def _parse_join_parts(
 529            self,
 530        ) -> t.Tuple[t.Optional[Token], t.Optional[Token], t.Optional[Token]]:
 531            is_global = self._match(TokenType.GLOBAL) and self._prev
 532            kind_pre = self._match_set(self.JOIN_KINDS, advance=False) and self._prev
 533
 534            if kind_pre:
 535                kind = self._match_set(self.JOIN_KINDS) and self._prev
 536                side = self._match_set(self.JOIN_SIDES) and self._prev
 537                return is_global, side, kind
 538
 539            return (
 540                is_global,
 541                self._match_set(self.JOIN_SIDES) and self._prev,
 542                self._match_set(self.JOIN_KINDS) and self._prev,
 543            )
 544
 545        def _parse_join(
 546            self, skip_join_token: bool = False, parse_bracket: bool = False
 547        ) -> t.Optional[exp.Join]:
 548            join = super()._parse_join(skip_join_token=skip_join_token, parse_bracket=True)
 549            if join:
 550                join.set("global", join.args.pop("method", None))
 551
 552            return join
 553
 554        def _parse_function(
 555            self,
 556            functions: t.Optional[t.Dict[str, t.Callable]] = None,
 557            anonymous: bool = False,
 558            optional_parens: bool = True,
 559            any_token: bool = False,
 560        ) -> t.Optional[exp.Expression]:
 561            expr = super()._parse_function(
 562                functions=functions,
 563                anonymous=anonymous,
 564                optional_parens=optional_parens,
 565                any_token=any_token,
 566            )
 567
 568            func = expr.this if isinstance(expr, exp.Window) else expr
 569
 570            # Aggregate functions can be split in 2 parts: <func_name><suffix>
 571            parts = (
 572                self.AGG_FUNC_MAPPING.get(func.this) if isinstance(func, exp.Anonymous) else None
 573            )
 574
 575            if parts:
 576                params = self._parse_func_params(func)
 577
 578                kwargs = {
 579                    "this": func.this,
 580                    "expressions": func.expressions,
 581                }
 582                if parts[1]:
 583                    kwargs["parts"] = parts
 584                    exp_class = exp.CombinedParameterizedAgg if params else exp.CombinedAggFunc
 585                else:
 586                    exp_class = exp.ParameterizedAgg if params else exp.AnonymousAggFunc
 587
 588                kwargs["exp_class"] = exp_class
 589                if params:
 590                    kwargs["params"] = params
 591
 592                func = self.expression(**kwargs)
 593
 594                if isinstance(expr, exp.Window):
 595                    # The window's func was parsed as Anonymous in base parser, fix its
 596                    # type to be CH style CombinedAnonymousAggFunc / AnonymousAggFunc
 597                    expr.set("this", func)
 598                elif params:
 599                    # Params have blocked super()._parse_function() from parsing the following window
 600                    # (if that exists) as they're standing between the function call and the window spec
 601                    expr = self._parse_window(func)
 602                else:
 603                    expr = func
 604
 605            return expr
 606
 607        def _parse_func_params(
 608            self, this: t.Optional[exp.Func] = None
 609        ) -> t.Optional[t.List[exp.Expression]]:
 610            if self._match_pair(TokenType.R_PAREN, TokenType.L_PAREN):
 611                return self._parse_csv(self._parse_lambda)
 612
 613            if self._match(TokenType.L_PAREN):
 614                params = self._parse_csv(self._parse_lambda)
 615                self._match_r_paren(this)
 616                return params
 617
 618            return None
 619
 620        def _parse_quantile(self) -> exp.Quantile:
 621            this = self._parse_lambda()
 622            params = self._parse_func_params()
 623            if params:
 624                return self.expression(exp.Quantile, this=params[0], quantile=this)
 625            return self.expression(exp.Quantile, this=this, quantile=exp.Literal.number(0.5))
 626
 627        def _parse_wrapped_id_vars(self, optional: bool = False) -> t.List[exp.Expression]:
 628            return super()._parse_wrapped_id_vars(optional=True)
 629
 630        def _parse_primary_key(
 631            self, wrapped_optional: bool = False, in_props: bool = False
 632        ) -> exp.PrimaryKeyColumnConstraint | exp.PrimaryKey:
 633            return super()._parse_primary_key(
 634                wrapped_optional=wrapped_optional or in_props, in_props=in_props
 635            )
 636
 637        def _parse_on_property(self) -> t.Optional[exp.Expression]:
 638            index = self._index
 639            if self._match_text_seq("CLUSTER"):
 640                this = self._parse_id_var()
 641                if this:
 642                    return self.expression(exp.OnCluster, this=this)
 643                else:
 644                    self._retreat(index)
 645            return None
 646
 647        def _parse_index_constraint(
 648            self, kind: t.Optional[str] = None
 649        ) -> exp.IndexColumnConstraint:
 650            # INDEX name1 expr TYPE type1(args) GRANULARITY value
 651            this = self._parse_id_var()
 652            expression = self._parse_assignment()
 653
 654            index_type = self._match_text_seq("TYPE") and (
 655                self._parse_function() or self._parse_var()
 656            )
 657
 658            granularity = self._match_text_seq("GRANULARITY") and self._parse_term()
 659
 660            return self.expression(
 661                exp.IndexColumnConstraint,
 662                this=this,
 663                expression=expression,
 664                index_type=index_type,
 665                granularity=granularity,
 666            )
 667
 668        def _parse_partition(self) -> t.Optional[exp.Partition]:
 669            # https://clickhouse.com/docs/en/sql-reference/statements/alter/partition#how-to-set-partition-expression
 670            if not self._match(TokenType.PARTITION):
 671                return None
 672
 673            if self._match_text_seq("ID"):
 674                # Corresponds to the PARTITION ID <string_value> syntax
 675                expressions: t.List[exp.Expression] = [
 676                    self.expression(exp.PartitionId, this=self._parse_string())
 677                ]
 678            else:
 679                expressions = self._parse_expressions()
 680
 681            return self.expression(exp.Partition, expressions=expressions)
 682
 683        def _parse_alter_table_replace(self) -> t.Optional[exp.Expression]:
 684            partition = self._parse_partition()
 685
 686            if not partition or not self._match(TokenType.FROM):
 687                return None
 688
 689            return self.expression(
 690                exp.ReplacePartition, expression=partition, source=self._parse_table_parts()
 691            )
 692
 693        def _parse_projection_def(self) -> t.Optional[exp.ProjectionDef]:
 694            if not self._match_text_seq("PROJECTION"):
 695                return None
 696
 697            return self.expression(
 698                exp.ProjectionDef,
 699                this=self._parse_id_var(),
 700                expression=self._parse_wrapped(self._parse_statement),
 701            )
 702
 703        def _parse_constraint(self) -> t.Optional[exp.Expression]:
 704            return super()._parse_constraint() or self._parse_projection_def()
 705
 706    class Generator(generator.Generator):
 707        QUERY_HINTS = False
 708        STRUCT_DELIMITER = ("(", ")")
 709        NVL2_SUPPORTED = False
 710        TABLESAMPLE_REQUIRES_PARENS = False
 711        TABLESAMPLE_SIZE_IS_ROWS = False
 712        TABLESAMPLE_KEYWORDS = "SAMPLE"
 713        LAST_DAY_SUPPORTS_DATE_PART = False
 714        CAN_IMPLEMENT_ARRAY_ANY = True
 715        SUPPORTS_TO_NUMBER = False
 716        JOIN_HINTS = False
 717        TABLE_HINTS = False
 718        EXPLICIT_SET_OP = True
 719        GROUPINGS_SEP = ""
 720        SET_OP_MODIFIERS = False
 721        SUPPORTS_TABLE_ALIAS_COLUMNS = False
 722        VALUES_AS_TABLE = False
 723
 724        STRING_TYPE_MAPPING = {
 725            exp.DataType.Type.CHAR: "String",
 726            exp.DataType.Type.LONGBLOB: "String",
 727            exp.DataType.Type.LONGTEXT: "String",
 728            exp.DataType.Type.MEDIUMBLOB: "String",
 729            exp.DataType.Type.MEDIUMTEXT: "String",
 730            exp.DataType.Type.TINYBLOB: "String",
 731            exp.DataType.Type.TINYTEXT: "String",
 732            exp.DataType.Type.TEXT: "String",
 733            exp.DataType.Type.VARBINARY: "String",
 734            exp.DataType.Type.VARCHAR: "String",
 735        }
 736
 737        SUPPORTED_JSON_PATH_PARTS = {
 738            exp.JSONPathKey,
 739            exp.JSONPathRoot,
 740            exp.JSONPathSubscript,
 741        }
 742
 743        TYPE_MAPPING = {
 744            **generator.Generator.TYPE_MAPPING,
 745            **STRING_TYPE_MAPPING,
 746            exp.DataType.Type.ARRAY: "Array",
 747            exp.DataType.Type.BIGINT: "Int64",
 748            exp.DataType.Type.DATE32: "Date32",
 749            exp.DataType.Type.DATETIME64: "DateTime64",
 750            exp.DataType.Type.DOUBLE: "Float64",
 751            exp.DataType.Type.ENUM: "Enum",
 752            exp.DataType.Type.ENUM8: "Enum8",
 753            exp.DataType.Type.ENUM16: "Enum16",
 754            exp.DataType.Type.FIXEDSTRING: "FixedString",
 755            exp.DataType.Type.FLOAT: "Float32",
 756            exp.DataType.Type.INT: "Int32",
 757            exp.DataType.Type.MEDIUMINT: "Int32",
 758            exp.DataType.Type.INT128: "Int128",
 759            exp.DataType.Type.INT256: "Int256",
 760            exp.DataType.Type.LOWCARDINALITY: "LowCardinality",
 761            exp.DataType.Type.MAP: "Map",
 762            exp.DataType.Type.NESTED: "Nested",
 763            exp.DataType.Type.NULLABLE: "Nullable",
 764            exp.DataType.Type.SMALLINT: "Int16",
 765            exp.DataType.Type.STRUCT: "Tuple",
 766            exp.DataType.Type.TINYINT: "Int8",
 767            exp.DataType.Type.UBIGINT: "UInt64",
 768            exp.DataType.Type.UINT: "UInt32",
 769            exp.DataType.Type.UINT128: "UInt128",
 770            exp.DataType.Type.UINT256: "UInt256",
 771            exp.DataType.Type.USMALLINT: "UInt16",
 772            exp.DataType.Type.UTINYINT: "UInt8",
 773            exp.DataType.Type.IPV4: "IPv4",
 774            exp.DataType.Type.IPV6: "IPv6",
 775            exp.DataType.Type.AGGREGATEFUNCTION: "AggregateFunction",
 776            exp.DataType.Type.SIMPLEAGGREGATEFUNCTION: "SimpleAggregateFunction",
 777        }
 778
 779        TRANSFORMS = {
 780            **generator.Generator.TRANSFORMS,
 781            exp.AnyValue: rename_func("any"),
 782            exp.ApproxDistinct: rename_func("uniq"),
 783            exp.ArrayFilter: lambda self, e: self.func("arrayFilter", e.expression, e.this),
 784            exp.ArraySize: rename_func("LENGTH"),
 785            exp.ArraySum: rename_func("arraySum"),
 786            exp.ArgMax: arg_max_or_min_no_count("argMax"),
 787            exp.ArgMin: arg_max_or_min_no_count("argMin"),
 788            exp.Array: inline_array_sql,
 789            exp.CastToStrType: rename_func("CAST"),
 790            exp.CountIf: rename_func("countIf"),
 791            exp.CompressColumnConstraint: lambda self,
 792            e: f"CODEC({self.expressions(e, key='this', flat=True)})",
 793            exp.ComputedColumnConstraint: lambda self,
 794            e: f"{'MATERIALIZED' if e.args.get('persisted') else 'ALIAS'} {self.sql(e, 'this')}",
 795            exp.CurrentDate: lambda self, e: self.func("CURRENT_DATE"),
 796            exp.DateAdd: _datetime_delta_sql("DATE_ADD"),
 797            exp.DateDiff: _datetime_delta_sql("DATE_DIFF"),
 798            exp.DateStrToDate: rename_func("toDate"),
 799            exp.DateSub: _datetime_delta_sql("DATE_SUB"),
 800            exp.Explode: rename_func("arrayJoin"),
 801            exp.Final: lambda self, e: f"{self.sql(e, 'this')} FINAL",
 802            exp.IsNan: rename_func("isNaN"),
 803            exp.JSONExtract: json_extract_segments("JSONExtractString", quoted_index=False),
 804            exp.JSONExtractScalar: json_extract_segments("JSONExtractString", quoted_index=False),
 805            exp.JSONPathKey: json_path_key_only_name,
 806            exp.JSONPathRoot: lambda *_: "",
 807            exp.Map: lambda self, e: _lower_func(var_map_sql(self, e)),
 808            exp.Nullif: rename_func("nullIf"),
 809            exp.PartitionedByProperty: lambda self, e: f"PARTITION BY {self.sql(e, 'this')}",
 810            exp.Pivot: no_pivot_sql,
 811            exp.Quantile: _quantile_sql,
 812            exp.RegexpLike: lambda self, e: self.func("match", e.this, e.expression),
 813            exp.Rand: rename_func("randCanonical"),
 814            exp.StartsWith: rename_func("startsWith"),
 815            exp.StrPosition: lambda self, e: self.func(
 816                "position", e.this, e.args.get("substr"), e.args.get("position")
 817            ),
 818            exp.TimeToStr: lambda self, e: self.func(
 819                "DATE_FORMAT", e.this, self.format_time(e), e.args.get("timezone")
 820            ),
 821            exp.TimestampAdd: _datetime_delta_sql("TIMESTAMP_ADD"),
 822            exp.TimestampSub: _datetime_delta_sql("TIMESTAMP_SUB"),
 823            exp.VarMap: lambda self, e: _lower_func(var_map_sql(self, e)),
 824            exp.Xor: lambda self, e: self.func("xor", e.this, e.expression, *e.expressions),
 825            exp.MD5Digest: rename_func("MD5"),
 826            exp.MD5: lambda self, e: self.func("LOWER", self.func("HEX", self.func("MD5", e.this))),
 827            exp.SHA: rename_func("SHA1"),
 828            exp.SHA2: sha256_sql,
 829            exp.UnixToTime: _unix_to_time_sql,
 830            exp.TimestampTrunc: timestamptrunc_sql(zone=True),
 831            exp.Variance: rename_func("varSamp"),
 832            exp.SchemaCommentProperty: lambda self, e: self.naked_property(e),
 833            exp.Stddev: rename_func("stddevSamp"),
 834        }
 835
 836        PROPERTIES_LOCATION = {
 837            **generator.Generator.PROPERTIES_LOCATION,
 838            exp.VolatileProperty: exp.Properties.Location.UNSUPPORTED,
 839            exp.PartitionedByProperty: exp.Properties.Location.POST_SCHEMA,
 840            exp.OnCluster: exp.Properties.Location.POST_NAME,
 841        }
 842
 843        # there's no list in docs, but it can be found in Clickhouse code
 844        # see `ClickHouse/src/Parsers/ParserCreate*.cpp`
 845        ON_CLUSTER_TARGETS = {
 846            "DATABASE",
 847            "TABLE",
 848            "VIEW",
 849            "DICTIONARY",
 850            "INDEX",
 851            "FUNCTION",
 852            "NAMED COLLECTION",
 853        }
 854
 855        def strtodate_sql(self, expression: exp.StrToDate) -> str:
 856            strtodate_sql = self.function_fallback_sql(expression)
 857
 858            if not isinstance(expression.parent, exp.Cast):
 859                # StrToDate returns DATEs in other dialects (eg. postgres), so
 860                # this branch aims to improve the transpilation to clickhouse
 861                return f"CAST({strtodate_sql} AS DATE)"
 862
 863            return strtodate_sql
 864
 865        def cast_sql(self, expression: exp.Cast, safe_prefix: t.Optional[str] = None) -> str:
 866            this = expression.this
 867
 868            if isinstance(this, exp.StrToDate) and expression.to == exp.DataType.build("datetime"):
 869                return self.sql(this)
 870
 871            return super().cast_sql(expression, safe_prefix=safe_prefix)
 872
 873        def _jsonpathsubscript_sql(self, expression: exp.JSONPathSubscript) -> str:
 874            this = self.json_path_part(expression.this)
 875            return str(int(this) + 1) if is_int(this) else this
 876
 877        def likeproperty_sql(self, expression: exp.LikeProperty) -> str:
 878            return f"AS {self.sql(expression, 'this')}"
 879
 880        def _any_to_has(
 881            self,
 882            expression: exp.EQ | exp.NEQ,
 883            default: t.Callable[[t.Any], str],
 884            prefix: str = "",
 885        ) -> str:
 886            if isinstance(expression.left, exp.Any):
 887                arr = expression.left
 888                this = expression.right
 889            elif isinstance(expression.right, exp.Any):
 890                arr = expression.right
 891                this = expression.left
 892            else:
 893                return default(expression)
 894
 895            return prefix + self.func("has", arr.this.unnest(), this)
 896
 897        def eq_sql(self, expression: exp.EQ) -> str:
 898            return self._any_to_has(expression, super().eq_sql)
 899
 900        def neq_sql(self, expression: exp.NEQ) -> str:
 901            return self._any_to_has(expression, super().neq_sql, "NOT ")
 902
 903        def regexpilike_sql(self, expression: exp.RegexpILike) -> str:
 904            # Manually add a flag to make the search case-insensitive
 905            regex = self.func("CONCAT", "'(?i)'", expression.expression)
 906            return self.func("match", expression.this, regex)
 907
 908        def datatype_sql(self, expression: exp.DataType) -> str:
 909            # String is the standard ClickHouse type, every other variant is just an alias.
 910            # Additionally, any supplied length parameter will be ignored.
 911            #
 912            # https://clickhouse.com/docs/en/sql-reference/data-types/string
 913            if expression.this in self.STRING_TYPE_MAPPING:
 914                return "String"
 915
 916            return super().datatype_sql(expression)
 917
 918        def cte_sql(self, expression: exp.CTE) -> str:
 919            if expression.args.get("scalar"):
 920                this = self.sql(expression, "this")
 921                alias = self.sql(expression, "alias")
 922                return f"{this} AS {alias}"
 923
 924            return super().cte_sql(expression)
 925
 926        def after_limit_modifiers(self, expression: exp.Expression) -> t.List[str]:
 927            return super().after_limit_modifiers(expression) + [
 928                (
 929                    self.seg("SETTINGS ") + self.expressions(expression, key="settings", flat=True)
 930                    if expression.args.get("settings")
 931                    else ""
 932                ),
 933                (
 934                    self.seg("FORMAT ") + self.sql(expression, "format")
 935                    if expression.args.get("format")
 936                    else ""
 937                ),
 938            ]
 939
 940        def parameterizedagg_sql(self, expression: exp.ParameterizedAgg) -> str:
 941            params = self.expressions(expression, key="params", flat=True)
 942            return self.func(expression.name, *expression.expressions) + f"({params})"
 943
 944        def anonymousaggfunc_sql(self, expression: exp.AnonymousAggFunc) -> str:
 945            return self.func(expression.name, *expression.expressions)
 946
 947        def combinedaggfunc_sql(self, expression: exp.CombinedAggFunc) -> str:
 948            return self.anonymousaggfunc_sql(expression)
 949
 950        def combinedparameterizedagg_sql(self, expression: exp.CombinedParameterizedAgg) -> str:
 951            return self.parameterizedagg_sql(expression)
 952
 953        def placeholder_sql(self, expression: exp.Placeholder) -> str:
 954            return f"{{{expression.name}: {self.sql(expression, 'kind')}}}"
 955
 956        def oncluster_sql(self, expression: exp.OnCluster) -> str:
 957            return f"ON CLUSTER {self.sql(expression, 'this')}"
 958
 959        def createable_sql(self, expression: exp.Create, locations: t.DefaultDict) -> str:
 960            if expression.kind in self.ON_CLUSTER_TARGETS and locations.get(
 961                exp.Properties.Location.POST_NAME
 962            ):
 963                this_name = self.sql(expression.this, "this")
 964                this_properties = " ".join(
 965                    [self.sql(prop) for prop in locations[exp.Properties.Location.POST_NAME]]
 966                )
 967                this_schema = self.schema_columns_sql(expression.this)
 968                return f"{this_name}{self.sep()}{this_properties}{self.sep()}{this_schema}"
 969
 970            return super().createable_sql(expression, locations)
 971
 972        def prewhere_sql(self, expression: exp.PreWhere) -> str:
 973            this = self.indent(self.sql(expression, "this"))
 974            return f"{self.seg('PREWHERE')}{self.sep()}{this}"
 975
 976        def indexcolumnconstraint_sql(self, expression: exp.IndexColumnConstraint) -> str:
 977            this = self.sql(expression, "this")
 978            this = f" {this}" if this else ""
 979            expr = self.sql(expression, "expression")
 980            expr = f" {expr}" if expr else ""
 981            index_type = self.sql(expression, "index_type")
 982            index_type = f" TYPE {index_type}" if index_type else ""
 983            granularity = self.sql(expression, "granularity")
 984            granularity = f" GRANULARITY {granularity}" if granularity else ""
 985
 986            return f"INDEX{this}{expr}{index_type}{granularity}"
 987
 988        def partition_sql(self, expression: exp.Partition) -> str:
 989            return f"PARTITION {self.expressions(expression, flat=True)}"
 990
 991        def partitionid_sql(self, expression: exp.PartitionId) -> str:
 992            return f"ID {self.sql(expression.this)}"
 993
 994        def replacepartition_sql(self, expression: exp.ReplacePartition) -> str:
 995            return (
 996                f"REPLACE {self.sql(expression.expression)} FROM {self.sql(expression, 'source')}"
 997            )
 998
 999        def projectiondef_sql(self, expression: exp.ProjectionDef) -> str:
1000            return f"PROJECTION {self.sql(expression.this)} {self.wrap(expression.expression)}"
class ClickHouse(sqlglot.dialects.dialect.Dialect):
 109class ClickHouse(Dialect):
 110    NORMALIZE_FUNCTIONS: bool | str = False
 111    NULL_ORDERING = "nulls_are_last"
 112    SUPPORTS_USER_DEFINED_TYPES = False
 113    SAFE_DIVISION = True
 114    LOG_BASE_FIRST: t.Optional[bool] = None
 115    FORCE_EARLY_ALIAS_REF_EXPANSION = True
 116
 117    # https://github.com/ClickHouse/ClickHouse/issues/33935#issue-1112165779
 118    NORMALIZATION_STRATEGY = NormalizationStrategy.CASE_SENSITIVE
 119
 120    UNESCAPED_SEQUENCES = {
 121        "\\0": "\0",
 122    }
 123
 124    class Tokenizer(tokens.Tokenizer):
 125        COMMENTS = ["--", "#", "#!", ("/*", "*/")]
 126        IDENTIFIERS = ['"', "`"]
 127        STRING_ESCAPES = ["'", "\\"]
 128        BIT_STRINGS = [("0b", "")]
 129        HEX_STRINGS = [("0x", ""), ("0X", "")]
 130        HEREDOC_STRINGS = ["$"]
 131
 132        KEYWORDS = {
 133            **tokens.Tokenizer.KEYWORDS,
 134            "ATTACH": TokenType.COMMAND,
 135            "DATE32": TokenType.DATE32,
 136            "DATETIME64": TokenType.DATETIME64,
 137            "DICTIONARY": TokenType.DICTIONARY,
 138            "ENUM8": TokenType.ENUM8,
 139            "ENUM16": TokenType.ENUM16,
 140            "FINAL": TokenType.FINAL,
 141            "FIXEDSTRING": TokenType.FIXEDSTRING,
 142            "FLOAT32": TokenType.FLOAT,
 143            "FLOAT64": TokenType.DOUBLE,
 144            "GLOBAL": TokenType.GLOBAL,
 145            "INT256": TokenType.INT256,
 146            "LOWCARDINALITY": TokenType.LOWCARDINALITY,
 147            "MAP": TokenType.MAP,
 148            "NESTED": TokenType.NESTED,
 149            "SAMPLE": TokenType.TABLE_SAMPLE,
 150            "TUPLE": TokenType.STRUCT,
 151            "UINT128": TokenType.UINT128,
 152            "UINT16": TokenType.USMALLINT,
 153            "UINT256": TokenType.UINT256,
 154            "UINT32": TokenType.UINT,
 155            "UINT64": TokenType.UBIGINT,
 156            "UINT8": TokenType.UTINYINT,
 157            "IPV4": TokenType.IPV4,
 158            "IPV6": TokenType.IPV6,
 159            "AGGREGATEFUNCTION": TokenType.AGGREGATEFUNCTION,
 160            "SIMPLEAGGREGATEFUNCTION": TokenType.SIMPLEAGGREGATEFUNCTION,
 161            "SYSTEM": TokenType.COMMAND,
 162            "PREWHERE": TokenType.PREWHERE,
 163        }
 164        KEYWORDS.pop("/*+")
 165
 166        SINGLE_TOKENS = {
 167            **tokens.Tokenizer.SINGLE_TOKENS,
 168            "$": TokenType.HEREDOC_STRING,
 169        }
 170
 171    class Parser(parser.Parser):
 172        # Tested in ClickHouse's playground, it seems that the following two queries do the same thing
 173        # * select x from t1 union all select x from t2 limit 1;
 174        # * select x from t1 union all (select x from t2 limit 1);
 175        MODIFIERS_ATTACHED_TO_SET_OP = False
 176        INTERVAL_SPANS = False
 177
 178        FUNCTIONS = {
 179            **parser.Parser.FUNCTIONS,
 180            "ANY": exp.AnyValue.from_arg_list,
 181            "ARRAYSUM": exp.ArraySum.from_arg_list,
 182            "COUNTIF": _build_count_if,
 183            "DATE_ADD": build_date_delta(exp.DateAdd, default_unit=None),
 184            "DATEADD": build_date_delta(exp.DateAdd, default_unit=None),
 185            "DATE_DIFF": build_date_delta(exp.DateDiff, default_unit=None),
 186            "DATEDIFF": build_date_delta(exp.DateDiff, default_unit=None),
 187            "DATE_FORMAT": _build_date_format,
 188            "DATE_SUB": build_date_delta(exp.DateSub, default_unit=None),
 189            "DATESUB": build_date_delta(exp.DateSub, default_unit=None),
 190            "FORMATDATETIME": _build_date_format,
 191            "JSONEXTRACTSTRING": build_json_extract_path(
 192                exp.JSONExtractScalar, zero_based_indexing=False
 193            ),
 194            "MAP": parser.build_var_map,
 195            "MATCH": exp.RegexpLike.from_arg_list,
 196            "RANDCANONICAL": exp.Rand.from_arg_list,
 197            "STR_TO_DATE": _build_str_to_date,
 198            "TUPLE": exp.Struct.from_arg_list,
 199            "TIMESTAMP_SUB": build_date_delta(exp.TimestampSub, default_unit=None),
 200            "TIMESTAMPSUB": build_date_delta(exp.TimestampSub, default_unit=None),
 201            "TIMESTAMP_ADD": build_date_delta(exp.TimestampAdd, default_unit=None),
 202            "TIMESTAMPADD": build_date_delta(exp.TimestampAdd, default_unit=None),
 203            "UNIQ": exp.ApproxDistinct.from_arg_list,
 204            "XOR": lambda args: exp.Xor(expressions=args),
 205            "MD5": exp.MD5Digest.from_arg_list,
 206            "SHA256": lambda args: exp.SHA2(this=seq_get(args, 0), length=exp.Literal.number(256)),
 207            "SHA512": lambda args: exp.SHA2(this=seq_get(args, 0), length=exp.Literal.number(512)),
 208        }
 209
 210        AGG_FUNCTIONS = {
 211            "count",
 212            "min",
 213            "max",
 214            "sum",
 215            "avg",
 216            "any",
 217            "stddevPop",
 218            "stddevSamp",
 219            "varPop",
 220            "varSamp",
 221            "corr",
 222            "covarPop",
 223            "covarSamp",
 224            "entropy",
 225            "exponentialMovingAverage",
 226            "intervalLengthSum",
 227            "kolmogorovSmirnovTest",
 228            "mannWhitneyUTest",
 229            "median",
 230            "rankCorr",
 231            "sumKahan",
 232            "studentTTest",
 233            "welchTTest",
 234            "anyHeavy",
 235            "anyLast",
 236            "boundingRatio",
 237            "first_value",
 238            "last_value",
 239            "argMin",
 240            "argMax",
 241            "avgWeighted",
 242            "topK",
 243            "topKWeighted",
 244            "deltaSum",
 245            "deltaSumTimestamp",
 246            "groupArray",
 247            "groupArrayLast",
 248            "groupUniqArray",
 249            "groupArrayInsertAt",
 250            "groupArrayMovingAvg",
 251            "groupArrayMovingSum",
 252            "groupArraySample",
 253            "groupBitAnd",
 254            "groupBitOr",
 255            "groupBitXor",
 256            "groupBitmap",
 257            "groupBitmapAnd",
 258            "groupBitmapOr",
 259            "groupBitmapXor",
 260            "sumWithOverflow",
 261            "sumMap",
 262            "minMap",
 263            "maxMap",
 264            "skewSamp",
 265            "skewPop",
 266            "kurtSamp",
 267            "kurtPop",
 268            "uniq",
 269            "uniqExact",
 270            "uniqCombined",
 271            "uniqCombined64",
 272            "uniqHLL12",
 273            "uniqTheta",
 274            "quantile",
 275            "quantiles",
 276            "quantileExact",
 277            "quantilesExact",
 278            "quantileExactLow",
 279            "quantilesExactLow",
 280            "quantileExactHigh",
 281            "quantilesExactHigh",
 282            "quantileExactWeighted",
 283            "quantilesExactWeighted",
 284            "quantileTiming",
 285            "quantilesTiming",
 286            "quantileTimingWeighted",
 287            "quantilesTimingWeighted",
 288            "quantileDeterministic",
 289            "quantilesDeterministic",
 290            "quantileTDigest",
 291            "quantilesTDigest",
 292            "quantileTDigestWeighted",
 293            "quantilesTDigestWeighted",
 294            "quantileBFloat16",
 295            "quantilesBFloat16",
 296            "quantileBFloat16Weighted",
 297            "quantilesBFloat16Weighted",
 298            "simpleLinearRegression",
 299            "stochasticLinearRegression",
 300            "stochasticLogisticRegression",
 301            "categoricalInformationValue",
 302            "contingency",
 303            "cramersV",
 304            "cramersVBiasCorrected",
 305            "theilsU",
 306            "maxIntersections",
 307            "maxIntersectionsPosition",
 308            "meanZTest",
 309            "quantileInterpolatedWeighted",
 310            "quantilesInterpolatedWeighted",
 311            "quantileGK",
 312            "quantilesGK",
 313            "sparkBar",
 314            "sumCount",
 315            "largestTriangleThreeBuckets",
 316            "histogram",
 317            "sequenceMatch",
 318            "sequenceCount",
 319            "windowFunnel",
 320            "retention",
 321            "uniqUpTo",
 322            "sequenceNextNode",
 323            "exponentialTimeDecayedAvg",
 324        }
 325
 326        AGG_FUNCTIONS_SUFFIXES = [
 327            "If",
 328            "Array",
 329            "ArrayIf",
 330            "Map",
 331            "SimpleState",
 332            "State",
 333            "Merge",
 334            "MergeState",
 335            "ForEach",
 336            "Distinct",
 337            "OrDefault",
 338            "OrNull",
 339            "Resample",
 340            "ArgMin",
 341            "ArgMax",
 342        ]
 343
 344        FUNC_TOKENS = {
 345            *parser.Parser.FUNC_TOKENS,
 346            TokenType.SET,
 347        }
 348
 349        RESERVED_TOKENS = parser.Parser.RESERVED_TOKENS - {TokenType.SELECT}
 350
 351        ID_VAR_TOKENS = {
 352            *parser.Parser.ID_VAR_TOKENS,
 353            TokenType.LIKE,
 354        }
 355
 356        AGG_FUNC_MAPPING = (
 357            lambda functions, suffixes: {
 358                f"{f}{sfx}": (f, sfx) for sfx in (suffixes + [""]) for f in functions
 359            }
 360        )(AGG_FUNCTIONS, AGG_FUNCTIONS_SUFFIXES)
 361
 362        FUNCTIONS_WITH_ALIASED_ARGS = {*parser.Parser.FUNCTIONS_WITH_ALIASED_ARGS, "TUPLE"}
 363
 364        FUNCTION_PARSERS = {
 365            **parser.Parser.FUNCTION_PARSERS,
 366            "ARRAYJOIN": lambda self: self.expression(exp.Explode, this=self._parse_expression()),
 367            "QUANTILE": lambda self: self._parse_quantile(),
 368        }
 369
 370        FUNCTION_PARSERS.pop("MATCH")
 371
 372        NO_PAREN_FUNCTION_PARSERS = parser.Parser.NO_PAREN_FUNCTION_PARSERS.copy()
 373        NO_PAREN_FUNCTION_PARSERS.pop("ANY")
 374
 375        RANGE_PARSERS = {
 376            **parser.Parser.RANGE_PARSERS,
 377            TokenType.GLOBAL: lambda self, this: self._match(TokenType.IN)
 378            and self._parse_in(this, is_global=True),
 379        }
 380
 381        # The PLACEHOLDER entry is popped because 1) it doesn't affect Clickhouse (it corresponds to
 382        # the postgres-specific JSONBContains parser) and 2) it makes parsing the ternary op simpler.
 383        COLUMN_OPERATORS = parser.Parser.COLUMN_OPERATORS.copy()
 384        COLUMN_OPERATORS.pop(TokenType.PLACEHOLDER)
 385
 386        JOIN_KINDS = {
 387            *parser.Parser.JOIN_KINDS,
 388            TokenType.ANY,
 389            TokenType.ASOF,
 390            TokenType.ARRAY,
 391        }
 392
 393        TABLE_ALIAS_TOKENS = parser.Parser.TABLE_ALIAS_TOKENS - {
 394            TokenType.ANY,
 395            TokenType.ARRAY,
 396            TokenType.FINAL,
 397            TokenType.FORMAT,
 398            TokenType.SETTINGS,
 399        }
 400
 401        ALIAS_TOKENS = parser.Parser.ALIAS_TOKENS - {
 402            TokenType.FORMAT,
 403        }
 404
 405        LOG_DEFAULTS_TO_LN = True
 406
 407        QUERY_MODIFIER_PARSERS = {
 408            **parser.Parser.QUERY_MODIFIER_PARSERS,
 409            TokenType.SETTINGS: lambda self: (
 410                "settings",
 411                self._advance() or self._parse_csv(self._parse_assignment),
 412            ),
 413            TokenType.FORMAT: lambda self: ("format", self._advance() or self._parse_id_var()),
 414        }
 415
 416        CONSTRAINT_PARSERS = {
 417            **parser.Parser.CONSTRAINT_PARSERS,
 418            "INDEX": lambda self: self._parse_index_constraint(),
 419            "CODEC": lambda self: self._parse_compress(),
 420        }
 421
 422        ALTER_PARSERS = {
 423            **parser.Parser.ALTER_PARSERS,
 424            "REPLACE": lambda self: self._parse_alter_table_replace(),
 425        }
 426
 427        SCHEMA_UNNAMED_CONSTRAINTS = {
 428            *parser.Parser.SCHEMA_UNNAMED_CONSTRAINTS,
 429            "INDEX",
 430        }
 431
 432        def _parse_extract(self) -> exp.Extract | exp.Anonymous:
 433            index = self._index
 434            this = self._parse_bitwise()
 435            if self._match(TokenType.FROM):
 436                self._retreat(index)
 437                return super()._parse_extract()
 438
 439            # We return Anonymous here because extract and regexpExtract have different semantics,
 440            # so parsing extract(foo, bar) into RegexpExtract can potentially break queries. E.g.,
 441            # `extract('foobar', 'b')` works, but CH crashes for `regexpExtract('foobar', 'b')`.
 442            #
 443            # TODO: can we somehow convert the former into an equivalent `regexpExtract` call?
 444            self._match(TokenType.COMMA)
 445            return self.expression(
 446                exp.Anonymous, this="extract", expressions=[this, self._parse_bitwise()]
 447            )
 448
 449        def _parse_assignment(self) -> t.Optional[exp.Expression]:
 450            this = super()._parse_assignment()
 451
 452            if self._match(TokenType.PLACEHOLDER):
 453                return self.expression(
 454                    exp.If,
 455                    this=this,
 456                    true=self._parse_assignment(),
 457                    false=self._match(TokenType.COLON) and self._parse_assignment(),
 458                )
 459
 460            return this
 461
 462        def _parse_placeholder(self) -> t.Optional[exp.Expression]:
 463            """
 464            Parse a placeholder expression like SELECT {abc: UInt32} or FROM {table: Identifier}
 465            https://clickhouse.com/docs/en/sql-reference/syntax#defining-and-using-query-parameters
 466            """
 467            if not self._match(TokenType.L_BRACE):
 468                return None
 469
 470            this = self._parse_id_var()
 471            self._match(TokenType.COLON)
 472            kind = self._parse_types(check_func=False, allow_identifiers=False) or (
 473                self._match_text_seq("IDENTIFIER") and "Identifier"
 474            )
 475
 476            if not kind:
 477                self.raise_error("Expecting a placeholder type or 'Identifier' for tables")
 478            elif not self._match(TokenType.R_BRACE):
 479                self.raise_error("Expecting }")
 480
 481            return self.expression(exp.Placeholder, this=this, kind=kind)
 482
 483        def _parse_in(self, this: t.Optional[exp.Expression], is_global: bool = False) -> exp.In:
 484            this = super()._parse_in(this)
 485            this.set("is_global", is_global)
 486            return this
 487
 488        def _parse_table(
 489            self,
 490            schema: bool = False,
 491            joins: bool = False,
 492            alias_tokens: t.Optional[t.Collection[TokenType]] = None,
 493            parse_bracket: bool = False,
 494            is_db_reference: bool = False,
 495            parse_partition: bool = False,
 496        ) -> t.Optional[exp.Expression]:
 497            this = super()._parse_table(
 498                schema=schema,
 499                joins=joins,
 500                alias_tokens=alias_tokens,
 501                parse_bracket=parse_bracket,
 502                is_db_reference=is_db_reference,
 503            )
 504
 505            if self._match(TokenType.FINAL):
 506                this = self.expression(exp.Final, this=this)
 507
 508            return this
 509
 510        def _parse_position(self, haystack_first: bool = False) -> exp.StrPosition:
 511            return super()._parse_position(haystack_first=True)
 512
 513        # https://clickhouse.com/docs/en/sql-reference/statements/select/with/
 514        def _parse_cte(self) -> exp.CTE:
 515            # WITH <identifier> AS <subquery expression>
 516            cte: t.Optional[exp.CTE] = self._try_parse(super()._parse_cte)
 517
 518            if not cte:
 519                # WITH <expression> AS <identifier>
 520                cte = self.expression(
 521                    exp.CTE,
 522                    this=self._parse_assignment(),
 523                    alias=self._parse_table_alias(),
 524                    scalar=True,
 525                )
 526
 527            return cte
 528
 529        def _parse_join_parts(
 530            self,
 531        ) -> t.Tuple[t.Optional[Token], t.Optional[Token], t.Optional[Token]]:
 532            is_global = self._match(TokenType.GLOBAL) and self._prev
 533            kind_pre = self._match_set(self.JOIN_KINDS, advance=False) and self._prev
 534
 535            if kind_pre:
 536                kind = self._match_set(self.JOIN_KINDS) and self._prev
 537                side = self._match_set(self.JOIN_SIDES) and self._prev
 538                return is_global, side, kind
 539
 540            return (
 541                is_global,
 542                self._match_set(self.JOIN_SIDES) and self._prev,
 543                self._match_set(self.JOIN_KINDS) and self._prev,
 544            )
 545
 546        def _parse_join(
 547            self, skip_join_token: bool = False, parse_bracket: bool = False
 548        ) -> t.Optional[exp.Join]:
 549            join = super()._parse_join(skip_join_token=skip_join_token, parse_bracket=True)
 550            if join:
 551                join.set("global", join.args.pop("method", None))
 552
 553            return join
 554
 555        def _parse_function(
 556            self,
 557            functions: t.Optional[t.Dict[str, t.Callable]] = None,
 558            anonymous: bool = False,
 559            optional_parens: bool = True,
 560            any_token: bool = False,
 561        ) -> t.Optional[exp.Expression]:
 562            expr = super()._parse_function(
 563                functions=functions,
 564                anonymous=anonymous,
 565                optional_parens=optional_parens,
 566                any_token=any_token,
 567            )
 568
 569            func = expr.this if isinstance(expr, exp.Window) else expr
 570
 571            # Aggregate functions can be split in 2 parts: <func_name><suffix>
 572            parts = (
 573                self.AGG_FUNC_MAPPING.get(func.this) if isinstance(func, exp.Anonymous) else None
 574            )
 575
 576            if parts:
 577                params = self._parse_func_params(func)
 578
 579                kwargs = {
 580                    "this": func.this,
 581                    "expressions": func.expressions,
 582                }
 583                if parts[1]:
 584                    kwargs["parts"] = parts
 585                    exp_class = exp.CombinedParameterizedAgg if params else exp.CombinedAggFunc
 586                else:
 587                    exp_class = exp.ParameterizedAgg if params else exp.AnonymousAggFunc
 588
 589                kwargs["exp_class"] = exp_class
 590                if params:
 591                    kwargs["params"] = params
 592
 593                func = self.expression(**kwargs)
 594
 595                if isinstance(expr, exp.Window):
 596                    # The window's func was parsed as Anonymous in base parser, fix its
 597                    # type to be CH style CombinedAnonymousAggFunc / AnonymousAggFunc
 598                    expr.set("this", func)
 599                elif params:
 600                    # Params have blocked super()._parse_function() from parsing the following window
 601                    # (if that exists) as they're standing between the function call and the window spec
 602                    expr = self._parse_window(func)
 603                else:
 604                    expr = func
 605
 606            return expr
 607
 608        def _parse_func_params(
 609            self, this: t.Optional[exp.Func] = None
 610        ) -> t.Optional[t.List[exp.Expression]]:
 611            if self._match_pair(TokenType.R_PAREN, TokenType.L_PAREN):
 612                return self._parse_csv(self._parse_lambda)
 613
 614            if self._match(TokenType.L_PAREN):
 615                params = self._parse_csv(self._parse_lambda)
 616                self._match_r_paren(this)
 617                return params
 618
 619            return None
 620
 621        def _parse_quantile(self) -> exp.Quantile:
 622            this = self._parse_lambda()
 623            params = self._parse_func_params()
 624            if params:
 625                return self.expression(exp.Quantile, this=params[0], quantile=this)
 626            return self.expression(exp.Quantile, this=this, quantile=exp.Literal.number(0.5))
 627
 628        def _parse_wrapped_id_vars(self, optional: bool = False) -> t.List[exp.Expression]:
 629            return super()._parse_wrapped_id_vars(optional=True)
 630
 631        def _parse_primary_key(
 632            self, wrapped_optional: bool = False, in_props: bool = False
 633        ) -> exp.PrimaryKeyColumnConstraint | exp.PrimaryKey:
 634            return super()._parse_primary_key(
 635                wrapped_optional=wrapped_optional or in_props, in_props=in_props
 636            )
 637
 638        def _parse_on_property(self) -> t.Optional[exp.Expression]:
 639            index = self._index
 640            if self._match_text_seq("CLUSTER"):
 641                this = self._parse_id_var()
 642                if this:
 643                    return self.expression(exp.OnCluster, this=this)
 644                else:
 645                    self._retreat(index)
 646            return None
 647
 648        def _parse_index_constraint(
 649            self, kind: t.Optional[str] = None
 650        ) -> exp.IndexColumnConstraint:
 651            # INDEX name1 expr TYPE type1(args) GRANULARITY value
 652            this = self._parse_id_var()
 653            expression = self._parse_assignment()
 654
 655            index_type = self._match_text_seq("TYPE") and (
 656                self._parse_function() or self._parse_var()
 657            )
 658
 659            granularity = self._match_text_seq("GRANULARITY") and self._parse_term()
 660
 661            return self.expression(
 662                exp.IndexColumnConstraint,
 663                this=this,
 664                expression=expression,
 665                index_type=index_type,
 666                granularity=granularity,
 667            )
 668
 669        def _parse_partition(self) -> t.Optional[exp.Partition]:
 670            # https://clickhouse.com/docs/en/sql-reference/statements/alter/partition#how-to-set-partition-expression
 671            if not self._match(TokenType.PARTITION):
 672                return None
 673
 674            if self._match_text_seq("ID"):
 675                # Corresponds to the PARTITION ID <string_value> syntax
 676                expressions: t.List[exp.Expression] = [
 677                    self.expression(exp.PartitionId, this=self._parse_string())
 678                ]
 679            else:
 680                expressions = self._parse_expressions()
 681
 682            return self.expression(exp.Partition, expressions=expressions)
 683
 684        def _parse_alter_table_replace(self) -> t.Optional[exp.Expression]:
 685            partition = self._parse_partition()
 686
 687            if not partition or not self._match(TokenType.FROM):
 688                return None
 689
 690            return self.expression(
 691                exp.ReplacePartition, expression=partition, source=self._parse_table_parts()
 692            )
 693
 694        def _parse_projection_def(self) -> t.Optional[exp.ProjectionDef]:
 695            if not self._match_text_seq("PROJECTION"):
 696                return None
 697
 698            return self.expression(
 699                exp.ProjectionDef,
 700                this=self._parse_id_var(),
 701                expression=self._parse_wrapped(self._parse_statement),
 702            )
 703
 704        def _parse_constraint(self) -> t.Optional[exp.Expression]:
 705            return super()._parse_constraint() or self._parse_projection_def()
 706
 707    class Generator(generator.Generator):
 708        QUERY_HINTS = False
 709        STRUCT_DELIMITER = ("(", ")")
 710        NVL2_SUPPORTED = False
 711        TABLESAMPLE_REQUIRES_PARENS = False
 712        TABLESAMPLE_SIZE_IS_ROWS = False
 713        TABLESAMPLE_KEYWORDS = "SAMPLE"
 714        LAST_DAY_SUPPORTS_DATE_PART = False
 715        CAN_IMPLEMENT_ARRAY_ANY = True
 716        SUPPORTS_TO_NUMBER = False
 717        JOIN_HINTS = False
 718        TABLE_HINTS = False
 719        EXPLICIT_SET_OP = True
 720        GROUPINGS_SEP = ""
 721        SET_OP_MODIFIERS = False
 722        SUPPORTS_TABLE_ALIAS_COLUMNS = False
 723        VALUES_AS_TABLE = False
 724
 725        STRING_TYPE_MAPPING = {
 726            exp.DataType.Type.CHAR: "String",
 727            exp.DataType.Type.LONGBLOB: "String",
 728            exp.DataType.Type.LONGTEXT: "String",
 729            exp.DataType.Type.MEDIUMBLOB: "String",
 730            exp.DataType.Type.MEDIUMTEXT: "String",
 731            exp.DataType.Type.TINYBLOB: "String",
 732            exp.DataType.Type.TINYTEXT: "String",
 733            exp.DataType.Type.TEXT: "String",
 734            exp.DataType.Type.VARBINARY: "String",
 735            exp.DataType.Type.VARCHAR: "String",
 736        }
 737
 738        SUPPORTED_JSON_PATH_PARTS = {
 739            exp.JSONPathKey,
 740            exp.JSONPathRoot,
 741            exp.JSONPathSubscript,
 742        }
 743
 744        TYPE_MAPPING = {
 745            **generator.Generator.TYPE_MAPPING,
 746            **STRING_TYPE_MAPPING,
 747            exp.DataType.Type.ARRAY: "Array",
 748            exp.DataType.Type.BIGINT: "Int64",
 749            exp.DataType.Type.DATE32: "Date32",
 750            exp.DataType.Type.DATETIME64: "DateTime64",
 751            exp.DataType.Type.DOUBLE: "Float64",
 752            exp.DataType.Type.ENUM: "Enum",
 753            exp.DataType.Type.ENUM8: "Enum8",
 754            exp.DataType.Type.ENUM16: "Enum16",
 755            exp.DataType.Type.FIXEDSTRING: "FixedString",
 756            exp.DataType.Type.FLOAT: "Float32",
 757            exp.DataType.Type.INT: "Int32",
 758            exp.DataType.Type.MEDIUMINT: "Int32",
 759            exp.DataType.Type.INT128: "Int128",
 760            exp.DataType.Type.INT256: "Int256",
 761            exp.DataType.Type.LOWCARDINALITY: "LowCardinality",
 762            exp.DataType.Type.MAP: "Map",
 763            exp.DataType.Type.NESTED: "Nested",
 764            exp.DataType.Type.NULLABLE: "Nullable",
 765            exp.DataType.Type.SMALLINT: "Int16",
 766            exp.DataType.Type.STRUCT: "Tuple",
 767            exp.DataType.Type.TINYINT: "Int8",
 768            exp.DataType.Type.UBIGINT: "UInt64",
 769            exp.DataType.Type.UINT: "UInt32",
 770            exp.DataType.Type.UINT128: "UInt128",
 771            exp.DataType.Type.UINT256: "UInt256",
 772            exp.DataType.Type.USMALLINT: "UInt16",
 773            exp.DataType.Type.UTINYINT: "UInt8",
 774            exp.DataType.Type.IPV4: "IPv4",
 775            exp.DataType.Type.IPV6: "IPv6",
 776            exp.DataType.Type.AGGREGATEFUNCTION: "AggregateFunction",
 777            exp.DataType.Type.SIMPLEAGGREGATEFUNCTION: "SimpleAggregateFunction",
 778        }
 779
 780        TRANSFORMS = {
 781            **generator.Generator.TRANSFORMS,
 782            exp.AnyValue: rename_func("any"),
 783            exp.ApproxDistinct: rename_func("uniq"),
 784            exp.ArrayFilter: lambda self, e: self.func("arrayFilter", e.expression, e.this),
 785            exp.ArraySize: rename_func("LENGTH"),
 786            exp.ArraySum: rename_func("arraySum"),
 787            exp.ArgMax: arg_max_or_min_no_count("argMax"),
 788            exp.ArgMin: arg_max_or_min_no_count("argMin"),
 789            exp.Array: inline_array_sql,
 790            exp.CastToStrType: rename_func("CAST"),
 791            exp.CountIf: rename_func("countIf"),
 792            exp.CompressColumnConstraint: lambda self,
 793            e: f"CODEC({self.expressions(e, key='this', flat=True)})",
 794            exp.ComputedColumnConstraint: lambda self,
 795            e: f"{'MATERIALIZED' if e.args.get('persisted') else 'ALIAS'} {self.sql(e, 'this')}",
 796            exp.CurrentDate: lambda self, e: self.func("CURRENT_DATE"),
 797            exp.DateAdd: _datetime_delta_sql("DATE_ADD"),
 798            exp.DateDiff: _datetime_delta_sql("DATE_DIFF"),
 799            exp.DateStrToDate: rename_func("toDate"),
 800            exp.DateSub: _datetime_delta_sql("DATE_SUB"),
 801            exp.Explode: rename_func("arrayJoin"),
 802            exp.Final: lambda self, e: f"{self.sql(e, 'this')} FINAL",
 803            exp.IsNan: rename_func("isNaN"),
 804            exp.JSONExtract: json_extract_segments("JSONExtractString", quoted_index=False),
 805            exp.JSONExtractScalar: json_extract_segments("JSONExtractString", quoted_index=False),
 806            exp.JSONPathKey: json_path_key_only_name,
 807            exp.JSONPathRoot: lambda *_: "",
 808            exp.Map: lambda self, e: _lower_func(var_map_sql(self, e)),
 809            exp.Nullif: rename_func("nullIf"),
 810            exp.PartitionedByProperty: lambda self, e: f"PARTITION BY {self.sql(e, 'this')}",
 811            exp.Pivot: no_pivot_sql,
 812            exp.Quantile: _quantile_sql,
 813            exp.RegexpLike: lambda self, e: self.func("match", e.this, e.expression),
 814            exp.Rand: rename_func("randCanonical"),
 815            exp.StartsWith: rename_func("startsWith"),
 816            exp.StrPosition: lambda self, e: self.func(
 817                "position", e.this, e.args.get("substr"), e.args.get("position")
 818            ),
 819            exp.TimeToStr: lambda self, e: self.func(
 820                "DATE_FORMAT", e.this, self.format_time(e), e.args.get("timezone")
 821            ),
 822            exp.TimestampAdd: _datetime_delta_sql("TIMESTAMP_ADD"),
 823            exp.TimestampSub: _datetime_delta_sql("TIMESTAMP_SUB"),
 824            exp.VarMap: lambda self, e: _lower_func(var_map_sql(self, e)),
 825            exp.Xor: lambda self, e: self.func("xor", e.this, e.expression, *e.expressions),
 826            exp.MD5Digest: rename_func("MD5"),
 827            exp.MD5: lambda self, e: self.func("LOWER", self.func("HEX", self.func("MD5", e.this))),
 828            exp.SHA: rename_func("SHA1"),
 829            exp.SHA2: sha256_sql,
 830            exp.UnixToTime: _unix_to_time_sql,
 831            exp.TimestampTrunc: timestamptrunc_sql(zone=True),
 832            exp.Variance: rename_func("varSamp"),
 833            exp.SchemaCommentProperty: lambda self, e: self.naked_property(e),
 834            exp.Stddev: rename_func("stddevSamp"),
 835        }
 836
 837        PROPERTIES_LOCATION = {
 838            **generator.Generator.PROPERTIES_LOCATION,
 839            exp.VolatileProperty: exp.Properties.Location.UNSUPPORTED,
 840            exp.PartitionedByProperty: exp.Properties.Location.POST_SCHEMA,
 841            exp.OnCluster: exp.Properties.Location.POST_NAME,
 842        }
 843
 844        # there's no list in docs, but it can be found in Clickhouse code
 845        # see `ClickHouse/src/Parsers/ParserCreate*.cpp`
 846        ON_CLUSTER_TARGETS = {
 847            "DATABASE",
 848            "TABLE",
 849            "VIEW",
 850            "DICTIONARY",
 851            "INDEX",
 852            "FUNCTION",
 853            "NAMED COLLECTION",
 854        }
 855
 856        def strtodate_sql(self, expression: exp.StrToDate) -> str:
 857            strtodate_sql = self.function_fallback_sql(expression)
 858
 859            if not isinstance(expression.parent, exp.Cast):
 860                # StrToDate returns DATEs in other dialects (eg. postgres), so
 861                # this branch aims to improve the transpilation to clickhouse
 862                return f"CAST({strtodate_sql} AS DATE)"
 863
 864            return strtodate_sql
 865
 866        def cast_sql(self, expression: exp.Cast, safe_prefix: t.Optional[str] = None) -> str:
 867            this = expression.this
 868
 869            if isinstance(this, exp.StrToDate) and expression.to == exp.DataType.build("datetime"):
 870                return self.sql(this)
 871
 872            return super().cast_sql(expression, safe_prefix=safe_prefix)
 873
 874        def _jsonpathsubscript_sql(self, expression: exp.JSONPathSubscript) -> str:
 875            this = self.json_path_part(expression.this)
 876            return str(int(this) + 1) if is_int(this) else this
 877
 878        def likeproperty_sql(self, expression: exp.LikeProperty) -> str:
 879            return f"AS {self.sql(expression, 'this')}"
 880
 881        def _any_to_has(
 882            self,
 883            expression: exp.EQ | exp.NEQ,
 884            default: t.Callable[[t.Any], str],
 885            prefix: str = "",
 886        ) -> str:
 887            if isinstance(expression.left, exp.Any):
 888                arr = expression.left
 889                this = expression.right
 890            elif isinstance(expression.right, exp.Any):
 891                arr = expression.right
 892                this = expression.left
 893            else:
 894                return default(expression)
 895
 896            return prefix + self.func("has", arr.this.unnest(), this)
 897
 898        def eq_sql(self, expression: exp.EQ) -> str:
 899            return self._any_to_has(expression, super().eq_sql)
 900
 901        def neq_sql(self, expression: exp.NEQ) -> str:
 902            return self._any_to_has(expression, super().neq_sql, "NOT ")
 903
 904        def regexpilike_sql(self, expression: exp.RegexpILike) -> str:
 905            # Manually add a flag to make the search case-insensitive
 906            regex = self.func("CONCAT", "'(?i)'", expression.expression)
 907            return self.func("match", expression.this, regex)
 908
 909        def datatype_sql(self, expression: exp.DataType) -> str:
 910            # String is the standard ClickHouse type, every other variant is just an alias.
 911            # Additionally, any supplied length parameter will be ignored.
 912            #
 913            # https://clickhouse.com/docs/en/sql-reference/data-types/string
 914            if expression.this in self.STRING_TYPE_MAPPING:
 915                return "String"
 916
 917            return super().datatype_sql(expression)
 918
 919        def cte_sql(self, expression: exp.CTE) -> str:
 920            if expression.args.get("scalar"):
 921                this = self.sql(expression, "this")
 922                alias = self.sql(expression, "alias")
 923                return f"{this} AS {alias}"
 924
 925            return super().cte_sql(expression)
 926
 927        def after_limit_modifiers(self, expression: exp.Expression) -> t.List[str]:
 928            return super().after_limit_modifiers(expression) + [
 929                (
 930                    self.seg("SETTINGS ") + self.expressions(expression, key="settings", flat=True)
 931                    if expression.args.get("settings")
 932                    else ""
 933                ),
 934                (
 935                    self.seg("FORMAT ") + self.sql(expression, "format")
 936                    if expression.args.get("format")
 937                    else ""
 938                ),
 939            ]
 940
 941        def parameterizedagg_sql(self, expression: exp.ParameterizedAgg) -> str:
 942            params = self.expressions(expression, key="params", flat=True)
 943            return self.func(expression.name, *expression.expressions) + f"({params})"
 944
 945        def anonymousaggfunc_sql(self, expression: exp.AnonymousAggFunc) -> str:
 946            return self.func(expression.name, *expression.expressions)
 947
 948        def combinedaggfunc_sql(self, expression: exp.CombinedAggFunc) -> str:
 949            return self.anonymousaggfunc_sql(expression)
 950
 951        def combinedparameterizedagg_sql(self, expression: exp.CombinedParameterizedAgg) -> str:
 952            return self.parameterizedagg_sql(expression)
 953
 954        def placeholder_sql(self, expression: exp.Placeholder) -> str:
 955            return f"{{{expression.name}: {self.sql(expression, 'kind')}}}"
 956
 957        def oncluster_sql(self, expression: exp.OnCluster) -> str:
 958            return f"ON CLUSTER {self.sql(expression, 'this')}"
 959
 960        def createable_sql(self, expression: exp.Create, locations: t.DefaultDict) -> str:
 961            if expression.kind in self.ON_CLUSTER_TARGETS and locations.get(
 962                exp.Properties.Location.POST_NAME
 963            ):
 964                this_name = self.sql(expression.this, "this")
 965                this_properties = " ".join(
 966                    [self.sql(prop) for prop in locations[exp.Properties.Location.POST_NAME]]
 967                )
 968                this_schema = self.schema_columns_sql(expression.this)
 969                return f"{this_name}{self.sep()}{this_properties}{self.sep()}{this_schema}"
 970
 971            return super().createable_sql(expression, locations)
 972
 973        def prewhere_sql(self, expression: exp.PreWhere) -> str:
 974            this = self.indent(self.sql(expression, "this"))
 975            return f"{self.seg('PREWHERE')}{self.sep()}{this}"
 976
 977        def indexcolumnconstraint_sql(self, expression: exp.IndexColumnConstraint) -> str:
 978            this = self.sql(expression, "this")
 979            this = f" {this}" if this else ""
 980            expr = self.sql(expression, "expression")
 981            expr = f" {expr}" if expr else ""
 982            index_type = self.sql(expression, "index_type")
 983            index_type = f" TYPE {index_type}" if index_type else ""
 984            granularity = self.sql(expression, "granularity")
 985            granularity = f" GRANULARITY {granularity}" if granularity else ""
 986
 987            return f"INDEX{this}{expr}{index_type}{granularity}"
 988
 989        def partition_sql(self, expression: exp.Partition) -> str:
 990            return f"PARTITION {self.expressions(expression, flat=True)}"
 991
 992        def partitionid_sql(self, expression: exp.PartitionId) -> str:
 993            return f"ID {self.sql(expression.this)}"
 994
 995        def replacepartition_sql(self, expression: exp.ReplacePartition) -> str:
 996            return (
 997                f"REPLACE {self.sql(expression.expression)} FROM {self.sql(expression, 'source')}"
 998            )
 999
1000        def projectiondef_sql(self, expression: exp.ProjectionDef) -> str:
1001            return f"PROJECTION {self.sql(expression.this)} {self.wrap(expression.expression)}"
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"

SUPPORTS_USER_DEFINED_TYPES = False

Whether user-defined data types are supported.

SAFE_DIVISION = True

Whether division by zero throws an error (False) or returns NULL (True).

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)

FORCE_EARLY_ALIAS_REF_EXPANSION = True

Whether alias reference expansion (_expand_alias_refs()) should run before column qualification (_qualify_columns()).

For example:

WITH data AS ( SELECT 1 AS id, 2 AS my_id ) SELECT id AS my_id FROM data WHERE my_id = 1 GROUP BY my_id, HAVING my_id = 1

In most dialects "my_id" would refer to "data.my_id" (which is done in _qualify_columns()) across the query, except: - BigQuery, which will forward the alias to GROUP BY + HAVING clauses i.e it resolves to "WHERE my_id = 1 GROUP BY id HAVING id = 1" - Clickhouse, which will forward the alias across the query i.e it resolves to "WHERE id = 1 GROUP BY id HAVING id = 1"

NORMALIZATION_STRATEGY = <NormalizationStrategy.CASE_SENSITIVE: 'CASE_SENSITIVE'>

Specifies the strategy according to which identifiers should be normalized.

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 ( ).

SUPPORTS_COLUMN_JOIN_MARKS = False

Whether the old-style outer join (+) syntax is supported.

tokenizer_class = <class 'ClickHouse.Tokenizer'>
jsonpath_tokenizer_class = <class 'sqlglot.tokens.JSONPathTokenizer'>
parser_class = <class 'ClickHouse.Parser'>
generator_class = <class 'ClickHouse.Generator'>
TIME_TRIE: Dict = {}
FORMAT_TRIE: Dict = {}
INVERSE_TIME_MAPPING: Dict[str, str] = {}
INVERSE_TIME_TRIE: Dict = {}
INVERSE_FORMAT_MAPPING: Dict[str, str] = {}
INVERSE_FORMAT_TRIE: Dict = {}
ESCAPED_SEQUENCES: Dict[str, str] = {'\x07': '\\a', '\x08': '\\b', '\x0c': '\\f', '\n': '\\n', '\r': '\\r', '\t': '\\t', '\x0b': '\\v', '\\': '\\\\', '\x00': '\\0'}
QUOTE_START = "'"
QUOTE_END = "'"
IDENTIFIER_START = '"'
IDENTIFIER_END = '"'
BIT_START: Optional[str] = '0b'
BIT_END: Optional[str] = ''
HEX_START: Optional[str] = '0x'
HEX_END: Optional[str] = ''
BYTE_START: Optional[str] = None
BYTE_END: Optional[str] = None
UNICODE_START: Optional[str] = None
UNICODE_END: Optional[str] = None
class ClickHouse.Tokenizer(sqlglot.tokens.Tokenizer):
124    class Tokenizer(tokens.Tokenizer):
125        COMMENTS = ["--", "#", "#!", ("/*", "*/")]
126        IDENTIFIERS = ['"', "`"]
127        STRING_ESCAPES = ["'", "\\"]
128        BIT_STRINGS = [("0b", "")]
129        HEX_STRINGS = [("0x", ""), ("0X", "")]
130        HEREDOC_STRINGS = ["$"]
131
132        KEYWORDS = {
133            **tokens.Tokenizer.KEYWORDS,
134            "ATTACH": TokenType.COMMAND,
135            "DATE32": TokenType.DATE32,
136            "DATETIME64": TokenType.DATETIME64,
137            "DICTIONARY": TokenType.DICTIONARY,
138            "ENUM8": TokenType.ENUM8,
139            "ENUM16": TokenType.ENUM16,
140            "FINAL": TokenType.FINAL,
141            "FIXEDSTRING": TokenType.FIXEDSTRING,
142            "FLOAT32": TokenType.FLOAT,
143            "FLOAT64": TokenType.DOUBLE,
144            "GLOBAL": TokenType.GLOBAL,
145            "INT256": TokenType.INT256,
146            "LOWCARDINALITY": TokenType.LOWCARDINALITY,
147            "MAP": TokenType.MAP,
148            "NESTED": TokenType.NESTED,
149            "SAMPLE": TokenType.TABLE_SAMPLE,
150            "TUPLE": TokenType.STRUCT,
151            "UINT128": TokenType.UINT128,
152            "UINT16": TokenType.USMALLINT,
153            "UINT256": TokenType.UINT256,
154            "UINT32": TokenType.UINT,
155            "UINT64": TokenType.UBIGINT,
156            "UINT8": TokenType.UTINYINT,
157            "IPV4": TokenType.IPV4,
158            "IPV6": TokenType.IPV6,
159            "AGGREGATEFUNCTION": TokenType.AGGREGATEFUNCTION,
160            "SIMPLEAGGREGATEFUNCTION": TokenType.SIMPLEAGGREGATEFUNCTION,
161            "SYSTEM": TokenType.COMMAND,
162            "PREWHERE": TokenType.PREWHERE,
163        }
164        KEYWORDS.pop("/*+")
165
166        SINGLE_TOKENS = {
167            **tokens.Tokenizer.SINGLE_TOKENS,
168            "$": TokenType.HEREDOC_STRING,
169        }
COMMENTS = ['--', '#', '#!', ('/*', '*/')]
IDENTIFIERS = ['"', '`']
STRING_ESCAPES = ["'", '\\']
BIT_STRINGS = [('0b', '')]
HEX_STRINGS = [('0x', ''), ('0X', '')]
HEREDOC_STRINGS = ['$']
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.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'>, 'RENAME': <TokenType.RENAME: 'RENAME'>, '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'>, 'STRAIGHT_JOIN': <TokenType.STRAIGHT_JOIN: 'STRAIGHT_JOIN'>, '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'>, 'LIST': <TokenType.LIST: 'LIST'>, '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'>, 'JSONB': <TokenType.JSONB: 'JSONB'>, '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'>, 'VECTOR': <TokenType.VECTOR: 'VECTOR'>, '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'>}
class ClickHouse.Parser(sqlglot.parser.Parser):
171    class Parser(parser.Parser):
172        # Tested in ClickHouse's playground, it seems that the following two queries do the same thing
173        # * select x from t1 union all select x from t2 limit 1;
174        # * select x from t1 union all (select x from t2 limit 1);
175        MODIFIERS_ATTACHED_TO_SET_OP = False
176        INTERVAL_SPANS = False
177
178        FUNCTIONS = {
179            **parser.Parser.FUNCTIONS,
180            "ANY": exp.AnyValue.from_arg_list,
181            "ARRAYSUM": exp.ArraySum.from_arg_list,
182            "COUNTIF": _build_count_if,
183            "DATE_ADD": build_date_delta(exp.DateAdd, default_unit=None),
184            "DATEADD": build_date_delta(exp.DateAdd, default_unit=None),
185            "DATE_DIFF": build_date_delta(exp.DateDiff, default_unit=None),
186            "DATEDIFF": build_date_delta(exp.DateDiff, default_unit=None),
187            "DATE_FORMAT": _build_date_format,
188            "DATE_SUB": build_date_delta(exp.DateSub, default_unit=None),
189            "DATESUB": build_date_delta(exp.DateSub, default_unit=None),
190            "FORMATDATETIME": _build_date_format,
191            "JSONEXTRACTSTRING": build_json_extract_path(
192                exp.JSONExtractScalar, zero_based_indexing=False
193            ),
194            "MAP": parser.build_var_map,
195            "MATCH": exp.RegexpLike.from_arg_list,
196            "RANDCANONICAL": exp.Rand.from_arg_list,
197            "STR_TO_DATE": _build_str_to_date,
198            "TUPLE": exp.Struct.from_arg_list,
199            "TIMESTAMP_SUB": build_date_delta(exp.TimestampSub, default_unit=None),
200            "TIMESTAMPSUB": build_date_delta(exp.TimestampSub, default_unit=None),
201            "TIMESTAMP_ADD": build_date_delta(exp.TimestampAdd, default_unit=None),
202            "TIMESTAMPADD": build_date_delta(exp.TimestampAdd, default_unit=None),
203            "UNIQ": exp.ApproxDistinct.from_arg_list,
204            "XOR": lambda args: exp.Xor(expressions=args),
205            "MD5": exp.MD5Digest.from_arg_list,
206            "SHA256": lambda args: exp.SHA2(this=seq_get(args, 0), length=exp.Literal.number(256)),
207            "SHA512": lambda args: exp.SHA2(this=seq_get(args, 0), length=exp.Literal.number(512)),
208        }
209
210        AGG_FUNCTIONS = {
211            "count",
212            "min",
213            "max",
214            "sum",
215            "avg",
216            "any",
217            "stddevPop",
218            "stddevSamp",
219            "varPop",
220            "varSamp",
221            "corr",
222            "covarPop",
223            "covarSamp",
224            "entropy",
225            "exponentialMovingAverage",
226            "intervalLengthSum",
227            "kolmogorovSmirnovTest",
228            "mannWhitneyUTest",
229            "median",
230            "rankCorr",
231            "sumKahan",
232            "studentTTest",
233            "welchTTest",
234            "anyHeavy",
235            "anyLast",
236            "boundingRatio",
237            "first_value",
238            "last_value",
239            "argMin",
240            "argMax",
241            "avgWeighted",
242            "topK",
243            "topKWeighted",
244            "deltaSum",
245            "deltaSumTimestamp",
246            "groupArray",
247            "groupArrayLast",
248            "groupUniqArray",
249            "groupArrayInsertAt",
250            "groupArrayMovingAvg",
251            "groupArrayMovingSum",
252            "groupArraySample",
253            "groupBitAnd",
254            "groupBitOr",
255            "groupBitXor",
256            "groupBitmap",
257            "groupBitmapAnd",
258            "groupBitmapOr",
259            "groupBitmapXor",
260            "sumWithOverflow",
261            "sumMap",
262            "minMap",
263            "maxMap",
264            "skewSamp",
265            "skewPop",
266            "kurtSamp",
267            "kurtPop",
268            "uniq",
269            "uniqExact",
270            "uniqCombined",
271            "uniqCombined64",
272            "uniqHLL12",
273            "uniqTheta",
274            "quantile",
275            "quantiles",
276            "quantileExact",
277            "quantilesExact",
278            "quantileExactLow",
279            "quantilesExactLow",
280            "quantileExactHigh",
281            "quantilesExactHigh",
282            "quantileExactWeighted",
283            "quantilesExactWeighted",
284            "quantileTiming",
285            "quantilesTiming",
286            "quantileTimingWeighted",
287            "quantilesTimingWeighted",
288            "quantileDeterministic",
289            "quantilesDeterministic",
290            "quantileTDigest",
291            "quantilesTDigest",
292            "quantileTDigestWeighted",
293            "quantilesTDigestWeighted",
294            "quantileBFloat16",
295            "quantilesBFloat16",
296            "quantileBFloat16Weighted",
297            "quantilesBFloat16Weighted",
298            "simpleLinearRegression",
299            "stochasticLinearRegression",
300            "stochasticLogisticRegression",
301            "categoricalInformationValue",
302            "contingency",
303            "cramersV",
304            "cramersVBiasCorrected",
305            "theilsU",
306            "maxIntersections",
307            "maxIntersectionsPosition",
308            "meanZTest",
309            "quantileInterpolatedWeighted",
310            "quantilesInterpolatedWeighted",
311            "quantileGK",
312            "quantilesGK",
313            "sparkBar",
314            "sumCount",
315            "largestTriangleThreeBuckets",
316            "histogram",
317            "sequenceMatch",
318            "sequenceCount",
319            "windowFunnel",
320            "retention",
321            "uniqUpTo",
322            "sequenceNextNode",
323            "exponentialTimeDecayedAvg",
324        }
325
326        AGG_FUNCTIONS_SUFFIXES = [
327            "If",
328            "Array",
329            "ArrayIf",
330            "Map",
331            "SimpleState",
332            "State",
333            "Merge",
334            "MergeState",
335            "ForEach",
336            "Distinct",
337            "OrDefault",
338            "OrNull",
339            "Resample",
340            "ArgMin",
341            "ArgMax",
342        ]
343
344        FUNC_TOKENS = {
345            *parser.Parser.FUNC_TOKENS,
346            TokenType.SET,
347        }
348
349        RESERVED_TOKENS = parser.Parser.RESERVED_TOKENS - {TokenType.SELECT}
350
351        ID_VAR_TOKENS = {
352            *parser.Parser.ID_VAR_TOKENS,
353            TokenType.LIKE,
354        }
355
356        AGG_FUNC_MAPPING = (
357            lambda functions, suffixes: {
358                f"{f}{sfx}": (f, sfx) for sfx in (suffixes + [""]) for f in functions
359            }
360        )(AGG_FUNCTIONS, AGG_FUNCTIONS_SUFFIXES)
361
362        FUNCTIONS_WITH_ALIASED_ARGS = {*parser.Parser.FUNCTIONS_WITH_ALIASED_ARGS, "TUPLE"}
363
364        FUNCTION_PARSERS = {
365            **parser.Parser.FUNCTION_PARSERS,
366            "ARRAYJOIN": lambda self: self.expression(exp.Explode, this=self._parse_expression()),
367            "QUANTILE": lambda self: self._parse_quantile(),
368        }
369
370        FUNCTION_PARSERS.pop("MATCH")
371
372        NO_PAREN_FUNCTION_PARSERS = parser.Parser.NO_PAREN_FUNCTION_PARSERS.copy()
373        NO_PAREN_FUNCTION_PARSERS.pop("ANY")
374
375        RANGE_PARSERS = {
376            **parser.Parser.RANGE_PARSERS,
377            TokenType.GLOBAL: lambda self, this: self._match(TokenType.IN)
378            and self._parse_in(this, is_global=True),
379        }
380
381        # The PLACEHOLDER entry is popped because 1) it doesn't affect Clickhouse (it corresponds to
382        # the postgres-specific JSONBContains parser) and 2) it makes parsing the ternary op simpler.
383        COLUMN_OPERATORS = parser.Parser.COLUMN_OPERATORS.copy()
384        COLUMN_OPERATORS.pop(TokenType.PLACEHOLDER)
385
386        JOIN_KINDS = {
387            *parser.Parser.JOIN_KINDS,
388            TokenType.ANY,
389            TokenType.ASOF,
390            TokenType.ARRAY,
391        }
392
393        TABLE_ALIAS_TOKENS = parser.Parser.TABLE_ALIAS_TOKENS - {
394            TokenType.ANY,
395            TokenType.ARRAY,
396            TokenType.FINAL,
397            TokenType.FORMAT,
398            TokenType.SETTINGS,
399        }
400
401        ALIAS_TOKENS = parser.Parser.ALIAS_TOKENS - {
402            TokenType.FORMAT,
403        }
404
405        LOG_DEFAULTS_TO_LN = True
406
407        QUERY_MODIFIER_PARSERS = {
408            **parser.Parser.QUERY_MODIFIER_PARSERS,
409            TokenType.SETTINGS: lambda self: (
410                "settings",
411                self._advance() or self._parse_csv(self._parse_assignment),
412            ),
413            TokenType.FORMAT: lambda self: ("format", self._advance() or self._parse_id_var()),
414        }
415
416        CONSTRAINT_PARSERS = {
417            **parser.Parser.CONSTRAINT_PARSERS,
418            "INDEX": lambda self: self._parse_index_constraint(),
419            "CODEC": lambda self: self._parse_compress(),
420        }
421
422        ALTER_PARSERS = {
423            **parser.Parser.ALTER_PARSERS,
424            "REPLACE": lambda self: self._parse_alter_table_replace(),
425        }
426
427        SCHEMA_UNNAMED_CONSTRAINTS = {
428            *parser.Parser.SCHEMA_UNNAMED_CONSTRAINTS,
429            "INDEX",
430        }
431
432        def _parse_extract(self) -> exp.Extract | exp.Anonymous:
433            index = self._index
434            this = self._parse_bitwise()
435            if self._match(TokenType.FROM):
436                self._retreat(index)
437                return super()._parse_extract()
438
439            # We return Anonymous here because extract and regexpExtract have different semantics,
440            # so parsing extract(foo, bar) into RegexpExtract can potentially break queries. E.g.,
441            # `extract('foobar', 'b')` works, but CH crashes for `regexpExtract('foobar', 'b')`.
442            #
443            # TODO: can we somehow convert the former into an equivalent `regexpExtract` call?
444            self._match(TokenType.COMMA)
445            return self.expression(
446                exp.Anonymous, this="extract", expressions=[this, self._parse_bitwise()]
447            )
448
449        def _parse_assignment(self) -> t.Optional[exp.Expression]:
450            this = super()._parse_assignment()
451
452            if self._match(TokenType.PLACEHOLDER):
453                return self.expression(
454                    exp.If,
455                    this=this,
456                    true=self._parse_assignment(),
457                    false=self._match(TokenType.COLON) and self._parse_assignment(),
458                )
459
460            return this
461
462        def _parse_placeholder(self) -> t.Optional[exp.Expression]:
463            """
464            Parse a placeholder expression like SELECT {abc: UInt32} or FROM {table: Identifier}
465            https://clickhouse.com/docs/en/sql-reference/syntax#defining-and-using-query-parameters
466            """
467            if not self._match(TokenType.L_BRACE):
468                return None
469
470            this = self._parse_id_var()
471            self._match(TokenType.COLON)
472            kind = self._parse_types(check_func=False, allow_identifiers=False) or (
473                self._match_text_seq("IDENTIFIER") and "Identifier"
474            )
475
476            if not kind:
477                self.raise_error("Expecting a placeholder type or 'Identifier' for tables")
478            elif not self._match(TokenType.R_BRACE):
479                self.raise_error("Expecting }")
480
481            return self.expression(exp.Placeholder, this=this, kind=kind)
482
483        def _parse_in(self, this: t.Optional[exp.Expression], is_global: bool = False) -> exp.In:
484            this = super()._parse_in(this)
485            this.set("is_global", is_global)
486            return this
487
488        def _parse_table(
489            self,
490            schema: bool = False,
491            joins: bool = False,
492            alias_tokens: t.Optional[t.Collection[TokenType]] = None,
493            parse_bracket: bool = False,
494            is_db_reference: bool = False,
495            parse_partition: bool = False,
496        ) -> t.Optional[exp.Expression]:
497            this = super()._parse_table(
498                schema=schema,
499                joins=joins,
500                alias_tokens=alias_tokens,
501                parse_bracket=parse_bracket,
502                is_db_reference=is_db_reference,
503            )
504
505            if self._match(TokenType.FINAL):
506                this = self.expression(exp.Final, this=this)
507
508            return this
509
510        def _parse_position(self, haystack_first: bool = False) -> exp.StrPosition:
511            return super()._parse_position(haystack_first=True)
512
513        # https://clickhouse.com/docs/en/sql-reference/statements/select/with/
514        def _parse_cte(self) -> exp.CTE:
515            # WITH <identifier> AS <subquery expression>
516            cte: t.Optional[exp.CTE] = self._try_parse(super()._parse_cte)
517
518            if not cte:
519                # WITH <expression> AS <identifier>
520                cte = self.expression(
521                    exp.CTE,
522                    this=self._parse_assignment(),
523                    alias=self._parse_table_alias(),
524                    scalar=True,
525                )
526
527            return cte
528
529        def _parse_join_parts(
530            self,
531        ) -> t.Tuple[t.Optional[Token], t.Optional[Token], t.Optional[Token]]:
532            is_global = self._match(TokenType.GLOBAL) and self._prev
533            kind_pre = self._match_set(self.JOIN_KINDS, advance=False) and self._prev
534
535            if kind_pre:
536                kind = self._match_set(self.JOIN_KINDS) and self._prev
537                side = self._match_set(self.JOIN_SIDES) and self._prev
538                return is_global, side, kind
539
540            return (
541                is_global,
542                self._match_set(self.JOIN_SIDES) and self._prev,
543                self._match_set(self.JOIN_KINDS) and self._prev,
544            )
545
546        def _parse_join(
547            self, skip_join_token: bool = False, parse_bracket: bool = False
548        ) -> t.Optional[exp.Join]:
549            join = super()._parse_join(skip_join_token=skip_join_token, parse_bracket=True)
550            if join:
551                join.set("global", join.args.pop("method", None))
552
553            return join
554
555        def _parse_function(
556            self,
557            functions: t.Optional[t.Dict[str, t.Callable]] = None,
558            anonymous: bool = False,
559            optional_parens: bool = True,
560            any_token: bool = False,
561        ) -> t.Optional[exp.Expression]:
562            expr = super()._parse_function(
563                functions=functions,
564                anonymous=anonymous,
565                optional_parens=optional_parens,
566                any_token=any_token,
567            )
568
569            func = expr.this if isinstance(expr, exp.Window) else expr
570
571            # Aggregate functions can be split in 2 parts: <func_name><suffix>
572            parts = (
573                self.AGG_FUNC_MAPPING.get(func.this) if isinstance(func, exp.Anonymous) else None
574            )
575
576            if parts:
577                params = self._parse_func_params(func)
578
579                kwargs = {
580                    "this": func.this,
581                    "expressions": func.expressions,
582                }
583                if parts[1]:
584                    kwargs["parts"] = parts
585                    exp_class = exp.CombinedParameterizedAgg if params else exp.CombinedAggFunc
586                else:
587                    exp_class = exp.ParameterizedAgg if params else exp.AnonymousAggFunc
588
589                kwargs["exp_class"] = exp_class
590                if params:
591                    kwargs["params"] = params
592
593                func = self.expression(**kwargs)
594
595                if isinstance(expr, exp.Window):
596                    # The window's func was parsed as Anonymous in base parser, fix its
597                    # type to be CH style CombinedAnonymousAggFunc / AnonymousAggFunc
598                    expr.set("this", func)
599                elif params:
600                    # Params have blocked super()._parse_function() from parsing the following window
601                    # (if that exists) as they're standing between the function call and the window spec
602                    expr = self._parse_window(func)
603                else:
604                    expr = func
605
606            return expr
607
608        def _parse_func_params(
609            self, this: t.Optional[exp.Func] = None
610        ) -> t.Optional[t.List[exp.Expression]]:
611            if self._match_pair(TokenType.R_PAREN, TokenType.L_PAREN):
612                return self._parse_csv(self._parse_lambda)
613
614            if self._match(TokenType.L_PAREN):
615                params = self._parse_csv(self._parse_lambda)
616                self._match_r_paren(this)
617                return params
618
619            return None
620
621        def _parse_quantile(self) -> exp.Quantile:
622            this = self._parse_lambda()
623            params = self._parse_func_params()
624            if params:
625                return self.expression(exp.Quantile, this=params[0], quantile=this)
626            return self.expression(exp.Quantile, this=this, quantile=exp.Literal.number(0.5))
627
628        def _parse_wrapped_id_vars(self, optional: bool = False) -> t.List[exp.Expression]:
629            return super()._parse_wrapped_id_vars(optional=True)
630
631        def _parse_primary_key(
632            self, wrapped_optional: bool = False, in_props: bool = False
633        ) -> exp.PrimaryKeyColumnConstraint | exp.PrimaryKey:
634            return super()._parse_primary_key(
635                wrapped_optional=wrapped_optional or in_props, in_props=in_props
636            )
637
638        def _parse_on_property(self) -> t.Optional[exp.Expression]:
639            index = self._index
640            if self._match_text_seq("CLUSTER"):
641                this = self._parse_id_var()
642                if this:
643                    return self.expression(exp.OnCluster, this=this)
644                else:
645                    self._retreat(index)
646            return None
647
648        def _parse_index_constraint(
649            self, kind: t.Optional[str] = None
650        ) -> exp.IndexColumnConstraint:
651            # INDEX name1 expr TYPE type1(args) GRANULARITY value
652            this = self._parse_id_var()
653            expression = self._parse_assignment()
654
655            index_type = self._match_text_seq("TYPE") and (
656                self._parse_function() or self._parse_var()
657            )
658
659            granularity = self._match_text_seq("GRANULARITY") and self._parse_term()
660
661            return self.expression(
662                exp.IndexColumnConstraint,
663                this=this,
664                expression=expression,
665                index_type=index_type,
666                granularity=granularity,
667            )
668
669        def _parse_partition(self) -> t.Optional[exp.Partition]:
670            # https://clickhouse.com/docs/en/sql-reference/statements/alter/partition#how-to-set-partition-expression
671            if not self._match(TokenType.PARTITION):
672                return None
673
674            if self._match_text_seq("ID"):
675                # Corresponds to the PARTITION ID <string_value> syntax
676                expressions: t.List[exp.Expression] = [
677                    self.expression(exp.PartitionId, this=self._parse_string())
678                ]
679            else:
680                expressions = self._parse_expressions()
681
682            return self.expression(exp.Partition, expressions=expressions)
683
684        def _parse_alter_table_replace(self) -> t.Optional[exp.Expression]:
685            partition = self._parse_partition()
686
687            if not partition or not self._match(TokenType.FROM):
688                return None
689
690            return self.expression(
691                exp.ReplacePartition, expression=partition, source=self._parse_table_parts()
692            )
693
694        def _parse_projection_def(self) -> t.Optional[exp.ProjectionDef]:
695            if not self._match_text_seq("PROJECTION"):
696                return None
697
698            return self.expression(
699                exp.ProjectionDef,
700                this=self._parse_id_var(),
701                expression=self._parse_wrapped(self._parse_statement),
702            )
703
704        def _parse_constraint(self) -> t.Optional[exp.Expression]:
705            return super()._parse_constraint() or self._parse_projection_def()

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
MODIFIERS_ATTACHED_TO_SET_OP = False
INTERVAL_SPANS = False
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': <function Parser.<lambda>>, '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_CONSTRUCT_COMPACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayConstructCompact'>>, 'ARRAY_CONTAINS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayContains'>>, 'ARRAY_HAS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayContains'>>, 'ARRAY_CONTAINS_ALL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayContainsAll'>>, 'ARRAY_HAS_ALL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayContainsAll'>>, 'FILTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayFilter'>>, 'ARRAY_FILTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayFilter'>>, 'ARRAY_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'>>, 'CONVERT_TIMEZONE': <function build_convert_timezone>, '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 build_date_delta.<locals>._builder>, 'DATEDIFF': <function build_date_delta.<locals>._builder>, 'DATE_DIFF': <function build_date_delta.<locals>._builder>, 'DATE_FROM_PARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateFromParts'>>, 'DATEFROMPARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateFromParts'>>, 'DATE_STR_TO_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateStrToDate'>>, 'DATE_SUB': <function build_date_delta.<locals>._builder>, 'DATE_TO_DATE_STR': <function Parser.<lambda>>, 'DATE_TO_DI': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateToDi'>>, 'DATE_TRUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateTrunc'>>, 'DATETIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Datetime'>>, 'DATETIME_ADD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DatetimeAdd'>>, 'DATETIME_DIFF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DatetimeDiff'>>, 'DATETIME_SUB': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DatetimeSub'>>, 'DATETIME_TRUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DatetimeTrunc'>>, 'DAY': <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'>>, 'EXPLODING_GENERATE_SERIES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ExplodingGenerateSeries'>>, 'EXTRACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Extract'>>, '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'>>, 'GAP_FILL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GapFill'>>, 'GENERATE_DATE_ARRAY': <function Parser.<lambda>>, 'GENERATE_SERIES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GenerateSeries'>>, 'GENERATE_TIMESTAMP_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GenerateTimestampArray'>>, 'GREATEST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Greatest'>>, 'GROUP_CONCAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GroupConcat'>>, 'HEX': <function build_hex>, 'HLL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Hll'>>, 'IF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.If'>>, 'IIF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.If'>>, 'INITCAP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Initcap'>>, 'IS_INF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.IsInf'>>, 'ISINF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.IsInf'>>, 'IS_NAN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.IsNan'>>, 'ISNAN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.IsNan'>>, 'J_S_O_N_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONArray'>>, 'J_S_O_N_ARRAY_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONArrayAgg'>>, 'JSON_ARRAY_CONTAINS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONArrayContains'>>, 'JSONB_CONTAINS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBContains'>>, 'JSONB_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'>>, 'LIST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.List'>>, 'LN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Ln'>>, 'LOG': <function build_logarithm>, 'LOGICAL_AND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalAnd'>>, 'BOOL_AND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalAnd'>>, 'BOOLAND_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalAnd'>>, 'LOGICAL_OR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalOr'>>, 'BOOL_OR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalOr'>>, 'BOOLOR_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalOr'>>, 'LOWER': <function build_lower>, 'LCASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Lower'>>, 'LOWER_HEX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LowerHex'>>, 'MD5': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MD5Digest'>>, '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'>>, 'OBJECT_INSERT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ObjectInsert'>>, 'OPEN_J_S_O_N': <bound method Func.from_arg_list of <class 'sqlglot.expressions.OpenJSON'>>, 'PAD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Pad'>>, 'PARAMETERIZED_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParameterizedAgg'>>, 'PARSE_JSON': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseJSON'>>, 'JSON_PARSE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseJSON'>>, 'PERCENTILE_CONT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.PercentileCont'>>, 'PERCENTILE_DISC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.PercentileDisc'>>, 'POSEXPLODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Posexplode'>>, 'POSEXPLODE_OUTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.PosexplodeOuter'>>, 'POWER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Pow'>>, 'POW': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Pow'>>, 'PREDICT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Predict'>>, 'QUANTILE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Quantile'>>, 'QUARTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Quarter'>>, 'RAND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Rand'>>, 'RANDOM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Rand'>>, 'RANDN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Randn'>>, 'RANGE_N': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RangeN'>>, 'READ_CSV': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ReadCSV'>>, 'REDUCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Reduce'>>, 'REGEXP_EXTRACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpExtract'>>, 'REGEXP_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'>>, 'STDEV': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Stddev'>>, 'STDDEV_POP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StddevPop'>>, 'STDDEV_SAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StddevSamp'>>, 'STR_POSITION': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrPosition'>>, 'STR_TO_DATE': <function _build_str_to_date>, 'STR_TO_MAP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrToMap'>>, 'STR_TO_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrToTime'>>, 'STR_TO_UNIX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrToUnix'>>, 'STRING_TO_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StringToArray'>>, 'SPLIT_BY_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StringToArray'>>, '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': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Time'>>, 'TIME_ADD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeAdd'>>, 'TIME_DIFF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeDiff'>>, 'TIME_FROM_PARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeFromParts'>>, 'TIMEFROMPARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeFromParts'>>, 'TIME_STR_TO_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeStrToDate'>>, 'TIME_STR_TO_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeStrToTime'>>, 'TIME_STR_TO_UNIX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeStrToUnix'>>, 'TIME_SUB': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeSub'>>, 'TIME_TO_STR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeToStr'>>, 'TIME_TO_TIME_STR': <function Parser.<lambda>>, 'TIME_TO_UNIX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeToUnix'>>, 'TIME_TRUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeTrunc'>>, 'TIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Timestamp'>>, 'TIMESTAMP_ADD': <function build_date_delta.<locals>._builder>, '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': <function build_date_delta.<locals>._builder>, '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'>>, 'UNNEST': <function Parser.<lambda>>, 'UPPER': <function build_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>>, 'LPAD': <function Parser.<lambda>>, 'LEFTPAD': <function Parser.<lambda>>, 'MOD': <function build_mod>, 'RPAD': <function Parser.<lambda>>, 'RIGHTPAD': <function Parser.<lambda>>, 'SCOPE_RESOLUTION': <function Parser.<lambda>>, 'TO_HEX': <function build_hex>, '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 build_date_delta.<locals>._builder>, 'DATE_FORMAT': <function _build_date_format>, 'DATESUB': <function build_date_delta.<locals>._builder>, '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'>>, 'TIMESTAMPSUB': <function build_date_delta.<locals>._builder>, 'TIMESTAMPADD': <function build_date_delta.<locals>._builder>, 'UNIQ': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxDistinct'>>, 'SHA256': <function ClickHouse.Parser.<lambda>>, 'SHA512': <function ClickHouse.Parser.<lambda>>}
AGG_FUNCTIONS = {'exponentialMovingAverage', 'boundingRatio', 'cramersVBiasCorrected', 'quantilesDeterministic', 'quantilesTimingWeighted', 'quantileInterpolatedWeighted', 'avgWeighted', 'median', 'quantilesExactLow', 'sumMap', 'simpleLinearRegression', 'uniqUpTo', 'maxMap', 'minMap', 'argMax', 'categoricalInformationValue', 'quantileExact', 'quantilesExactWeighted', 'cramersV', 'quantileTiming', 'varSamp', 'skewSamp', 'covarSamp', 'groupUniqArray', 'exponentialTimeDecayedAvg', 'anyLast', 'sequenceCount', 'kurtSamp', 'quantiles', 'welchTTest', 'groupArrayLast', 'quantilesTDigest', 'quantileGK', 'varPop', 'rankCorr', 'stochasticLinearRegression', 'histogram', 'quantilesBFloat16', 'avg', 'groupBitmapOr', 'windowFunnel', 'sumWithOverflow', 'uniqExact', 'mannWhitneyUTest', 'uniqTheta', 'maxIntersectionsPosition', 'topK', 'sumKahan', 'sparkBar', 'groupArray', 'skewPop', 'groupBitmap', 'retention', 'intervalLengthSum', 'quantilesExactHigh', 'corr', 'count', 'largestTriangleThreeBuckets', 'covarPop', 'groupBitXor', 'studentTTest', 'any', 'anyHeavy', 'groupBitmapXor', 'last_value', 'sum', 'groupArraySample', 'first_value', 'uniqCombined', 'theilsU', 'deltaSum', 'quantilesTDigestWeighted', 'quantileExactHigh', 'contingency', 'quantileBFloat16', 'groupArrayInsertAt', 'quantileBFloat16Weighted', 'quantileExactWeighted', 'quantilesExact', 'quantile', 'quantilesInterpolatedWeighted', 'groupBitAnd', 'topKWeighted', 'groupArrayMovingAvg', 'groupBitOr', 'quantileTDigestWeighted', 'min', 'maxIntersections', 'stddevPop', 'quantilesTiming', 'sumCount', 'uniq', 'quantileDeterministic', 'entropy', 'groupBitmapAnd', 'uniqHLL12', 'sequenceMatch', 'sequenceNextNode', 'quantileTimingWeighted', 'kurtPop', 'quantilesGK', 'meanZTest', 'argMin', 'stddevSamp', 'deltaSumTimestamp', 'stochasticLogisticRegression', 'uniqCombined64', 'quantilesBFloat16Weighted', 'groupArrayMovingSum', 'kolmogorovSmirnovTest', 'max', 'quantileExactLow', 'quantileTDigest'}
AGG_FUNCTIONS_SUFFIXES = ['If', 'Array', 'ArrayIf', 'Map', 'SimpleState', 'State', 'Merge', 'MergeState', 'ForEach', 'Distinct', 'OrDefault', 'OrNull', 'Resample', 'ArgMin', 'ArgMax']
FUNC_TOKENS = {<TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.INT: 'INT'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.ENUM: 'ENUM'>, <TokenType.UINT256: 'UINT256'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.INT128: 'INT128'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.UINT: 'UINT'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.INDEX: 'INDEX'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.DATE32: 'DATE32'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.XOR: 'XOR'>, <TokenType.UINT128: 'UINT128'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.LEFT: 'LEFT'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.YEAR: 'YEAR'>, <TokenType.ALL: 'ALL'>, <TokenType.MONEY: 'MONEY'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.TABLE: 'TABLE'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.IPV4: 'IPV4'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.LIKE: 'LIKE'>, <TokenType.FIRST: 'FIRST'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.JSON: 'JSON'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.WINDOW: 'WINDOW'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.VAR: 'VAR'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.INSERT: 'INSERT'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.CHAR: 'CHAR'>, <TokenType.TIME: 'TIME'>, <TokenType.ROW: 'ROW'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.XML: 'XML'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.MERGE: 'MERGE'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.FORMAT: 'FORMAT'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.ILIKE: 'ILIKE'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.RANGE: 'RANGE'>, <TokenType.JSONB: 'JSONB'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.NULL: 'NULL'>, <TokenType.NAME: 'NAME'>, <TokenType.LIST: 'LIST'>, <TokenType.ANY: 'ANY'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.MAP: 'MAP'>, <TokenType.SET: 'SET'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.IPV6: 'IPV6'>, <TokenType.UUID: 'UUID'>, <TokenType.RLIKE: 'RLIKE'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.INET: 'INET'>, <TokenType.PRIMARY_KEY: 'PRIMARY_KEY'>, <TokenType.RIGHT: 'RIGHT'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.DATE: 'DATE'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.GLOB: 'GLOB'>, <TokenType.BINARY: 'BINARY'>, <TokenType.UNIQUEIDENTIFIER: 'UNIQUEIDENTIFIER'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.INT256: 'INT256'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.NESTED: 'NESTED'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.SUPER: 'SUPER'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.BIT: 'BIT'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.SOME: 'SOME'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.TEXT: 'TEXT'>, <TokenType.FILTER: 'FILTER'>}
RESERVED_TOKENS = {<TokenType.PIPE: 'PIPE'>, <TokenType.COLON: 'COLON'>, <TokenType.DOT: 'DOT'>, <TokenType.PLACEHOLDER: 'PLACEHOLDER'>, <TokenType.PARAMETER: 'PARAMETER'>, <TokenType.COMMA: 'COMMA'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.MOD: 'MOD'>, <TokenType.L_BRACE: 'L_BRACE'>, <TokenType.R_BRACE: 'R_BRACE'>, <TokenType.TILDA: 'TILDA'>, <TokenType.STAR: 'STAR'>, <TokenType.L_PAREN: 'L_PAREN'>, <TokenType.AMP: 'AMP'>, <TokenType.DASH: 'DASH'>, <TokenType.R_BRACKET: 'R_BRACKET'>, <TokenType.EQ: 'EQ'>, <TokenType.SLASH: 'SLASH'>, <TokenType.BACKSLASH: 'BACKSLASH'>, <TokenType.NOT: 'NOT'>, <TokenType.HASH: 'HASH'>, <TokenType.CARET: 'CARET'>, <TokenType.L_BRACKET: 'L_BRACKET'>, <TokenType.R_PAREN: 'R_PAREN'>, <TokenType.PLUS: 'PLUS'>, <TokenType.SEMICOLON: 'SEMICOLON'>, <TokenType.LT: 'LT'>, <TokenType.GT: 'GT'>}
ID_VAR_TOKENS = {<TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.INT: 'INT'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.FALSE: 'FALSE'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.ENUM: 'ENUM'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.ROWS: 'ROWS'>, <TokenType.UINT256: 'UINT256'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.VIEW: 'VIEW'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.COPY: 'COPY'>, <TokenType.INT128: 'INT128'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.UINT: 'UINT'>, <TokenType.IS: 'IS'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.INDEX: 'INDEX'>, <TokenType.FINAL: 'FINAL'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.TRUE: 'TRUE'>, <TokenType.STORAGE_INTEGRATION: 'STORAGE_INTEGRATION'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.DATE32: 'DATE32'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.DELETE: 'DELETE'>, <TokenType.RENAME: 'RENAME'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.TEXT: 'TEXT'>, <TokenType.UINT128: 'UINT128'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.ROLLUP: 'ROLLUP'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.LEFT: 'LEFT'>, <TokenType.SHOW: 'SHOW'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.ALL: 'ALL'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.YEAR: 'YEAR'>, <TokenType.MONEY: 'MONEY'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.TABLE: 'TABLE'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.IPV4: 'IPV4'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.APPLY: 'APPLY'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.FULL: 'FULL'>, <TokenType.LIKE: 'LIKE'>, <TokenType.PROCEDURE: 'PROCEDURE'>, <TokenType.FIRST: 'FIRST'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.SETTINGS: 'SETTINGS'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.USE: 'USE'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.JSON: 'JSON'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.CUBE: 'CUBE'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.CACHE: 'CACHE'>, <TokenType.WINDOW: 'WINDOW'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.VAR: 'VAR'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.WAREHOUSE: 'WAREHOUSE'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.CHAR: 'CHAR'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.TIME: 'TIME'>, <TokenType.ROW: 'ROW'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.ORDINALITY: 'ORDINALITY'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.XML: 'XML'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.MERGE: 'MERGE'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.REFERENCES: 'REFERENCES'>, <TokenType.FORMAT: 'FORMAT'>, <TokenType.DIV: 'DIV'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.KEEP: 'KEEP'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.DESC: 'DESC'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.SEMI: 'SEMI'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.RANGE: 'RANGE'>, <TokenType.JSONB: 'JSONB'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.ANTI: 'ANTI'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.NATURAL: 'NATURAL'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.TAG: 'TAG'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.KILL: 'KILL'>, <TokenType.NULL: 'NULL'>, <TokenType.NAME: 'NAME'>, <TokenType.LIST: 'LIST'>, <TokenType.NEXT: 'NEXT'>, <TokenType.ANY: 'ANY'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.ASOF: 'ASOF'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.STREAMLIT: 'STREAMLIT'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.SET: 'SET'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.MAP: 'MAP'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.IPV6: 'IPV6'>, <TokenType.END: 'END'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.UUID: 'UUID'>, <TokenType.CASE: 'CASE'>, <TokenType.UNIQUE: 'UNIQUE'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.MODEL: 'MODEL'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.INET: 'INET'>, <TokenType.RIGHT: 'RIGHT'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.ASC: 'ASC'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.DATE: 'DATE'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.BINARY: 'BINARY'>, <TokenType.UNIQUEIDENTIFIER: 'UNIQUEIDENTIFIER'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.INT256: 'INT256'>, <TokenType.STRAIGHT_JOIN: 'STRAIGHT_JOIN'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.NESTED: 'NESTED'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.SUPER: 'SUPER'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.LOAD: 'LOAD'>, <TokenType.BIT: 'BIT'>, <TokenType.SOME: 'SOME'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.TOP: 'TOP'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.FILTER: 'FILTER'>}
AGG_FUNC_MAPPING = {'exponentialMovingAverageIf': ('exponentialMovingAverage', 'If'), 'boundingRatioIf': ('boundingRatio', 'If'), 'cramersVBiasCorrectedIf': ('cramersVBiasCorrected', 'If'), 'quantilesDeterministicIf': ('quantilesDeterministic', 'If'), 'quantilesTimingWeightedIf': ('quantilesTimingWeighted', 'If'), 'quantileInterpolatedWeightedIf': ('quantileInterpolatedWeighted', 'If'), 'avgWeightedIf': ('avgWeighted', 'If'), 'medianIf': ('median', 'If'), 'quantilesExactLowIf': ('quantilesExactLow', 'If'), 'sumMapIf': ('sumMap', 'If'), 'simpleLinearRegressionIf': ('simpleLinearRegression', 'If'), 'uniqUpToIf': ('uniqUpTo', 'If'), 'maxMapIf': ('maxMap', 'If'), 'minMapIf': ('minMap', 'If'), 'argMaxIf': ('argMax', 'If'), 'categoricalInformationValueIf': ('categoricalInformationValue', 'If'), 'quantileExactIf': ('quantileExact', 'If'), 'quantilesExactWeightedIf': ('quantilesExactWeighted', 'If'), 'cramersVIf': ('cramersV', 'If'), 'quantileTimingIf': ('quantileTiming', 'If'), 'varSampIf': ('varSamp', 'If'), 'skewSampIf': ('skewSamp', 'If'), 'covarSampIf': ('covarSamp', 'If'), 'groupUniqArrayIf': ('groupUniqArray', 'If'), 'exponentialTimeDecayedAvgIf': ('exponentialTimeDecayedAvg', 'If'), 'anyLastIf': ('anyLast', 'If'), 'sequenceCountIf': ('sequenceCount', 'If'), 'kurtSampIf': ('kurtSamp', 'If'), 'quantilesIf': ('quantiles', 'If'), 'welchTTestIf': ('welchTTest', 'If'), 'groupArrayLastIf': ('groupArrayLast', 'If'), 'quantilesTDigestIf': ('quantilesTDigest', 'If'), 'quantileGKIf': ('quantileGK', 'If'), 'varPopIf': ('varPop', 'If'), 'rankCorrIf': ('rankCorr', 'If'), 'stochasticLinearRegressionIf': ('stochasticLinearRegression', 'If'), 'histogramIf': ('histogram', 'If'), 'quantilesBFloat16If': ('quantilesBFloat16', 'If'), 'avgIf': ('avg', 'If'), 'groupBitmapOrIf': ('groupBitmapOr', 'If'), 'windowFunnelIf': ('windowFunnel', 'If'), 'sumWithOverflowIf': ('sumWithOverflow', 'If'), 'uniqExactIf': ('uniqExact', 'If'), 'mannWhitneyUTestIf': ('mannWhitneyUTest', 'If'), 'uniqThetaIf': ('uniqTheta', 'If'), 'maxIntersectionsPositionIf': ('maxIntersectionsPosition', 'If'), 'topKIf': ('topK', 'If'), 'sumKahanIf': ('sumKahan', 'If'), 'sparkBarIf': ('sparkBar', 'If'), 'groupArrayIf': ('groupArray', 'If'), 'skewPopIf': ('skewPop', 'If'), 'groupBitmapIf': ('groupBitmap', 'If'), 'retentionIf': ('retention', 'If'), 'intervalLengthSumIf': ('intervalLengthSum', 'If'), 'quantilesExactHighIf': ('quantilesExactHigh', 'If'), 'corrIf': ('corr', 'If'), 'countIf': ('count', 'If'), 'largestTriangleThreeBucketsIf': ('largestTriangleThreeBuckets', 'If'), 'covarPopIf': ('covarPop', 'If'), 'groupBitXorIf': ('groupBitXor', 'If'), 'studentTTestIf': ('studentTTest', 'If'), 'anyIf': ('any', 'If'), 'anyHeavyIf': ('anyHeavy', 'If'), 'groupBitmapXorIf': ('groupBitmapXor', 'If'), 'last_valueIf': ('last_value', 'If'), 'sumIf': ('sum', 'If'), 'groupArraySampleIf': ('groupArraySample', 'If'), 'first_valueIf': ('first_value', 'If'), 'uniqCombinedIf': ('uniqCombined', 'If'), 'theilsUIf': ('theilsU', 'If'), 'deltaSumIf': ('deltaSum', 'If'), 'quantilesTDigestWeightedIf': ('quantilesTDigestWeighted', 'If'), 'quantileExactHighIf': ('quantileExactHigh', 'If'), 'contingencyIf': ('contingency', 'If'), 'quantileBFloat16If': ('quantileBFloat16', 'If'), 'groupArrayInsertAtIf': ('groupArrayInsertAt', 'If'), 'quantileBFloat16WeightedIf': ('quantileBFloat16Weighted', 'If'), 'quantileExactWeightedIf': ('quantileExactWeighted', 'If'), 'quantilesExactIf': ('quantilesExact', 'If'), 'quantileIf': ('quantile', 'If'), 'quantilesInterpolatedWeightedIf': ('quantilesInterpolatedWeighted', 'If'), 'groupBitAndIf': ('groupBitAnd', 'If'), 'topKWeightedIf': ('topKWeighted', 'If'), 'groupArrayMovingAvgIf': ('groupArrayMovingAvg', 'If'), 'groupBitOrIf': ('groupBitOr', 'If'), 'quantileTDigestWeightedIf': ('quantileTDigestWeighted', 'If'), 'minIf': ('min', 'If'), 'maxIntersectionsIf': ('maxIntersections', 'If'), 'stddevPopIf': ('stddevPop', 'If'), 'quantilesTimingIf': ('quantilesTiming', 'If'), 'sumCountIf': ('sumCount', 'If'), 'uniqIf': ('uniq', 'If'), 'quantileDeterministicIf': ('quantileDeterministic', 'If'), 'entropyIf': ('entropy', 'If'), 'groupBitmapAndIf': ('groupBitmapAnd', 'If'), 'uniqHLL12If': ('uniqHLL12', 'If'), 'sequenceMatchIf': ('sequenceMatch', 'If'), 'sequenceNextNodeIf': ('sequenceNextNode', 'If'), 'quantileTimingWeightedIf': ('quantileTimingWeighted', 'If'), 'kurtPopIf': ('kurtPop', 'If'), 'quantilesGKIf': ('quantilesGK', 'If'), 'meanZTestIf': ('meanZTest', 'If'), 'argMinIf': ('argMin', 'If'), 'stddevSampIf': ('stddevSamp', 'If'), 'deltaSumTimestampIf': ('deltaSumTimestamp', 'If'), 'stochasticLogisticRegressionIf': ('stochasticLogisticRegression', 'If'), 'uniqCombined64If': ('uniqCombined64', 'If'), 'quantilesBFloat16WeightedIf': ('quantilesBFloat16Weighted', 'If'), 'groupArrayMovingSumIf': ('groupArrayMovingSum', 'If'), 'kolmogorovSmirnovTestIf': ('kolmogorovSmirnovTest', 'If'), 'maxIf': ('max', 'If'), 'quantileExactLowIf': ('quantileExactLow', 'If'), 'quantileTDigestIf': ('quantileTDigest', 'If'), 'exponentialMovingAverageArray': ('exponentialMovingAverage', 'Array'), 'boundingRatioArray': ('boundingRatio', 'Array'), 'cramersVBiasCorrectedArray': ('cramersVBiasCorrected', 'Array'), 'quantilesDeterministicArray': ('quantilesDeterministic', 'Array'), 'quantilesTimingWeightedArray': ('quantilesTimingWeighted', 'Array'), 'quantileInterpolatedWeightedArray': ('quantileInterpolatedWeighted', 'Array'), 'avgWeightedArray': ('avgWeighted', 'Array'), 'medianArray': ('median', 'Array'), 'quantilesExactLowArray': ('quantilesExactLow', 'Array'), 'sumMapArray': ('sumMap', 'Array'), 'simpleLinearRegressionArray': ('simpleLinearRegression', 'Array'), 'uniqUpToArray': ('uniqUpTo', 'Array'), 'maxMapArray': ('maxMap', 'Array'), 'minMapArray': ('minMap', 'Array'), 'argMaxArray': ('argMax', 'Array'), 'categoricalInformationValueArray': ('categoricalInformationValue', 'Array'), 'quantileExactArray': ('quantileExact', 'Array'), 'quantilesExactWeightedArray': ('quantilesExactWeighted', 'Array'), 'cramersVArray': ('cramersV', 'Array'), 'quantileTimingArray': ('quantileTiming', 'Array'), 'varSampArray': ('varSamp', 'Array'), 'skewSampArray': ('skewSamp', 'Array'), 'covarSampArray': ('covarSamp', 'Array'), 'groupUniqArrayArray': ('groupUniqArray', 'Array'), 'exponentialTimeDecayedAvgArray': ('exponentialTimeDecayedAvg', 'Array'), 'anyLastArray': ('anyLast', 'Array'), 'sequenceCountArray': ('sequenceCount', 'Array'), 'kurtSampArray': ('kurtSamp', 'Array'), 'quantilesArray': ('quantiles', 'Array'), 'welchTTestArray': ('welchTTest', 'Array'), 'groupArrayLastArray': ('groupArrayLast', 'Array'), 'quantilesTDigestArray': ('quantilesTDigest', 'Array'), 'quantileGKArray': ('quantileGK', 'Array'), 'varPopArray': ('varPop', 'Array'), 'rankCorrArray': ('rankCorr', 'Array'), 'stochasticLinearRegressionArray': ('stochasticLinearRegression', 'Array'), 'histogramArray': ('histogram', 'Array'), 'quantilesBFloat16Array': ('quantilesBFloat16', 'Array'), 'avgArray': ('avg', 'Array'), 'groupBitmapOrArray': ('groupBitmapOr', 'Array'), 'windowFunnelArray': ('windowFunnel', 'Array'), 'sumWithOverflowArray': ('sumWithOverflow', 'Array'), 'uniqExactArray': ('uniqExact', 'Array'), 'mannWhitneyUTestArray': ('mannWhitneyUTest', 'Array'), 'uniqThetaArray': ('uniqTheta', 'Array'), 'maxIntersectionsPositionArray': ('maxIntersectionsPosition', 'Array'), 'topKArray': ('topK', 'Array'), 'sumKahanArray': ('sumKahan', 'Array'), 'sparkBarArray': ('sparkBar', 'Array'), 'groupArrayArray': ('groupArray', 'Array'), 'skewPopArray': ('skewPop', 'Array'), 'groupBitmapArray': ('groupBitmap', 'Array'), 'retentionArray': ('retention', 'Array'), 'intervalLengthSumArray': ('intervalLengthSum', 'Array'), 'quantilesExactHighArray': ('quantilesExactHigh', 'Array'), 'corrArray': ('corr', 'Array'), 'countArray': ('count', 'Array'), 'largestTriangleThreeBucketsArray': ('largestTriangleThreeBuckets', 'Array'), 'covarPopArray': ('covarPop', 'Array'), 'groupBitXorArray': ('groupBitXor', 'Array'), 'studentTTestArray': ('studentTTest', 'Array'), 'anyArray': ('any', 'Array'), 'anyHeavyArray': ('anyHeavy', 'Array'), 'groupBitmapXorArray': ('groupBitmapXor', 'Array'), 'last_valueArray': ('last_value', 'Array'), 'sumArray': ('sum', 'Array'), 'groupArraySampleArray': ('groupArraySample', 'Array'), 'first_valueArray': ('first_value', 'Array'), 'uniqCombinedArray': ('uniqCombined', 'Array'), 'theilsUArray': ('theilsU', 'Array'), 'deltaSumArray': ('deltaSum', 'Array'), 'quantilesTDigestWeightedArray': ('quantilesTDigestWeighted', 'Array'), 'quantileExactHighArray': ('quantileExactHigh', 'Array'), 'contingencyArray': ('contingency', 'Array'), 'quantileBFloat16Array': ('quantileBFloat16', 'Array'), 'groupArrayInsertAtArray': ('groupArrayInsertAt', 'Array'), 'quantileBFloat16WeightedArray': ('quantileBFloat16Weighted', 'Array'), 'quantileExactWeightedArray': ('quantileExactWeighted', 'Array'), 'quantilesExactArray': ('quantilesExact', 'Array'), 'quantileArray': ('quantile', 'Array'), 'quantilesInterpolatedWeightedArray': ('quantilesInterpolatedWeighted', 'Array'), 'groupBitAndArray': ('groupBitAnd', 'Array'), 'topKWeightedArray': ('topKWeighted', 'Array'), 'groupArrayMovingAvgArray': ('groupArrayMovingAvg', 'Array'), 'groupBitOrArray': ('groupBitOr', 'Array'), 'quantileTDigestWeightedArray': ('quantileTDigestWeighted', 'Array'), 'minArray': ('min', 'Array'), 'maxIntersectionsArray': ('maxIntersections', 'Array'), 'stddevPopArray': ('stddevPop', 'Array'), 'quantilesTimingArray': ('quantilesTiming', 'Array'), 'sumCountArray': ('sumCount', 'Array'), 'uniqArray': ('uniq', 'Array'), 'quantileDeterministicArray': ('quantileDeterministic', 'Array'), 'entropyArray': ('entropy', 'Array'), 'groupBitmapAndArray': ('groupBitmapAnd', 'Array'), 'uniqHLL12Array': ('uniqHLL12', 'Array'), 'sequenceMatchArray': ('sequenceMatch', 'Array'), 'sequenceNextNodeArray': ('sequenceNextNode', 'Array'), 'quantileTimingWeightedArray': ('quantileTimingWeighted', 'Array'), 'kurtPopArray': ('kurtPop', 'Array'), 'quantilesGKArray': ('quantilesGK', 'Array'), 'meanZTestArray': ('meanZTest', 'Array'), 'argMinArray': ('argMin', 'Array'), 'stddevSampArray': ('stddevSamp', 'Array'), 'deltaSumTimestampArray': ('deltaSumTimestamp', 'Array'), 'stochasticLogisticRegressionArray': ('stochasticLogisticRegression', 'Array'), 'uniqCombined64Array': ('uniqCombined64', 'Array'), 'quantilesBFloat16WeightedArray': ('quantilesBFloat16Weighted', 'Array'), 'groupArrayMovingSumArray': ('groupArrayMovingSum', 'Array'), 'kolmogorovSmirnovTestArray': ('kolmogorovSmirnovTest', 'Array'), 'maxArray': ('max', 'Array'), 'quantileExactLowArray': ('quantileExactLow', 'Array'), 'quantileTDigestArray': ('quantileTDigest', 'Array'), 'exponentialMovingAverageArrayIf': ('exponentialMovingAverage', 'ArrayIf'), 'boundingRatioArrayIf': ('boundingRatio', 'ArrayIf'), 'cramersVBiasCorrectedArrayIf': ('cramersVBiasCorrected', 'ArrayIf'), 'quantilesDeterministicArrayIf': ('quantilesDeterministic', 'ArrayIf'), 'quantilesTimingWeightedArrayIf': ('quantilesTimingWeighted', 'ArrayIf'), 'quantileInterpolatedWeightedArrayIf': ('quantileInterpolatedWeighted', 'ArrayIf'), 'avgWeightedArrayIf': ('avgWeighted', 'ArrayIf'), 'medianArrayIf': ('median', 'ArrayIf'), 'quantilesExactLowArrayIf': ('quantilesExactLow', 'ArrayIf'), 'sumMapArrayIf': ('sumMap', 'ArrayIf'), 'simpleLinearRegressionArrayIf': ('simpleLinearRegression', 'ArrayIf'), 'uniqUpToArrayIf': ('uniqUpTo', 'ArrayIf'), 'maxMapArrayIf': ('maxMap', 'ArrayIf'), 'minMapArrayIf': ('minMap', 'ArrayIf'), 'argMaxArrayIf': ('argMax', 'ArrayIf'), 'categoricalInformationValueArrayIf': ('categoricalInformationValue', 'ArrayIf'), 'quantileExactArrayIf': ('quantileExact', 'ArrayIf'), 'quantilesExactWeightedArrayIf': ('quantilesExactWeighted', 'ArrayIf'), 'cramersVArrayIf': ('cramersV', 'ArrayIf'), 'quantileTimingArrayIf': ('quantileTiming', 'ArrayIf'), 'varSampArrayIf': ('varSamp', 'ArrayIf'), 'skewSampArrayIf': ('skewSamp', 'ArrayIf'), 'covarSampArrayIf': ('covarSamp', 'ArrayIf'), 'groupUniqArrayArrayIf': ('groupUniqArray', 'ArrayIf'), 'exponentialTimeDecayedAvgArrayIf': ('exponentialTimeDecayedAvg', 'ArrayIf'), 'anyLastArrayIf': ('anyLast', 'ArrayIf'), 'sequenceCountArrayIf': ('sequenceCount', 'ArrayIf'), 'kurtSampArrayIf': ('kurtSamp', 'ArrayIf'), 'quantilesArrayIf': ('quantiles', 'ArrayIf'), 'welchTTestArrayIf': ('welchTTest', 'ArrayIf'), 'groupArrayLastArrayIf': ('groupArrayLast', 'ArrayIf'), 'quantilesTDigestArrayIf': ('quantilesTDigest', 'ArrayIf'), 'quantileGKArrayIf': ('quantileGK', 'ArrayIf'), 'varPopArrayIf': ('varPop', 'ArrayIf'), 'rankCorrArrayIf': ('rankCorr', 'ArrayIf'), 'stochasticLinearRegressionArrayIf': ('stochasticLinearRegression', 'ArrayIf'), 'histogramArrayIf': ('histogram', 'ArrayIf'), 'quantilesBFloat16ArrayIf': ('quantilesBFloat16', 'ArrayIf'), 'avgArrayIf': ('avg', 'ArrayIf'), 'groupBitmapOrArrayIf': ('groupBitmapOr', 'ArrayIf'), 'windowFunnelArrayIf': ('windowFunnel', 'ArrayIf'), 'sumWithOverflowArrayIf': ('sumWithOverflow', 'ArrayIf'), 'uniqExactArrayIf': ('uniqExact', 'ArrayIf'), 'mannWhitneyUTestArrayIf': ('mannWhitneyUTest', 'ArrayIf'), 'uniqThetaArrayIf': ('uniqTheta', 'ArrayIf'), 'maxIntersectionsPositionArrayIf': ('maxIntersectionsPosition', 'ArrayIf'), 'topKArrayIf': ('topK', 'ArrayIf'), 'sumKahanArrayIf': ('sumKahan', 'ArrayIf'), 'sparkBarArrayIf': ('sparkBar', 'ArrayIf'), 'groupArrayArrayIf': ('groupArray', 'ArrayIf'), 'skewPopArrayIf': ('skewPop', 'ArrayIf'), 'groupBitmapArrayIf': ('groupBitmap', 'ArrayIf'), 'retentionArrayIf': ('retention', 'ArrayIf'), 'intervalLengthSumArrayIf': ('intervalLengthSum', 'ArrayIf'), 'quantilesExactHighArrayIf': ('quantilesExactHigh', 'ArrayIf'), 'corrArrayIf': ('corr', 'ArrayIf'), 'countArrayIf': ('count', 'ArrayIf'), 'largestTriangleThreeBucketsArrayIf': ('largestTriangleThreeBuckets', 'ArrayIf'), 'covarPopArrayIf': ('covarPop', 'ArrayIf'), 'groupBitXorArrayIf': ('groupBitXor', 'ArrayIf'), 'studentTTestArrayIf': ('studentTTest', 'ArrayIf'), 'anyArrayIf': ('any', 'ArrayIf'), 'anyHeavyArrayIf': ('anyHeavy', 'ArrayIf'), 'groupBitmapXorArrayIf': ('groupBitmapXor', 'ArrayIf'), 'last_valueArrayIf': ('last_value', 'ArrayIf'), 'sumArrayIf': ('sum', 'ArrayIf'), 'groupArraySampleArrayIf': ('groupArraySample', 'ArrayIf'), 'first_valueArrayIf': ('first_value', 'ArrayIf'), 'uniqCombinedArrayIf': ('uniqCombined', 'ArrayIf'), 'theilsUArrayIf': ('theilsU', 'ArrayIf'), 'deltaSumArrayIf': ('deltaSum', 'ArrayIf'), 'quantilesTDigestWeightedArrayIf': ('quantilesTDigestWeighted', 'ArrayIf'), 'quantileExactHighArrayIf': ('quantileExactHigh', 'ArrayIf'), 'contingencyArrayIf': ('contingency', 'ArrayIf'), 'quantileBFloat16ArrayIf': ('quantileBFloat16', 'ArrayIf'), 'groupArrayInsertAtArrayIf': ('groupArrayInsertAt', 'ArrayIf'), 'quantileBFloat16WeightedArrayIf': ('quantileBFloat16Weighted', 'ArrayIf'), 'quantileExactWeightedArrayIf': ('quantileExactWeighted', 'ArrayIf'), 'quantilesExactArrayIf': ('quantilesExact', 'ArrayIf'), 'quantileArrayIf': ('quantile', 'ArrayIf'), 'quantilesInterpolatedWeightedArrayIf': ('quantilesInterpolatedWeighted', 'ArrayIf'), 'groupBitAndArrayIf': ('groupBitAnd', 'ArrayIf'), 'topKWeightedArrayIf': ('topKWeighted', 'ArrayIf'), 'groupArrayMovingAvgArrayIf': ('groupArrayMovingAvg', 'ArrayIf'), 'groupBitOrArrayIf': ('groupBitOr', 'ArrayIf'), 'quantileTDigestWeightedArrayIf': ('quantileTDigestWeighted', 'ArrayIf'), 'minArrayIf': ('min', 'ArrayIf'), 'maxIntersectionsArrayIf': ('maxIntersections', 'ArrayIf'), 'stddevPopArrayIf': ('stddevPop', 'ArrayIf'), 'quantilesTimingArrayIf': ('quantilesTiming', 'ArrayIf'), 'sumCountArrayIf': ('sumCount', 'ArrayIf'), 'uniqArrayIf': ('uniq', 'ArrayIf'), 'quantileDeterministicArrayIf': ('quantileDeterministic', 'ArrayIf'), 'entropyArrayIf': ('entropy', 'ArrayIf'), 'groupBitmapAndArrayIf': ('groupBitmapAnd', 'ArrayIf'), 'uniqHLL12ArrayIf': ('uniqHLL12', 'ArrayIf'), 'sequenceMatchArrayIf': ('sequenceMatch', 'ArrayIf'), 'sequenceNextNodeArrayIf': ('sequenceNextNode', 'ArrayIf'), 'quantileTimingWeightedArrayIf': ('quantileTimingWeighted', 'ArrayIf'), 'kurtPopArrayIf': ('kurtPop', 'ArrayIf'), 'quantilesGKArrayIf': ('quantilesGK', 'ArrayIf'), 'meanZTestArrayIf': ('meanZTest', 'ArrayIf'), 'argMinArrayIf': ('argMin', 'ArrayIf'), 'stddevSampArrayIf': ('stddevSamp', 'ArrayIf'), 'deltaSumTimestampArrayIf': ('deltaSumTimestamp', 'ArrayIf'), 'stochasticLogisticRegressionArrayIf': ('stochasticLogisticRegression', 'ArrayIf'), 'uniqCombined64ArrayIf': ('uniqCombined64', 'ArrayIf'), 'quantilesBFloat16WeightedArrayIf': ('quantilesBFloat16Weighted', 'ArrayIf'), 'groupArrayMovingSumArrayIf': ('groupArrayMovingSum', 'ArrayIf'), 'kolmogorovSmirnovTestArrayIf': ('kolmogorovSmirnovTest', 'ArrayIf'), 'maxArrayIf': ('max', 'ArrayIf'), 'quantileExactLowArrayIf': ('quantileExactLow', 'ArrayIf'), 'quantileTDigestArrayIf': ('quantileTDigest', 'ArrayIf'), 'exponentialMovingAverageMap': ('exponentialMovingAverage', 'Map'), 'boundingRatioMap': ('boundingRatio', 'Map'), 'cramersVBiasCorrectedMap': ('cramersVBiasCorrected', 'Map'), 'quantilesDeterministicMap': ('quantilesDeterministic', 'Map'), 'quantilesTimingWeightedMap': ('quantilesTimingWeighted', 'Map'), 'quantileInterpolatedWeightedMap': ('quantileInterpolatedWeighted', 'Map'), 'avgWeightedMap': ('avgWeighted', 'Map'), 'medianMap': ('median', 'Map'), 'quantilesExactLowMap': ('quantilesExactLow', 'Map'), 'sumMapMap': ('sumMap', 'Map'), 'simpleLinearRegressionMap': ('simpleLinearRegression', 'Map'), 'uniqUpToMap': ('uniqUpTo', 'Map'), 'maxMapMap': ('maxMap', 'Map'), 'minMapMap': ('minMap', 'Map'), 'argMaxMap': ('argMax', 'Map'), 'categoricalInformationValueMap': ('categoricalInformationValue', 'Map'), 'quantileExactMap': ('quantileExact', 'Map'), 'quantilesExactWeightedMap': ('quantilesExactWeighted', 'Map'), 'cramersVMap': ('cramersV', 'Map'), 'quantileTimingMap': ('quantileTiming', 'Map'), 'varSampMap': ('varSamp', 'Map'), 'skewSampMap': ('skewSamp', 'Map'), 'covarSampMap': ('covarSamp', 'Map'), 'groupUniqArrayMap': ('groupUniqArray', 'Map'), 'exponentialTimeDecayedAvgMap': ('exponentialTimeDecayedAvg', 'Map'), 'anyLastMap': ('anyLast', 'Map'), 'sequenceCountMap': ('sequenceCount', 'Map'), 'kurtSampMap': ('kurtSamp', 'Map'), 'quantilesMap': ('quantiles', 'Map'), 'welchTTestMap': ('welchTTest', 'Map'), 'groupArrayLastMap': ('groupArrayLast', 'Map'), 'quantilesTDigestMap': ('quantilesTDigest', 'Map'), 'quantileGKMap': ('quantileGK', 'Map'), 'varPopMap': ('varPop', 'Map'), 'rankCorrMap': ('rankCorr', 'Map'), 'stochasticLinearRegressionMap': ('stochasticLinearRegression', 'Map'), 'histogramMap': ('histogram', 'Map'), 'quantilesBFloat16Map': ('quantilesBFloat16', 'Map'), 'avgMap': ('avg', 'Map'), 'groupBitmapOrMap': ('groupBitmapOr', 'Map'), 'windowFunnelMap': ('windowFunnel', 'Map'), 'sumWithOverflowMap': ('sumWithOverflow', 'Map'), 'uniqExactMap': ('uniqExact', 'Map'), 'mannWhitneyUTestMap': ('mannWhitneyUTest', 'Map'), 'uniqThetaMap': ('uniqTheta', 'Map'), 'maxIntersectionsPositionMap': ('maxIntersectionsPosition', 'Map'), 'topKMap': ('topK', 'Map'), 'sumKahanMap': ('sumKahan', 'Map'), 'sparkBarMap': ('sparkBar', 'Map'), 'groupArrayMap': ('groupArray', 'Map'), 'skewPopMap': ('skewPop', 'Map'), 'groupBitmapMap': ('groupBitmap', 'Map'), 'retentionMap': ('retention', 'Map'), 'intervalLengthSumMap': ('intervalLengthSum', 'Map'), 'quantilesExactHighMap': ('quantilesExactHigh', 'Map'), 'corrMap': ('corr', 'Map'), 'countMap': ('count', 'Map'), 'largestTriangleThreeBucketsMap': ('largestTriangleThreeBuckets', 'Map'), 'covarPopMap': ('covarPop', 'Map'), 'groupBitXorMap': ('groupBitXor', 'Map'), 'studentTTestMap': ('studentTTest', 'Map'), 'anyMap': ('any', 'Map'), 'anyHeavyMap': ('anyHeavy', 'Map'), 'groupBitmapXorMap': ('groupBitmapXor', 'Map'), 'last_valueMap': ('last_value', 'Map'), 'sumMap': ('sumMap', ''), 'groupArraySampleMap': ('groupArraySample', 'Map'), 'first_valueMap': ('first_value', 'Map'), 'uniqCombinedMap': ('uniqCombined', 'Map'), 'theilsUMap': ('theilsU', 'Map'), 'deltaSumMap': ('deltaSum', 'Map'), 'quantilesTDigestWeightedMap': ('quantilesTDigestWeighted', 'Map'), 'quantileExactHighMap': ('quantileExactHigh', 'Map'), 'contingencyMap': ('contingency', 'Map'), 'quantileBFloat16Map': ('quantileBFloat16', 'Map'), 'groupArrayInsertAtMap': ('groupArrayInsertAt', 'Map'), 'quantileBFloat16WeightedMap': ('quantileBFloat16Weighted', 'Map'), 'quantileExactWeightedMap': ('quantileExactWeighted', 'Map'), 'quantilesExactMap': ('quantilesExact', 'Map'), 'quantileMap': ('quantile', 'Map'), 'quantilesInterpolatedWeightedMap': ('quantilesInterpolatedWeighted', 'Map'), 'groupBitAndMap': ('groupBitAnd', 'Map'), 'topKWeightedMap': ('topKWeighted', 'Map'), 'groupArrayMovingAvgMap': ('groupArrayMovingAvg', 'Map'), 'groupBitOrMap': ('groupBitOr', 'Map'), 'quantileTDigestWeightedMap': ('quantileTDigestWeighted', 'Map'), 'minMap': ('minMap', ''), 'maxIntersectionsMap': ('maxIntersections', 'Map'), 'stddevPopMap': ('stddevPop', 'Map'), 'quantilesTimingMap': ('quantilesTiming', 'Map'), 'sumCountMap': ('sumCount', 'Map'), 'uniqMap': ('uniq', 'Map'), 'quantileDeterministicMap': ('quantileDeterministic', 'Map'), 'entropyMap': ('entropy', 'Map'), 'groupBitmapAndMap': ('groupBitmapAnd', 'Map'), 'uniqHLL12Map': ('uniqHLL12', 'Map'), 'sequenceMatchMap': ('sequenceMatch', 'Map'), 'sequenceNextNodeMap': ('sequenceNextNode', 'Map'), 'quantileTimingWeightedMap': ('quantileTimingWeighted', 'Map'), 'kurtPopMap': ('kurtPop', 'Map'), 'quantilesGKMap': ('quantilesGK', 'Map'), 'meanZTestMap': ('meanZTest', 'Map'), 'argMinMap': ('argMin', 'Map'), 'stddevSampMap': ('stddevSamp', 'Map'), 'deltaSumTimestampMap': ('deltaSumTimestamp', 'Map'), 'stochasticLogisticRegressionMap': ('stochasticLogisticRegression', 'Map'), 'uniqCombined64Map': ('uniqCombined64', 'Map'), 'quantilesBFloat16WeightedMap': ('quantilesBFloat16Weighted', 'Map'), 'groupArrayMovingSumMap': ('groupArrayMovingSum', 'Map'), 'kolmogorovSmirnovTestMap': ('kolmogorovSmirnovTest', 'Map'), 'maxMap': ('maxMap', ''), 'quantileExactLowMap': ('quantileExactLow', 'Map'), 'quantileTDigestMap': ('quantileTDigest', 'Map'), 'exponentialMovingAverageSimpleState': ('exponentialMovingAverage', 'SimpleState'), 'boundingRatioSimpleState': ('boundingRatio', 'SimpleState'), 'cramersVBiasCorrectedSimpleState': ('cramersVBiasCorrected', 'SimpleState'), 'quantilesDeterministicSimpleState': ('quantilesDeterministic', 'SimpleState'), 'quantilesTimingWeightedSimpleState': ('quantilesTimingWeighted', 'SimpleState'), 'quantileInterpolatedWeightedSimpleState': ('quantileInterpolatedWeighted', 'SimpleState'), 'avgWeightedSimpleState': ('avgWeighted', 'SimpleState'), 'medianSimpleState': ('median', 'SimpleState'), 'quantilesExactLowSimpleState': ('quantilesExactLow', 'SimpleState'), 'sumMapSimpleState': ('sumMap', 'SimpleState'), 'simpleLinearRegressionSimpleState': ('simpleLinearRegression', 'SimpleState'), 'uniqUpToSimpleState': ('uniqUpTo', 'SimpleState'), 'maxMapSimpleState': ('maxMap', 'SimpleState'), 'minMapSimpleState': ('minMap', 'SimpleState'), 'argMaxSimpleState': ('argMax', 'SimpleState'), 'categoricalInformationValueSimpleState': ('categoricalInformationValue', 'SimpleState'), 'quantileExactSimpleState': ('quantileExact', 'SimpleState'), 'quantilesExactWeightedSimpleState': ('quantilesExactWeighted', 'SimpleState'), 'cramersVSimpleState': ('cramersV', 'SimpleState'), 'quantileTimingSimpleState': ('quantileTiming', 'SimpleState'), 'varSampSimpleState': ('varSamp', 'SimpleState'), 'skewSampSimpleState': ('skewSamp', 'SimpleState'), 'covarSampSimpleState': ('covarSamp', 'SimpleState'), 'groupUniqArraySimpleState': ('groupUniqArray', 'SimpleState'), 'exponentialTimeDecayedAvgSimpleState': ('exponentialTimeDecayedAvg', 'SimpleState'), 'anyLastSimpleState': ('anyLast', 'SimpleState'), 'sequenceCountSimpleState': ('sequenceCount', 'SimpleState'), 'kurtSampSimpleState': ('kurtSamp', 'SimpleState'), 'quantilesSimpleState': ('quantiles', 'SimpleState'), 'welchTTestSimpleState': ('welchTTest', 'SimpleState'), 'groupArrayLastSimpleState': ('groupArrayLast', 'SimpleState'), 'quantilesTDigestSimpleState': ('quantilesTDigest', 'SimpleState'), 'quantileGKSimpleState': ('quantileGK', 'SimpleState'), 'varPopSimpleState': ('varPop', 'SimpleState'), 'rankCorrSimpleState': ('rankCorr', 'SimpleState'), 'stochasticLinearRegressionSimpleState': ('stochasticLinearRegression', 'SimpleState'), 'histogramSimpleState': ('histogram', 'SimpleState'), 'quantilesBFloat16SimpleState': ('quantilesBFloat16', 'SimpleState'), 'avgSimpleState': ('avg', 'SimpleState'), 'groupBitmapOrSimpleState': ('groupBitmapOr', 'SimpleState'), 'windowFunnelSimpleState': ('windowFunnel', 'SimpleState'), 'sumWithOverflowSimpleState': ('sumWithOverflow', 'SimpleState'), 'uniqExactSimpleState': ('uniqExact', 'SimpleState'), 'mannWhitneyUTestSimpleState': ('mannWhitneyUTest', 'SimpleState'), 'uniqThetaSimpleState': ('uniqTheta', 'SimpleState'), 'maxIntersectionsPositionSimpleState': ('maxIntersectionsPosition', 'SimpleState'), 'topKSimpleState': ('topK', 'SimpleState'), 'sumKahanSimpleState': ('sumKahan', 'SimpleState'), 'sparkBarSimpleState': ('sparkBar', 'SimpleState'), 'groupArraySimpleState': ('groupArray', 'SimpleState'), 'skewPopSimpleState': ('skewPop', 'SimpleState'), 'groupBitmapSimpleState': ('groupBitmap', 'SimpleState'), 'retentionSimpleState': ('retention', 'SimpleState'), 'intervalLengthSumSimpleState': ('intervalLengthSum', 'SimpleState'), 'quantilesExactHighSimpleState': ('quantilesExactHigh', 'SimpleState'), 'corrSimpleState': ('corr', 'SimpleState'), 'countSimpleState': ('count', 'SimpleState'), 'largestTriangleThreeBucketsSimpleState': ('largestTriangleThreeBuckets', 'SimpleState'), 'covarPopSimpleState': ('covarPop', 'SimpleState'), 'groupBitXorSimpleState': ('groupBitXor', 'SimpleState'), 'studentTTestSimpleState': ('studentTTest', 'SimpleState'), 'anySimpleState': ('any', 'SimpleState'), 'anyHeavySimpleState': ('anyHeavy', 'SimpleState'), 'groupBitmapXorSimpleState': ('groupBitmapXor', 'SimpleState'), 'last_valueSimpleState': ('last_value', 'SimpleState'), 'sumSimpleState': ('sum', 'SimpleState'), 'groupArraySampleSimpleState': ('groupArraySample', 'SimpleState'), 'first_valueSimpleState': ('first_value', 'SimpleState'), 'uniqCombinedSimpleState': ('uniqCombined', 'SimpleState'), 'theilsUSimpleState': ('theilsU', 'SimpleState'), 'deltaSumSimpleState': ('deltaSum', 'SimpleState'), 'quantilesTDigestWeightedSimpleState': ('quantilesTDigestWeighted', 'SimpleState'), 'quantileExactHighSimpleState': ('quantileExactHigh', 'SimpleState'), 'contingencySimpleState': ('contingency', 'SimpleState'), 'quantileBFloat16SimpleState': ('quantileBFloat16', 'SimpleState'), 'groupArrayInsertAtSimpleState': ('groupArrayInsertAt', 'SimpleState'), 'quantileBFloat16WeightedSimpleState': ('quantileBFloat16Weighted', 'SimpleState'), 'quantileExactWeightedSimpleState': ('quantileExactWeighted', 'SimpleState'), 'quantilesExactSimpleState': ('quantilesExact', 'SimpleState'), 'quantileSimpleState': ('quantile', 'SimpleState'), 'quantilesInterpolatedWeightedSimpleState': ('quantilesInterpolatedWeighted', 'SimpleState'), 'groupBitAndSimpleState': ('groupBitAnd', 'SimpleState'), 'topKWeightedSimpleState': ('topKWeighted', 'SimpleState'), 'groupArrayMovingAvgSimpleState': ('groupArrayMovingAvg', 'SimpleState'), 'groupBitOrSimpleState': ('groupBitOr', 'SimpleState'), 'quantileTDigestWeightedSimpleState': ('quantileTDigestWeighted', 'SimpleState'), 'minSimpleState': ('min', 'SimpleState'), 'maxIntersectionsSimpleState': ('maxIntersections', 'SimpleState'), 'stddevPopSimpleState': ('stddevPop', 'SimpleState'), 'quantilesTimingSimpleState': ('quantilesTiming', 'SimpleState'), 'sumCountSimpleState': ('sumCount', 'SimpleState'), 'uniqSimpleState': ('uniq', 'SimpleState'), 'quantileDeterministicSimpleState': ('quantileDeterministic', 'SimpleState'), 'entropySimpleState': ('entropy', 'SimpleState'), 'groupBitmapAndSimpleState': ('groupBitmapAnd', 'SimpleState'), 'uniqHLL12SimpleState': ('uniqHLL12', 'SimpleState'), 'sequenceMatchSimpleState': ('sequenceMatch', 'SimpleState'), 'sequenceNextNodeSimpleState': ('sequenceNextNode', 'SimpleState'), 'quantileTimingWeightedSimpleState': ('quantileTimingWeighted', 'SimpleState'), 'kurtPopSimpleState': ('kurtPop', 'SimpleState'), 'quantilesGKSimpleState': ('quantilesGK', 'SimpleState'), 'meanZTestSimpleState': ('meanZTest', 'SimpleState'), 'argMinSimpleState': ('argMin', 'SimpleState'), 'stddevSampSimpleState': ('stddevSamp', 'SimpleState'), 'deltaSumTimestampSimpleState': ('deltaSumTimestamp', 'SimpleState'), 'stochasticLogisticRegressionSimpleState': ('stochasticLogisticRegression', 'SimpleState'), 'uniqCombined64SimpleState': ('uniqCombined64', 'SimpleState'), 'quantilesBFloat16WeightedSimpleState': ('quantilesBFloat16Weighted', 'SimpleState'), 'groupArrayMovingSumSimpleState': ('groupArrayMovingSum', 'SimpleState'), 'kolmogorovSmirnovTestSimpleState': ('kolmogorovSmirnovTest', 'SimpleState'), 'maxSimpleState': ('max', 'SimpleState'), 'quantileExactLowSimpleState': ('quantileExactLow', 'SimpleState'), 'quantileTDigestSimpleState': ('quantileTDigest', 'SimpleState'), 'exponentialMovingAverageState': ('exponentialMovingAverage', 'State'), 'boundingRatioState': ('boundingRatio', 'State'), 'cramersVBiasCorrectedState': ('cramersVBiasCorrected', 'State'), 'quantilesDeterministicState': ('quantilesDeterministic', 'State'), 'quantilesTimingWeightedState': ('quantilesTimingWeighted', 'State'), 'quantileInterpolatedWeightedState': ('quantileInterpolatedWeighted', 'State'), 'avgWeightedState': ('avgWeighted', 'State'), 'medianState': ('median', 'State'), 'quantilesExactLowState': ('quantilesExactLow', 'State'), 'sumMapState': ('sumMap', 'State'), 'simpleLinearRegressionState': ('simpleLinearRegression', 'State'), 'uniqUpToState': ('uniqUpTo', 'State'), 'maxMapState': ('maxMap', 'State'), 'minMapState': ('minMap', 'State'), 'argMaxState': ('argMax', 'State'), 'categoricalInformationValueState': ('categoricalInformationValue', 'State'), 'quantileExactState': ('quantileExact', 'State'), 'quantilesExactWeightedState': ('quantilesExactWeighted', 'State'), 'cramersVState': ('cramersV', 'State'), 'quantileTimingState': ('quantileTiming', 'State'), 'varSampState': ('varSamp', 'State'), 'skewSampState': ('skewSamp', 'State'), 'covarSampState': ('covarSamp', 'State'), 'groupUniqArrayState': ('groupUniqArray', 'State'), 'exponentialTimeDecayedAvgState': ('exponentialTimeDecayedAvg', 'State'), 'anyLastState': ('anyLast', 'State'), 'sequenceCountState': ('sequenceCount', 'State'), 'kurtSampState': ('kurtSamp', 'State'), 'quantilesState': ('quantiles', 'State'), 'welchTTestState': ('welchTTest', 'State'), 'groupArrayLastState': ('groupArrayLast', 'State'), 'quantilesTDigestState': ('quantilesTDigest', 'State'), 'quantileGKState': ('quantileGK', 'State'), 'varPopState': ('varPop', 'State'), 'rankCorrState': ('rankCorr', 'State'), 'stochasticLinearRegressionState': ('stochasticLinearRegression', 'State'), 'histogramState': ('histogram', 'State'), 'quantilesBFloat16State': ('quantilesBFloat16', 'State'), 'avgState': ('avg', 'State'), 'groupBitmapOrState': ('groupBitmapOr', 'State'), 'windowFunnelState': ('windowFunnel', 'State'), 'sumWithOverflowState': ('sumWithOverflow', 'State'), 'uniqExactState': ('uniqExact', 'State'), 'mannWhitneyUTestState': ('mannWhitneyUTest', 'State'), 'uniqThetaState': ('uniqTheta', 'State'), 'maxIntersectionsPositionState': ('maxIntersectionsPosition', 'State'), 'topKState': ('topK', 'State'), 'sumKahanState': ('sumKahan', 'State'), 'sparkBarState': ('sparkBar', 'State'), 'groupArrayState': ('groupArray', 'State'), 'skewPopState': ('skewPop', 'State'), 'groupBitmapState': ('groupBitmap', 'State'), 'retentionState': ('retention', 'State'), 'intervalLengthSumState': ('intervalLengthSum', 'State'), 'quantilesExactHighState': ('quantilesExactHigh', 'State'), 'corrState': ('corr', 'State'), 'countState': ('count', 'State'), 'largestTriangleThreeBucketsState': ('largestTriangleThreeBuckets', 'State'), 'covarPopState': ('covarPop', 'State'), 'groupBitXorState': ('groupBitXor', 'State'), 'studentTTestState': ('studentTTest', 'State'), 'anyState': ('any', 'State'), 'anyHeavyState': ('anyHeavy', 'State'), 'groupBitmapXorState': ('groupBitmapXor', 'State'), 'last_valueState': ('last_value', 'State'), 'sumState': ('sum', 'State'), 'groupArraySampleState': ('groupArraySample', 'State'), 'first_valueState': ('first_value', 'State'), 'uniqCombinedState': ('uniqCombined', 'State'), 'theilsUState': ('theilsU', 'State'), 'deltaSumState': ('deltaSum', 'State'), 'quantilesTDigestWeightedState': ('quantilesTDigestWeighted', 'State'), 'quantileExactHighState': ('quantileExactHigh', 'State'), 'contingencyState': ('contingency', 'State'), 'quantileBFloat16State': ('quantileBFloat16', 'State'), 'groupArrayInsertAtState': ('groupArrayInsertAt', 'State'), 'quantileBFloat16WeightedState': ('quantileBFloat16Weighted', 'State'), 'quantileExactWeightedState': ('quantileExactWeighted', 'State'), 'quantilesExactState': ('quantilesExact', 'State'), 'quantileState': ('quantile', 'State'), 'quantilesInterpolatedWeightedState': ('quantilesInterpolatedWeighted', 'State'), 'groupBitAndState': ('groupBitAnd', 'State'), 'topKWeightedState': ('topKWeighted', 'State'), 'groupArrayMovingAvgState': ('groupArrayMovingAvg', 'State'), 'groupBitOrState': ('groupBitOr', 'State'), 'quantileTDigestWeightedState': ('quantileTDigestWeighted', 'State'), 'minState': ('min', 'State'), 'maxIntersectionsState': ('maxIntersections', 'State'), 'stddevPopState': ('stddevPop', 'State'), 'quantilesTimingState': ('quantilesTiming', 'State'), 'sumCountState': ('sumCount', 'State'), 'uniqState': ('uniq', 'State'), 'quantileDeterministicState': ('quantileDeterministic', 'State'), 'entropyState': ('entropy', 'State'), 'groupBitmapAndState': ('groupBitmapAnd', 'State'), 'uniqHLL12State': ('uniqHLL12', 'State'), 'sequenceMatchState': ('sequenceMatch', 'State'), 'sequenceNextNodeState': ('sequenceNextNode', 'State'), 'quantileTimingWeightedState': ('quantileTimingWeighted', 'State'), 'kurtPopState': ('kurtPop', 'State'), 'quantilesGKState': ('quantilesGK', 'State'), 'meanZTestState': ('meanZTest', 'State'), 'argMinState': ('argMin', 'State'), 'stddevSampState': ('stddevSamp', 'State'), 'deltaSumTimestampState': ('deltaSumTimestamp', 'State'), 'stochasticLogisticRegressionState': ('stochasticLogisticRegression', 'State'), 'uniqCombined64State': ('uniqCombined64', 'State'), 'quantilesBFloat16WeightedState': ('quantilesBFloat16Weighted', 'State'), 'groupArrayMovingSumState': ('groupArrayMovingSum', 'State'), 'kolmogorovSmirnovTestState': ('kolmogorovSmirnovTest', 'State'), 'maxState': ('max', 'State'), 'quantileExactLowState': ('quantileExactLow', 'State'), 'quantileTDigestState': ('quantileTDigest', 'State'), 'exponentialMovingAverageMerge': ('exponentialMovingAverage', 'Merge'), 'boundingRatioMerge': ('boundingRatio', 'Merge'), 'cramersVBiasCorrectedMerge': ('cramersVBiasCorrected', 'Merge'), 'quantilesDeterministicMerge': ('quantilesDeterministic', 'Merge'), 'quantilesTimingWeightedMerge': ('quantilesTimingWeighted', 'Merge'), 'quantileInterpolatedWeightedMerge': ('quantileInterpolatedWeighted', 'Merge'), 'avgWeightedMerge': ('avgWeighted', 'Merge'), 'medianMerge': ('median', 'Merge'), 'quantilesExactLowMerge': ('quantilesExactLow', 'Merge'), 'sumMapMerge': ('sumMap', 'Merge'), 'simpleLinearRegressionMerge': ('simpleLinearRegression', 'Merge'), 'uniqUpToMerge': ('uniqUpTo', 'Merge'), 'maxMapMerge': ('maxMap', 'Merge'), 'minMapMerge': ('minMap', 'Merge'), 'argMaxMerge': ('argMax', 'Merge'), 'categoricalInformationValueMerge': ('categoricalInformationValue', 'Merge'), 'quantileExactMerge': ('quantileExact', 'Merge'), 'quantilesExactWeightedMerge': ('quantilesExactWeighted', 'Merge'), 'cramersVMerge': ('cramersV', 'Merge'), 'quantileTimingMerge': ('quantileTiming', 'Merge'), 'varSampMerge': ('varSamp', 'Merge'), 'skewSampMerge': ('skewSamp', 'Merge'), 'covarSampMerge': ('covarSamp', 'Merge'), 'groupUniqArrayMerge': ('groupUniqArray', 'Merge'), 'exponentialTimeDecayedAvgMerge': ('exponentialTimeDecayedAvg', 'Merge'), 'anyLastMerge': ('anyLast', 'Merge'), 'sequenceCountMerge': ('sequenceCount', 'Merge'), 'kurtSampMerge': ('kurtSamp', 'Merge'), 'quantilesMerge': ('quantiles', 'Merge'), 'welchTTestMerge': ('welchTTest', 'Merge'), 'groupArrayLastMerge': ('groupArrayLast', 'Merge'), 'quantilesTDigestMerge': ('quantilesTDigest', 'Merge'), 'quantileGKMerge': ('quantileGK', 'Merge'), 'varPopMerge': ('varPop', 'Merge'), 'rankCorrMerge': ('rankCorr', 'Merge'), 'stochasticLinearRegressionMerge': ('stochasticLinearRegression', 'Merge'), 'histogramMerge': ('histogram', 'Merge'), 'quantilesBFloat16Merge': ('quantilesBFloat16', 'Merge'), 'avgMerge': ('avg', 'Merge'), 'groupBitmapOrMerge': ('groupBitmapOr', 'Merge'), 'windowFunnelMerge': ('windowFunnel', 'Merge'), 'sumWithOverflowMerge': ('sumWithOverflow', 'Merge'), 'uniqExactMerge': ('uniqExact', 'Merge'), 'mannWhitneyUTestMerge': ('mannWhitneyUTest', 'Merge'), 'uniqThetaMerge': ('uniqTheta', 'Merge'), 'maxIntersectionsPositionMerge': ('maxIntersectionsPosition', 'Merge'), 'topKMerge': ('topK', 'Merge'), 'sumKahanMerge': ('sumKahan', 'Merge'), 'sparkBarMerge': ('sparkBar', 'Merge'), 'groupArrayMerge': ('groupArray', 'Merge'), 'skewPopMerge': ('skewPop', 'Merge'), 'groupBitmapMerge': ('groupBitmap', 'Merge'), 'retentionMerge': ('retention', 'Merge'), 'intervalLengthSumMerge': ('intervalLengthSum', 'Merge'), 'quantilesExactHighMerge': ('quantilesExactHigh', 'Merge'), 'corrMerge': ('corr', 'Merge'), 'countMerge': ('count', 'Merge'), 'largestTriangleThreeBucketsMerge': ('largestTriangleThreeBuckets', 'Merge'), 'covarPopMerge': ('covarPop', 'Merge'), 'groupBitXorMerge': ('groupBitXor', 'Merge'), 'studentTTestMerge': ('studentTTest', 'Merge'), 'anyMerge': ('any', 'Merge'), 'anyHeavyMerge': ('anyHeavy', 'Merge'), 'groupBitmapXorMerge': ('groupBitmapXor', 'Merge'), 'last_valueMerge': ('last_value', 'Merge'), 'sumMerge': ('sum', 'Merge'), 'groupArraySampleMerge': ('groupArraySample', 'Merge'), 'first_valueMerge': ('first_value', 'Merge'), 'uniqCombinedMerge': ('uniqCombined', 'Merge'), 'theilsUMerge': ('theilsU', 'Merge'), 'deltaSumMerge': ('deltaSum', 'Merge'), 'quantilesTDigestWeightedMerge': ('quantilesTDigestWeighted', 'Merge'), 'quantileExactHighMerge': ('quantileExactHigh', 'Merge'), 'contingencyMerge': ('contingency', 'Merge'), 'quantileBFloat16Merge': ('quantileBFloat16', 'Merge'), 'groupArrayInsertAtMerge': ('groupArrayInsertAt', 'Merge'), 'quantileBFloat16WeightedMerge': ('quantileBFloat16Weighted', 'Merge'), 'quantileExactWeightedMerge': ('quantileExactWeighted', 'Merge'), 'quantilesExactMerge': ('quantilesExact', 'Merge'), 'quantileMerge': ('quantile', 'Merge'), 'quantilesInterpolatedWeightedMerge': ('quantilesInterpolatedWeighted', 'Merge'), 'groupBitAndMerge': ('groupBitAnd', 'Merge'), 'topKWeightedMerge': ('topKWeighted', 'Merge'), 'groupArrayMovingAvgMerge': ('groupArrayMovingAvg', 'Merge'), 'groupBitOrMerge': ('groupBitOr', 'Merge'), 'quantileTDigestWeightedMerge': ('quantileTDigestWeighted', 'Merge'), 'minMerge': ('min', 'Merge'), 'maxIntersectionsMerge': ('maxIntersections', 'Merge'), 'stddevPopMerge': ('stddevPop', 'Merge'), 'quantilesTimingMerge': ('quantilesTiming', 'Merge'), 'sumCountMerge': ('sumCount', 'Merge'), 'uniqMerge': ('uniq', 'Merge'), 'quantileDeterministicMerge': ('quantileDeterministic', 'Merge'), 'entropyMerge': ('entropy', 'Merge'), 'groupBitmapAndMerge': ('groupBitmapAnd', 'Merge'), 'uniqHLL12Merge': ('uniqHLL12', 'Merge'), 'sequenceMatchMerge': ('sequenceMatch', 'Merge'), 'sequenceNextNodeMerge': ('sequenceNextNode', 'Merge'), 'quantileTimingWeightedMerge': ('quantileTimingWeighted', 'Merge'), 'kurtPopMerge': ('kurtPop', 'Merge'), 'quantilesGKMerge': ('quantilesGK', 'Merge'), 'meanZTestMerge': ('meanZTest', 'Merge'), 'argMinMerge': ('argMin', 'Merge'), 'stddevSampMerge': ('stddevSamp', 'Merge'), 'deltaSumTimestampMerge': ('deltaSumTimestamp', 'Merge'), 'stochasticLogisticRegressionMerge': ('stochasticLogisticRegression', 'Merge'), 'uniqCombined64Merge': ('uniqCombined64', 'Merge'), 'quantilesBFloat16WeightedMerge': ('quantilesBFloat16Weighted', 'Merge'), 'groupArrayMovingSumMerge': ('groupArrayMovingSum', 'Merge'), 'kolmogorovSmirnovTestMerge': ('kolmogorovSmirnovTest', 'Merge'), 'maxMerge': ('max', 'Merge'), 'quantileExactLowMerge': ('quantileExactLow', 'Merge'), 'quantileTDigestMerge': ('quantileTDigest', 'Merge'), 'exponentialMovingAverageMergeState': ('exponentialMovingAverage', 'MergeState'), 'boundingRatioMergeState': ('boundingRatio', 'MergeState'), 'cramersVBiasCorrectedMergeState': ('cramersVBiasCorrected', 'MergeState'), 'quantilesDeterministicMergeState': ('quantilesDeterministic', 'MergeState'), 'quantilesTimingWeightedMergeState': ('quantilesTimingWeighted', 'MergeState'), 'quantileInterpolatedWeightedMergeState': ('quantileInterpolatedWeighted', 'MergeState'), 'avgWeightedMergeState': ('avgWeighted', 'MergeState'), 'medianMergeState': ('median', 'MergeState'), 'quantilesExactLowMergeState': ('quantilesExactLow', 'MergeState'), 'sumMapMergeState': ('sumMap', 'MergeState'), 'simpleLinearRegressionMergeState': ('simpleLinearRegression', 'MergeState'), 'uniqUpToMergeState': ('uniqUpTo', 'MergeState'), 'maxMapMergeState': ('maxMap', 'MergeState'), 'minMapMergeState': ('minMap', 'MergeState'), 'argMaxMergeState': ('argMax', 'MergeState'), 'categoricalInformationValueMergeState': ('categoricalInformationValue', 'MergeState'), 'quantileExactMergeState': ('quantileExact', 'MergeState'), 'quantilesExactWeightedMergeState': ('quantilesExactWeighted', 'MergeState'), 'cramersVMergeState': ('cramersV', 'MergeState'), 'quantileTimingMergeState': ('quantileTiming', 'MergeState'), 'varSampMergeState': ('varSamp', 'MergeState'), 'skewSampMergeState': ('skewSamp', 'MergeState'), 'covarSampMergeState': ('covarSamp', 'MergeState'), 'groupUniqArrayMergeState': ('groupUniqArray', 'MergeState'), 'exponentialTimeDecayedAvgMergeState': ('exponentialTimeDecayedAvg', 'MergeState'), 'anyLastMergeState': ('anyLast', 'MergeState'), 'sequenceCountMergeState': ('sequenceCount', 'MergeState'), 'kurtSampMergeState': ('kurtSamp', 'MergeState'), 'quantilesMergeState': ('quantiles', 'MergeState'), 'welchTTestMergeState': ('welchTTest', 'MergeState'), 'groupArrayLastMergeState': ('groupArrayLast', 'MergeState'), 'quantilesTDigestMergeState': ('quantilesTDigest', 'MergeState'), 'quantileGKMergeState': ('quantileGK', 'MergeState'), 'varPopMergeState': ('varPop', 'MergeState'), 'rankCorrMergeState': ('rankCorr', 'MergeState'), 'stochasticLinearRegressionMergeState': ('stochasticLinearRegression', 'MergeState'), 'histogramMergeState': ('histogram', 'MergeState'), 'quantilesBFloat16MergeState': ('quantilesBFloat16', 'MergeState'), 'avgMergeState': ('avg', 'MergeState'), 'groupBitmapOrMergeState': ('groupBitmapOr', 'MergeState'), 'windowFunnelMergeState': ('windowFunnel', 'MergeState'), 'sumWithOverflowMergeState': ('sumWithOverflow', 'MergeState'), 'uniqExactMergeState': ('uniqExact', 'MergeState'), 'mannWhitneyUTestMergeState': ('mannWhitneyUTest', 'MergeState'), 'uniqThetaMergeState': ('uniqTheta', 'MergeState'), 'maxIntersectionsPositionMergeState': ('maxIntersectionsPosition', 'MergeState'), 'topKMergeState': ('topK', 'MergeState'), 'sumKahanMergeState': ('sumKahan', 'MergeState'), 'sparkBarMergeState': ('sparkBar', 'MergeState'), 'groupArrayMergeState': ('groupArray', 'MergeState'), 'skewPopMergeState': ('skewPop', 'MergeState'), 'groupBitmapMergeState': ('groupBitmap', 'MergeState'), 'retentionMergeState': ('retention', 'MergeState'), 'intervalLengthSumMergeState': ('intervalLengthSum', 'MergeState'), 'quantilesExactHighMergeState': ('quantilesExactHigh', 'MergeState'), 'corrMergeState': ('corr', 'MergeState'), 'countMergeState': ('count', 'MergeState'), 'largestTriangleThreeBucketsMergeState': ('largestTriangleThreeBuckets', 'MergeState'), 'covarPopMergeState': ('covarPop', 'MergeState'), 'groupBitXorMergeState': ('groupBitXor', 'MergeState'), 'studentTTestMergeState': ('studentTTest', 'MergeState'), 'anyMergeState': ('any', 'MergeState'), 'anyHeavyMergeState': ('anyHeavy', 'MergeState'), 'groupBitmapXorMergeState': ('groupBitmapXor', 'MergeState'), 'last_valueMergeState': ('last_value', 'MergeState'), 'sumMergeState': ('sum', 'MergeState'), 'groupArraySampleMergeState': ('groupArraySample', 'MergeState'), 'first_valueMergeState': ('first_value', 'MergeState'), 'uniqCombinedMergeState': ('uniqCombined', 'MergeState'), 'theilsUMergeState': ('theilsU', 'MergeState'), 'deltaSumMergeState': ('deltaSum', 'MergeState'), 'quantilesTDigestWeightedMergeState': ('quantilesTDigestWeighted', 'MergeState'), 'quantileExactHighMergeState': ('quantileExactHigh', 'MergeState'), 'contingencyMergeState': ('contingency', 'MergeState'), 'quantileBFloat16MergeState': ('quantileBFloat16', 'MergeState'), 'groupArrayInsertAtMergeState': ('groupArrayInsertAt', 'MergeState'), 'quantileBFloat16WeightedMergeState': ('quantileBFloat16Weighted', 'MergeState'), 'quantileExactWeightedMergeState': ('quantileExactWeighted', 'MergeState'), 'quantilesExactMergeState': ('quantilesExact', 'MergeState'), 'quantileMergeState': ('quantile', 'MergeState'), 'quantilesInterpolatedWeightedMergeState': ('quantilesInterpolatedWeighted', 'MergeState'), 'groupBitAndMergeState': ('groupBitAnd', 'MergeState'), 'topKWeightedMergeState': ('topKWeighted', 'MergeState'), 'groupArrayMovingAvgMergeState': ('groupArrayMovingAvg', 'MergeState'), 'groupBitOrMergeState': ('groupBitOr', 'MergeState'), 'quantileTDigestWeightedMergeState': ('quantileTDigestWeighted', 'MergeState'), 'minMergeState': ('min', 'MergeState'), 'maxIntersectionsMergeState': ('maxIntersections', 'MergeState'), 'stddevPopMergeState': ('stddevPop', 'MergeState'), 'quantilesTimingMergeState': ('quantilesTiming', 'MergeState'), 'sumCountMergeState': ('sumCount', 'MergeState'), 'uniqMergeState': ('uniq', 'MergeState'), 'quantileDeterministicMergeState': ('quantileDeterministic', 'MergeState'), 'entropyMergeState': ('entropy', 'MergeState'), 'groupBitmapAndMergeState': ('groupBitmapAnd', 'MergeState'), 'uniqHLL12MergeState': ('uniqHLL12', 'MergeState'), 'sequenceMatchMergeState': ('sequenceMatch', 'MergeState'), 'sequenceNextNodeMergeState': ('sequenceNextNode', 'MergeState'), 'quantileTimingWeightedMergeState': ('quantileTimingWeighted', 'MergeState'), 'kurtPopMergeState': ('kurtPop', 'MergeState'), 'quantilesGKMergeState': ('quantilesGK', 'MergeState'), 'meanZTestMergeState': ('meanZTest', 'MergeState'), 'argMinMergeState': ('argMin', 'MergeState'), 'stddevSampMergeState': ('stddevSamp', 'MergeState'), 'deltaSumTimestampMergeState': ('deltaSumTimestamp', 'MergeState'), 'stochasticLogisticRegressionMergeState': ('stochasticLogisticRegression', 'MergeState'), 'uniqCombined64MergeState': ('uniqCombined64', 'MergeState'), 'quantilesBFloat16WeightedMergeState': ('quantilesBFloat16Weighted', 'MergeState'), 'groupArrayMovingSumMergeState': ('groupArrayMovingSum', 'MergeState'), 'kolmogorovSmirnovTestMergeState': ('kolmogorovSmirnovTest', 'MergeState'), 'maxMergeState': ('max', 'MergeState'), 'quantileExactLowMergeState': ('quantileExactLow', 'MergeState'), 'quantileTDigestMergeState': ('quantileTDigest', 'MergeState'), 'exponentialMovingAverageForEach': ('exponentialMovingAverage', 'ForEach'), 'boundingRatioForEach': ('boundingRatio', 'ForEach'), 'cramersVBiasCorrectedForEach': ('cramersVBiasCorrected', 'ForEach'), 'quantilesDeterministicForEach': ('quantilesDeterministic', 'ForEach'), 'quantilesTimingWeightedForEach': ('quantilesTimingWeighted', 'ForEach'), 'quantileInterpolatedWeightedForEach': ('quantileInterpolatedWeighted', 'ForEach'), 'avgWeightedForEach': ('avgWeighted', 'ForEach'), 'medianForEach': ('median', 'ForEach'), 'quantilesExactLowForEach': ('quantilesExactLow', 'ForEach'), 'sumMapForEach': ('sumMap', 'ForEach'), 'simpleLinearRegressionForEach': ('simpleLinearRegression', 'ForEach'), 'uniqUpToForEach': ('uniqUpTo', 'ForEach'), 'maxMapForEach': ('maxMap', 'ForEach'), 'minMapForEach': ('minMap', 'ForEach'), 'argMaxForEach': ('argMax', 'ForEach'), 'categoricalInformationValueForEach': ('categoricalInformationValue', 'ForEach'), 'quantileExactForEach': ('quantileExact', 'ForEach'), 'quantilesExactWeightedForEach': ('quantilesExactWeighted', 'ForEach'), 'cramersVForEach': ('cramersV', 'ForEach'), 'quantileTimingForEach': ('quantileTiming', 'ForEach'), 'varSampForEach': ('varSamp', 'ForEach'), 'skewSampForEach': ('skewSamp', 'ForEach'), 'covarSampForEach': ('covarSamp', 'ForEach'), 'groupUniqArrayForEach': ('groupUniqArray', 'ForEach'), 'exponentialTimeDecayedAvgForEach': ('exponentialTimeDecayedAvg', 'ForEach'), 'anyLastForEach': ('anyLast', 'ForEach'), 'sequenceCountForEach': ('sequenceCount', 'ForEach'), 'kurtSampForEach': ('kurtSamp', 'ForEach'), 'quantilesForEach': ('quantiles', 'ForEach'), 'welchTTestForEach': ('welchTTest', 'ForEach'), 'groupArrayLastForEach': ('groupArrayLast', 'ForEach'), 'quantilesTDigestForEach': ('quantilesTDigest', 'ForEach'), 'quantileGKForEach': ('quantileGK', 'ForEach'), 'varPopForEach': ('varPop', 'ForEach'), 'rankCorrForEach': ('rankCorr', 'ForEach'), 'stochasticLinearRegressionForEach': ('stochasticLinearRegression', 'ForEach'), 'histogramForEach': ('histogram', 'ForEach'), 'quantilesBFloat16ForEach': ('quantilesBFloat16', 'ForEach'), 'avgForEach': ('avg', 'ForEach'), 'groupBitmapOrForEach': ('groupBitmapOr', 'ForEach'), 'windowFunnelForEach': ('windowFunnel', 'ForEach'), 'sumWithOverflowForEach': ('sumWithOverflow', 'ForEach'), 'uniqExactForEach': ('uniqExact', 'ForEach'), 'mannWhitneyUTestForEach': ('mannWhitneyUTest', 'ForEach'), 'uniqThetaForEach': ('uniqTheta', 'ForEach'), 'maxIntersectionsPositionForEach': ('maxIntersectionsPosition', 'ForEach'), 'topKForEach': ('topK', 'ForEach'), 'sumKahanForEach': ('sumKahan', 'ForEach'), 'sparkBarForEach': ('sparkBar', 'ForEach'), 'groupArrayForEach': ('groupArray', 'ForEach'), 'skewPopForEach': ('skewPop', 'ForEach'), 'groupBitmapForEach': ('groupBitmap', 'ForEach'), 'retentionForEach': ('retention', 'ForEach'), 'intervalLengthSumForEach': ('intervalLengthSum', 'ForEach'), 'quantilesExactHighForEach': ('quantilesExactHigh', 'ForEach'), 'corrForEach': ('corr', 'ForEach'), 'countForEach': ('count', 'ForEach'), 'largestTriangleThreeBucketsForEach': ('largestTriangleThreeBuckets', 'ForEach'), 'covarPopForEach': ('covarPop', 'ForEach'), 'groupBitXorForEach': ('groupBitXor', 'ForEach'), 'studentTTestForEach': ('studentTTest', 'ForEach'), 'anyForEach': ('any', 'ForEach'), 'anyHeavyForEach': ('anyHeavy', 'ForEach'), 'groupBitmapXorForEach': ('groupBitmapXor', 'ForEach'), 'last_valueForEach': ('last_value', 'ForEach'), 'sumForEach': ('sum', 'ForEach'), 'groupArraySampleForEach': ('groupArraySample', 'ForEach'), 'first_valueForEach': ('first_value', 'ForEach'), 'uniqCombinedForEach': ('uniqCombined', 'ForEach'), 'theilsUForEach': ('theilsU', 'ForEach'), 'deltaSumForEach': ('deltaSum', 'ForEach'), 'quantilesTDigestWeightedForEach': ('quantilesTDigestWeighted', 'ForEach'), 'quantileExactHighForEach': ('quantileExactHigh', 'ForEach'), 'contingencyForEach': ('contingency', 'ForEach'), 'quantileBFloat16ForEach': ('quantileBFloat16', 'ForEach'), 'groupArrayInsertAtForEach': ('groupArrayInsertAt', 'ForEach'), 'quantileBFloat16WeightedForEach': ('quantileBFloat16Weighted', 'ForEach'), 'quantileExactWeightedForEach': ('quantileExactWeighted', 'ForEach'), 'quantilesExactForEach': ('quantilesExact', 'ForEach'), 'quantileForEach': ('quantile', 'ForEach'), 'quantilesInterpolatedWeightedForEach': ('quantilesInterpolatedWeighted', 'ForEach'), 'groupBitAndForEach': ('groupBitAnd', 'ForEach'), 'topKWeightedForEach': ('topKWeighted', 'ForEach'), 'groupArrayMovingAvgForEach': ('groupArrayMovingAvg', 'ForEach'), 'groupBitOrForEach': ('groupBitOr', 'ForEach'), 'quantileTDigestWeightedForEach': ('quantileTDigestWeighted', 'ForEach'), 'minForEach': ('min', 'ForEach'), 'maxIntersectionsForEach': ('maxIntersections', 'ForEach'), 'stddevPopForEach': ('stddevPop', 'ForEach'), 'quantilesTimingForEach': ('quantilesTiming', 'ForEach'), 'sumCountForEach': ('sumCount', 'ForEach'), 'uniqForEach': ('uniq', 'ForEach'), 'quantileDeterministicForEach': ('quantileDeterministic', 'ForEach'), 'entropyForEach': ('entropy', 'ForEach'), 'groupBitmapAndForEach': ('groupBitmapAnd', 'ForEach'), 'uniqHLL12ForEach': ('uniqHLL12', 'ForEach'), 'sequenceMatchForEach': ('sequenceMatch', 'ForEach'), 'sequenceNextNodeForEach': ('sequenceNextNode', 'ForEach'), 'quantileTimingWeightedForEach': ('quantileTimingWeighted', 'ForEach'), 'kurtPopForEach': ('kurtPop', 'ForEach'), 'quantilesGKForEach': ('quantilesGK', 'ForEach'), 'meanZTestForEach': ('meanZTest', 'ForEach'), 'argMinForEach': ('argMin', 'ForEach'), 'stddevSampForEach': ('stddevSamp', 'ForEach'), 'deltaSumTimestampForEach': ('deltaSumTimestamp', 'ForEach'), 'stochasticLogisticRegressionForEach': ('stochasticLogisticRegression', 'ForEach'), 'uniqCombined64ForEach': ('uniqCombined64', 'ForEach'), 'quantilesBFloat16WeightedForEach': ('quantilesBFloat16Weighted', 'ForEach'), 'groupArrayMovingSumForEach': ('groupArrayMovingSum', 'ForEach'), 'kolmogorovSmirnovTestForEach': ('kolmogorovSmirnovTest', 'ForEach'), 'maxForEach': ('max', 'ForEach'), 'quantileExactLowForEach': ('quantileExactLow', 'ForEach'), 'quantileTDigestForEach': ('quantileTDigest', 'ForEach'), 'exponentialMovingAverageDistinct': ('exponentialMovingAverage', 'Distinct'), 'boundingRatioDistinct': ('boundingRatio', 'Distinct'), 'cramersVBiasCorrectedDistinct': ('cramersVBiasCorrected', 'Distinct'), 'quantilesDeterministicDistinct': ('quantilesDeterministic', 'Distinct'), 'quantilesTimingWeightedDistinct': ('quantilesTimingWeighted', 'Distinct'), 'quantileInterpolatedWeightedDistinct': ('quantileInterpolatedWeighted', 'Distinct'), 'avgWeightedDistinct': ('avgWeighted', 'Distinct'), 'medianDistinct': ('median', 'Distinct'), 'quantilesExactLowDistinct': ('quantilesExactLow', 'Distinct'), 'sumMapDistinct': ('sumMap', 'Distinct'), 'simpleLinearRegressionDistinct': ('simpleLinearRegression', 'Distinct'), 'uniqUpToDistinct': ('uniqUpTo', 'Distinct'), 'maxMapDistinct': ('maxMap', 'Distinct'), 'minMapDistinct': ('minMap', 'Distinct'), 'argMaxDistinct': ('argMax', 'Distinct'), 'categoricalInformationValueDistinct': ('categoricalInformationValue', 'Distinct'), 'quantileExactDistinct': ('quantileExact', 'Distinct'), 'quantilesExactWeightedDistinct': ('quantilesExactWeighted', 'Distinct'), 'cramersVDistinct': ('cramersV', 'Distinct'), 'quantileTimingDistinct': ('quantileTiming', 'Distinct'), 'varSampDistinct': ('varSamp', 'Distinct'), 'skewSampDistinct': ('skewSamp', 'Distinct'), 'covarSampDistinct': ('covarSamp', 'Distinct'), 'groupUniqArrayDistinct': ('groupUniqArray', 'Distinct'), 'exponentialTimeDecayedAvgDistinct': ('exponentialTimeDecayedAvg', 'Distinct'), 'anyLastDistinct': ('anyLast', 'Distinct'), 'sequenceCountDistinct': ('sequenceCount', 'Distinct'), 'kurtSampDistinct': ('kurtSamp', 'Distinct'), 'quantilesDistinct': ('quantiles', 'Distinct'), 'welchTTestDistinct': ('welchTTest', 'Distinct'), 'groupArrayLastDistinct': ('groupArrayLast', 'Distinct'), 'quantilesTDigestDistinct': ('quantilesTDigest', 'Distinct'), 'quantileGKDistinct': ('quantileGK', 'Distinct'), 'varPopDistinct': ('varPop', 'Distinct'), 'rankCorrDistinct': ('rankCorr', 'Distinct'), 'stochasticLinearRegressionDistinct': ('stochasticLinearRegression', 'Distinct'), 'histogramDistinct': ('histogram', 'Distinct'), 'quantilesBFloat16Distinct': ('quantilesBFloat16', 'Distinct'), 'avgDistinct': ('avg', 'Distinct'), 'groupBitmapOrDistinct': ('groupBitmapOr', 'Distinct'), 'windowFunnelDistinct': ('windowFunnel', 'Distinct'), 'sumWithOverflowDistinct': ('sumWithOverflow', 'Distinct'), 'uniqExactDistinct': ('uniqExact', 'Distinct'), 'mannWhitneyUTestDistinct': ('mannWhitneyUTest', 'Distinct'), 'uniqThetaDistinct': ('uniqTheta', 'Distinct'), 'maxIntersectionsPositionDistinct': ('maxIntersectionsPosition', 'Distinct'), 'topKDistinct': ('topK', 'Distinct'), 'sumKahanDistinct': ('sumKahan', 'Distinct'), 'sparkBarDistinct': ('sparkBar', 'Distinct'), 'groupArrayDistinct': ('groupArray', 'Distinct'), 'skewPopDistinct': ('skewPop', 'Distinct'), 'groupBitmapDistinct': ('groupBitmap', 'Distinct'), 'retentionDistinct': ('retention', 'Distinct'), 'intervalLengthSumDistinct': ('intervalLengthSum', 'Distinct'), 'quantilesExactHighDistinct': ('quantilesExactHigh', 'Distinct'), 'corrDistinct': ('corr', 'Distinct'), 'countDistinct': ('count', 'Distinct'), 'largestTriangleThreeBucketsDistinct': ('largestTriangleThreeBuckets', 'Distinct'), 'covarPopDistinct': ('covarPop', 'Distinct'), 'groupBitXorDistinct': ('groupBitXor', 'Distinct'), 'studentTTestDistinct': ('studentTTest', 'Distinct'), 'anyDistinct': ('any', 'Distinct'), 'anyHeavyDistinct': ('anyHeavy', 'Distinct'), 'groupBitmapXorDistinct': ('groupBitmapXor', 'Distinct'), 'last_valueDistinct': ('last_value', 'Distinct'), 'sumDistinct': ('sum', 'Distinct'), 'groupArraySampleDistinct': ('groupArraySample', 'Distinct'), 'first_valueDistinct': ('first_value', 'Distinct'), 'uniqCombinedDistinct': ('uniqCombined', 'Distinct'), 'theilsUDistinct': ('theilsU', 'Distinct'), 'deltaSumDistinct': ('deltaSum', 'Distinct'), 'quantilesTDigestWeightedDistinct': ('quantilesTDigestWeighted', 'Distinct'), 'quantileExactHighDistinct': ('quantileExactHigh', 'Distinct'), 'contingencyDistinct': ('contingency', 'Distinct'), 'quantileBFloat16Distinct': ('quantileBFloat16', 'Distinct'), 'groupArrayInsertAtDistinct': ('groupArrayInsertAt', 'Distinct'), 'quantileBFloat16WeightedDistinct': ('quantileBFloat16Weighted', 'Distinct'), 'quantileExactWeightedDistinct': ('quantileExactWeighted', 'Distinct'), 'quantilesExactDistinct': ('quantilesExact', 'Distinct'), 'quantileDistinct': ('quantile', 'Distinct'), 'quantilesInterpolatedWeightedDistinct': ('quantilesInterpolatedWeighted', 'Distinct'), 'groupBitAndDistinct': ('groupBitAnd', 'Distinct'), 'topKWeightedDistinct': ('topKWeighted', 'Distinct'), 'groupArrayMovingAvgDistinct': ('groupArrayMovingAvg', 'Distinct'), 'groupBitOrDistinct': ('groupBitOr', 'Distinct'), 'quantileTDigestWeightedDistinct': ('quantileTDigestWeighted', 'Distinct'), 'minDistinct': ('min', 'Distinct'), 'maxIntersectionsDistinct': ('maxIntersections', 'Distinct'), 'stddevPopDistinct': ('stddevPop', 'Distinct'), 'quantilesTimingDistinct': ('quantilesTiming', 'Distinct'), 'sumCountDistinct': ('sumCount', 'Distinct'), 'uniqDistinct': ('uniq', 'Distinct'), 'quantileDeterministicDistinct': ('quantileDeterministic', 'Distinct'), 'entropyDistinct': ('entropy', 'Distinct'), 'groupBitmapAndDistinct': ('groupBitmapAnd', 'Distinct'), 'uniqHLL12Distinct': ('uniqHLL12', 'Distinct'), 'sequenceMatchDistinct': ('sequenceMatch', 'Distinct'), 'sequenceNextNodeDistinct': ('sequenceNextNode', 'Distinct'), 'quantileTimingWeightedDistinct': ('quantileTimingWeighted', 'Distinct'), 'kurtPopDistinct': ('kurtPop', 'Distinct'), 'quantilesGKDistinct': ('quantilesGK', 'Distinct'), 'meanZTestDistinct': ('meanZTest', 'Distinct'), 'argMinDistinct': ('argMin', 'Distinct'), 'stddevSampDistinct': ('stddevSamp', 'Distinct'), 'deltaSumTimestampDistinct': ('deltaSumTimestamp', 'Distinct'), 'stochasticLogisticRegressionDistinct': ('stochasticLogisticRegression', 'Distinct'), 'uniqCombined64Distinct': ('uniqCombined64', 'Distinct'), 'quantilesBFloat16WeightedDistinct': ('quantilesBFloat16Weighted', 'Distinct'), 'groupArrayMovingSumDistinct': ('groupArrayMovingSum', 'Distinct'), 'kolmogorovSmirnovTestDistinct': ('kolmogorovSmirnovTest', 'Distinct'), 'maxDistinct': ('max', 'Distinct'), 'quantileExactLowDistinct': ('quantileExactLow', 'Distinct'), 'quantileTDigestDistinct': ('quantileTDigest', 'Distinct'), 'exponentialMovingAverageOrDefault': ('exponentialMovingAverage', 'OrDefault'), 'boundingRatioOrDefault': ('boundingRatio', 'OrDefault'), 'cramersVBiasCorrectedOrDefault': ('cramersVBiasCorrected', 'OrDefault'), 'quantilesDeterministicOrDefault': ('quantilesDeterministic', 'OrDefault'), 'quantilesTimingWeightedOrDefault': ('quantilesTimingWeighted', 'OrDefault'), 'quantileInterpolatedWeightedOrDefault': ('quantileInterpolatedWeighted', 'OrDefault'), 'avgWeightedOrDefault': ('avgWeighted', 'OrDefault'), 'medianOrDefault': ('median', 'OrDefault'), 'quantilesExactLowOrDefault': ('quantilesExactLow', 'OrDefault'), 'sumMapOrDefault': ('sumMap', 'OrDefault'), 'simpleLinearRegressionOrDefault': ('simpleLinearRegression', 'OrDefault'), 'uniqUpToOrDefault': ('uniqUpTo', 'OrDefault'), 'maxMapOrDefault': ('maxMap', 'OrDefault'), 'minMapOrDefault': ('minMap', 'OrDefault'), 'argMaxOrDefault': ('argMax', 'OrDefault'), 'categoricalInformationValueOrDefault': ('categoricalInformationValue', 'OrDefault'), 'quantileExactOrDefault': ('quantileExact', 'OrDefault'), 'quantilesExactWeightedOrDefault': ('quantilesExactWeighted', 'OrDefault'), 'cramersVOrDefault': ('cramersV', 'OrDefault'), 'quantileTimingOrDefault': ('quantileTiming', 'OrDefault'), 'varSampOrDefault': ('varSamp', 'OrDefault'), 'skewSampOrDefault': ('skewSamp', 'OrDefault'), 'covarSampOrDefault': ('covarSamp', 'OrDefault'), 'groupUniqArrayOrDefault': ('groupUniqArray', 'OrDefault'), 'exponentialTimeDecayedAvgOrDefault': ('exponentialTimeDecayedAvg', 'OrDefault'), 'anyLastOrDefault': ('anyLast', 'OrDefault'), 'sequenceCountOrDefault': ('sequenceCount', 'OrDefault'), 'kurtSampOrDefault': ('kurtSamp', 'OrDefault'), 'quantilesOrDefault': ('quantiles', 'OrDefault'), 'welchTTestOrDefault': ('welchTTest', 'OrDefault'), 'groupArrayLastOrDefault': ('groupArrayLast', 'OrDefault'), 'quantilesTDigestOrDefault': ('quantilesTDigest', 'OrDefault'), 'quantileGKOrDefault': ('quantileGK', 'OrDefault'), 'varPopOrDefault': ('varPop', 'OrDefault'), 'rankCorrOrDefault': ('rankCorr', 'OrDefault'), 'stochasticLinearRegressionOrDefault': ('stochasticLinearRegression', 'OrDefault'), 'histogramOrDefault': ('histogram', 'OrDefault'), 'quantilesBFloat16OrDefault': ('quantilesBFloat16', 'OrDefault'), 'avgOrDefault': ('avg', 'OrDefault'), 'groupBitmapOrOrDefault': ('groupBitmapOr', 'OrDefault'), 'windowFunnelOrDefault': ('windowFunnel', 'OrDefault'), 'sumWithOverflowOrDefault': ('sumWithOverflow', 'OrDefault'), 'uniqExactOrDefault': ('uniqExact', 'OrDefault'), 'mannWhitneyUTestOrDefault': ('mannWhitneyUTest', 'OrDefault'), 'uniqThetaOrDefault': ('uniqTheta', 'OrDefault'), 'maxIntersectionsPositionOrDefault': ('maxIntersectionsPosition', 'OrDefault'), 'topKOrDefault': ('topK', 'OrDefault'), 'sumKahanOrDefault': ('sumKahan', 'OrDefault'), 'sparkBarOrDefault': ('sparkBar', 'OrDefault'), 'groupArrayOrDefault': ('groupArray', 'OrDefault'), 'skewPopOrDefault': ('skewPop', 'OrDefault'), 'groupBitmapOrDefault': ('groupBitmap', 'OrDefault'), 'retentionOrDefault': ('retention', 'OrDefault'), 'intervalLengthSumOrDefault': ('intervalLengthSum', 'OrDefault'), 'quantilesExactHighOrDefault': ('quantilesExactHigh', 'OrDefault'), 'corrOrDefault': ('corr', 'OrDefault'), 'countOrDefault': ('count', 'OrDefault'), 'largestTriangleThreeBucketsOrDefault': ('largestTriangleThreeBuckets', 'OrDefault'), 'covarPopOrDefault': ('covarPop', 'OrDefault'), 'groupBitXorOrDefault': ('groupBitXor', 'OrDefault'), 'studentTTestOrDefault': ('studentTTest', 'OrDefault'), 'anyOrDefault': ('any', 'OrDefault'), 'anyHeavyOrDefault': ('anyHeavy', 'OrDefault'), 'groupBitmapXorOrDefault': ('groupBitmapXor', 'OrDefault'), 'last_valueOrDefault': ('last_value', 'OrDefault'), 'sumOrDefault': ('sum', 'OrDefault'), 'groupArraySampleOrDefault': ('groupArraySample', 'OrDefault'), 'first_valueOrDefault': ('first_value', 'OrDefault'), 'uniqCombinedOrDefault': ('uniqCombined', 'OrDefault'), 'theilsUOrDefault': ('theilsU', 'OrDefault'), 'deltaSumOrDefault': ('deltaSum', 'OrDefault'), 'quantilesTDigestWeightedOrDefault': ('quantilesTDigestWeighted', 'OrDefault'), 'quantileExactHighOrDefault': ('quantileExactHigh', 'OrDefault'), 'contingencyOrDefault': ('contingency', 'OrDefault'), 'quantileBFloat16OrDefault': ('quantileBFloat16', 'OrDefault'), 'groupArrayInsertAtOrDefault': ('groupArrayInsertAt', 'OrDefault'), 'quantileBFloat16WeightedOrDefault': ('quantileBFloat16Weighted', 'OrDefault'), 'quantileExactWeightedOrDefault': ('quantileExactWeighted', 'OrDefault'), 'quantilesExactOrDefault': ('quantilesExact', 'OrDefault'), 'quantileOrDefault': ('quantile', 'OrDefault'), 'quantilesInterpolatedWeightedOrDefault': ('quantilesInterpolatedWeighted', 'OrDefault'), 'groupBitAndOrDefault': ('groupBitAnd', 'OrDefault'), 'topKWeightedOrDefault': ('topKWeighted', 'OrDefault'), 'groupArrayMovingAvgOrDefault': ('groupArrayMovingAvg', 'OrDefault'), 'groupBitOrOrDefault': ('groupBitOr', 'OrDefault'), 'quantileTDigestWeightedOrDefault': ('quantileTDigestWeighted', 'OrDefault'), 'minOrDefault': ('min', 'OrDefault'), 'maxIntersectionsOrDefault': ('maxIntersections', 'OrDefault'), 'stddevPopOrDefault': ('stddevPop', 'OrDefault'), 'quantilesTimingOrDefault': ('quantilesTiming', 'OrDefault'), 'sumCountOrDefault': ('sumCount', 'OrDefault'), 'uniqOrDefault': ('uniq', 'OrDefault'), 'quantileDeterministicOrDefault': ('quantileDeterministic', 'OrDefault'), 'entropyOrDefault': ('entropy', 'OrDefault'), 'groupBitmapAndOrDefault': ('groupBitmapAnd', 'OrDefault'), 'uniqHLL12OrDefault': ('uniqHLL12', 'OrDefault'), 'sequenceMatchOrDefault': ('sequenceMatch', 'OrDefault'), 'sequenceNextNodeOrDefault': ('sequenceNextNode', 'OrDefault'), 'quantileTimingWeightedOrDefault': ('quantileTimingWeighted', 'OrDefault'), 'kurtPopOrDefault': ('kurtPop', 'OrDefault'), 'quantilesGKOrDefault': ('quantilesGK', 'OrDefault'), 'meanZTestOrDefault': ('meanZTest', 'OrDefault'), 'argMinOrDefault': ('argMin', 'OrDefault'), 'stddevSampOrDefault': ('stddevSamp', 'OrDefault'), 'deltaSumTimestampOrDefault': ('deltaSumTimestamp', 'OrDefault'), 'stochasticLogisticRegressionOrDefault': ('stochasticLogisticRegression', 'OrDefault'), 'uniqCombined64OrDefault': ('uniqCombined64', 'OrDefault'), 'quantilesBFloat16WeightedOrDefault': ('quantilesBFloat16Weighted', 'OrDefault'), 'groupArrayMovingSumOrDefault': ('groupArrayMovingSum', 'OrDefault'), 'kolmogorovSmirnovTestOrDefault': ('kolmogorovSmirnovTest', 'OrDefault'), 'maxOrDefault': ('max', 'OrDefault'), 'quantileExactLowOrDefault': ('quantileExactLow', 'OrDefault'), 'quantileTDigestOrDefault': ('quantileTDigest', 'OrDefault'), 'exponentialMovingAverageOrNull': ('exponentialMovingAverage', 'OrNull'), 'boundingRatioOrNull': ('boundingRatio', 'OrNull'), 'cramersVBiasCorrectedOrNull': ('cramersVBiasCorrected', 'OrNull'), 'quantilesDeterministicOrNull': ('quantilesDeterministic', 'OrNull'), 'quantilesTimingWeightedOrNull': ('quantilesTimingWeighted', 'OrNull'), 'quantileInterpolatedWeightedOrNull': ('quantileInterpolatedWeighted', 'OrNull'), 'avgWeightedOrNull': ('avgWeighted', 'OrNull'), 'medianOrNull': ('median', 'OrNull'), 'quantilesExactLowOrNull': ('quantilesExactLow', 'OrNull'), 'sumMapOrNull': ('sumMap', 'OrNull'), 'simpleLinearRegressionOrNull': ('simpleLinearRegression', 'OrNull'), 'uniqUpToOrNull': ('uniqUpTo', 'OrNull'), 'maxMapOrNull': ('maxMap', 'OrNull'), 'minMapOrNull': ('minMap', 'OrNull'), 'argMaxOrNull': ('argMax', 'OrNull'), 'categoricalInformationValueOrNull': ('categoricalInformationValue', 'OrNull'), 'quantileExactOrNull': ('quantileExact', 'OrNull'), 'quantilesExactWeightedOrNull': ('quantilesExactWeighted', 'OrNull'), 'cramersVOrNull': ('cramersV', 'OrNull'), 'quantileTimingOrNull': ('quantileTiming', 'OrNull'), 'varSampOrNull': ('varSamp', 'OrNull'), 'skewSampOrNull': ('skewSamp', 'OrNull'), 'covarSampOrNull': ('covarSamp', 'OrNull'), 'groupUniqArrayOrNull': ('groupUniqArray', 'OrNull'), 'exponentialTimeDecayedAvgOrNull': ('exponentialTimeDecayedAvg', 'OrNull'), 'anyLastOrNull': ('anyLast', 'OrNull'), 'sequenceCountOrNull': ('sequenceCount', 'OrNull'), 'kurtSampOrNull': ('kurtSamp', 'OrNull'), 'quantilesOrNull': ('quantiles', 'OrNull'), 'welchTTestOrNull': ('welchTTest', 'OrNull'), 'groupArrayLastOrNull': ('groupArrayLast', 'OrNull'), 'quantilesTDigestOrNull': ('quantilesTDigest', 'OrNull'), 'quantileGKOrNull': ('quantileGK', 'OrNull'), 'varPopOrNull': ('varPop', 'OrNull'), 'rankCorrOrNull': ('rankCorr', 'OrNull'), 'stochasticLinearRegressionOrNull': ('stochasticLinearRegression', 'OrNull'), 'histogramOrNull': ('histogram', 'OrNull'), 'quantilesBFloat16OrNull': ('quantilesBFloat16', 'OrNull'), 'avgOrNull': ('avg', 'OrNull'), 'groupBitmapOrOrNull': ('groupBitmapOr', 'OrNull'), 'windowFunnelOrNull': ('windowFunnel', 'OrNull'), 'sumWithOverflowOrNull': ('sumWithOverflow', 'OrNull'), 'uniqExactOrNull': ('uniqExact', 'OrNull'), 'mannWhitneyUTestOrNull': ('mannWhitneyUTest', 'OrNull'), 'uniqThetaOrNull': ('uniqTheta', 'OrNull'), 'maxIntersectionsPositionOrNull': ('maxIntersectionsPosition', 'OrNull'), 'topKOrNull': ('topK', 'OrNull'), 'sumKahanOrNull': ('sumKahan', 'OrNull'), 'sparkBarOrNull': ('sparkBar', 'OrNull'), 'groupArrayOrNull': ('groupArray', 'OrNull'), 'skewPopOrNull': ('skewPop', 'OrNull'), 'groupBitmapOrNull': ('groupBitmap', 'OrNull'), 'retentionOrNull': ('retention', 'OrNull'), 'intervalLengthSumOrNull': ('intervalLengthSum', 'OrNull'), 'quantilesExactHighOrNull': ('quantilesExactHigh', 'OrNull'), 'corrOrNull': ('corr', 'OrNull'), 'countOrNull': ('count', 'OrNull'), 'largestTriangleThreeBucketsOrNull': ('largestTriangleThreeBuckets', 'OrNull'), 'covarPopOrNull': ('covarPop', 'OrNull'), 'groupBitXorOrNull': ('groupBitXor', 'OrNull'), 'studentTTestOrNull': ('studentTTest', 'OrNull'), 'anyOrNull': ('any', 'OrNull'), 'anyHeavyOrNull': ('anyHeavy', 'OrNull'), 'groupBitmapXorOrNull': ('groupBitmapXor', 'OrNull'), 'last_valueOrNull': ('last_value', 'OrNull'), 'sumOrNull': ('sum', 'OrNull'), 'groupArraySampleOrNull': ('groupArraySample', 'OrNull'), 'first_valueOrNull': ('first_value', 'OrNull'), 'uniqCombinedOrNull': ('uniqCombined', 'OrNull'), 'theilsUOrNull': ('theilsU', 'OrNull'), 'deltaSumOrNull': ('deltaSum', 'OrNull'), 'quantilesTDigestWeightedOrNull': ('quantilesTDigestWeighted', 'OrNull'), 'quantileExactHighOrNull': ('quantileExactHigh', 'OrNull'), 'contingencyOrNull': ('contingency', 'OrNull'), 'quantileBFloat16OrNull': ('quantileBFloat16', 'OrNull'), 'groupArrayInsertAtOrNull': ('groupArrayInsertAt', 'OrNull'), 'quantileBFloat16WeightedOrNull': ('quantileBFloat16Weighted', 'OrNull'), 'quantileExactWeightedOrNull': ('quantileExactWeighted', 'OrNull'), 'quantilesExactOrNull': ('quantilesExact', 'OrNull'), 'quantileOrNull': ('quantile', 'OrNull'), 'quantilesInterpolatedWeightedOrNull': ('quantilesInterpolatedWeighted', 'OrNull'), 'groupBitAndOrNull': ('groupBitAnd', 'OrNull'), 'topKWeightedOrNull': ('topKWeighted', 'OrNull'), 'groupArrayMovingAvgOrNull': ('groupArrayMovingAvg', 'OrNull'), 'groupBitOrOrNull': ('groupBitOr', 'OrNull'), 'quantileTDigestWeightedOrNull': ('quantileTDigestWeighted', 'OrNull'), 'minOrNull': ('min', 'OrNull'), 'maxIntersectionsOrNull': ('maxIntersections', 'OrNull'), 'stddevPopOrNull': ('stddevPop', 'OrNull'), 'quantilesTimingOrNull': ('quantilesTiming', 'OrNull'), 'sumCountOrNull': ('sumCount', 'OrNull'), 'uniqOrNull': ('uniq', 'OrNull'), 'quantileDeterministicOrNull': ('quantileDeterministic', 'OrNull'), 'entropyOrNull': ('entropy', 'OrNull'), 'groupBitmapAndOrNull': ('groupBitmapAnd', 'OrNull'), 'uniqHLL12OrNull': ('uniqHLL12', 'OrNull'), 'sequenceMatchOrNull': ('sequenceMatch', 'OrNull'), 'sequenceNextNodeOrNull': ('sequenceNextNode', 'OrNull'), 'quantileTimingWeightedOrNull': ('quantileTimingWeighted', 'OrNull'), 'kurtPopOrNull': ('kurtPop', 'OrNull'), 'quantilesGKOrNull': ('quantilesGK', 'OrNull'), 'meanZTestOrNull': ('meanZTest', 'OrNull'), 'argMinOrNull': ('argMin', 'OrNull'), 'stddevSampOrNull': ('stddevSamp', 'OrNull'), 'deltaSumTimestampOrNull': ('deltaSumTimestamp', 'OrNull'), 'stochasticLogisticRegressionOrNull': ('stochasticLogisticRegression', 'OrNull'), 'uniqCombined64OrNull': ('uniqCombined64', 'OrNull'), 'quantilesBFloat16WeightedOrNull': ('quantilesBFloat16Weighted', 'OrNull'), 'groupArrayMovingSumOrNull': ('groupArrayMovingSum', 'OrNull'), 'kolmogorovSmirnovTestOrNull': ('kolmogorovSmirnovTest', 'OrNull'), 'maxOrNull': ('max', 'OrNull'), 'quantileExactLowOrNull': ('quantileExactLow', 'OrNull'), 'quantileTDigestOrNull': ('quantileTDigest', 'OrNull'), 'exponentialMovingAverageResample': ('exponentialMovingAverage', 'Resample'), 'boundingRatioResample': ('boundingRatio', 'Resample'), 'cramersVBiasCorrectedResample': ('cramersVBiasCorrected', 'Resample'), 'quantilesDeterministicResample': ('quantilesDeterministic', 'Resample'), 'quantilesTimingWeightedResample': ('quantilesTimingWeighted', 'Resample'), 'quantileInterpolatedWeightedResample': ('quantileInterpolatedWeighted', 'Resample'), 'avgWeightedResample': ('avgWeighted', 'Resample'), 'medianResample': ('median', 'Resample'), 'quantilesExactLowResample': ('quantilesExactLow', 'Resample'), 'sumMapResample': ('sumMap', 'Resample'), 'simpleLinearRegressionResample': ('simpleLinearRegression', 'Resample'), 'uniqUpToResample': ('uniqUpTo', 'Resample'), 'maxMapResample': ('maxMap', 'Resample'), 'minMapResample': ('minMap', 'Resample'), 'argMaxResample': ('argMax', 'Resample'), 'categoricalInformationValueResample': ('categoricalInformationValue', 'Resample'), 'quantileExactResample': ('quantileExact', 'Resample'), 'quantilesExactWeightedResample': ('quantilesExactWeighted', 'Resample'), 'cramersVResample': ('cramersV', 'Resample'), 'quantileTimingResample': ('quantileTiming', 'Resample'), 'varSampResample': ('varSamp', 'Resample'), 'skewSampResample': ('skewSamp', 'Resample'), 'covarSampResample': ('covarSamp', 'Resample'), 'groupUniqArrayResample': ('groupUniqArray', 'Resample'), 'exponentialTimeDecayedAvgResample': ('exponentialTimeDecayedAvg', 'Resample'), 'anyLastResample': ('anyLast', 'Resample'), 'sequenceCountResample': ('sequenceCount', 'Resample'), 'kurtSampResample': ('kurtSamp', 'Resample'), 'quantilesResample': ('quantiles', 'Resample'), 'welchTTestResample': ('welchTTest', 'Resample'), 'groupArrayLastResample': ('groupArrayLast', 'Resample'), 'quantilesTDigestResample': ('quantilesTDigest', 'Resample'), 'quantileGKResample': ('quantileGK', 'Resample'), 'varPopResample': ('varPop', 'Resample'), 'rankCorrResample': ('rankCorr', 'Resample'), 'stochasticLinearRegressionResample': ('stochasticLinearRegression', 'Resample'), 'histogramResample': ('histogram', 'Resample'), 'quantilesBFloat16Resample': ('quantilesBFloat16', 'Resample'), 'avgResample': ('avg', 'Resample'), 'groupBitmapOrResample': ('groupBitmapOr', 'Resample'), 'windowFunnelResample': ('windowFunnel', 'Resample'), 'sumWithOverflowResample': ('sumWithOverflow', 'Resample'), 'uniqExactResample': ('uniqExact', 'Resample'), 'mannWhitneyUTestResample': ('mannWhitneyUTest', 'Resample'), 'uniqThetaResample': ('uniqTheta', 'Resample'), 'maxIntersectionsPositionResample': ('maxIntersectionsPosition', 'Resample'), 'topKResample': ('topK', 'Resample'), 'sumKahanResample': ('sumKahan', 'Resample'), 'sparkBarResample': ('sparkBar', 'Resample'), 'groupArrayResample': ('groupArray', 'Resample'), 'skewPopResample': ('skewPop', 'Resample'), 'groupBitmapResample': ('groupBitmap', 'Resample'), 'retentionResample': ('retention', 'Resample'), 'intervalLengthSumResample': ('intervalLengthSum', 'Resample'), 'quantilesExactHighResample': ('quantilesExactHigh', 'Resample'), 'corrResample': ('corr', 'Resample'), 'countResample': ('count', 'Resample'), 'largestTriangleThreeBucketsResample': ('largestTriangleThreeBuckets', 'Resample'), 'covarPopResample': ('covarPop', 'Resample'), 'groupBitXorResample': ('groupBitXor', 'Resample'), 'studentTTestResample': ('studentTTest', 'Resample'), 'anyResample': ('any', 'Resample'), 'anyHeavyResample': ('anyHeavy', 'Resample'), 'groupBitmapXorResample': ('groupBitmapXor', 'Resample'), 'last_valueResample': ('last_value', 'Resample'), 'sumResample': ('sum', 'Resample'), 'groupArraySampleResample': ('groupArraySample', 'Resample'), 'first_valueResample': ('first_value', 'Resample'), 'uniqCombinedResample': ('uniqCombined', 'Resample'), 'theilsUResample': ('theilsU', 'Resample'), 'deltaSumResample': ('deltaSum', 'Resample'), 'quantilesTDigestWeightedResample': ('quantilesTDigestWeighted', 'Resample'), 'quantileExactHighResample': ('quantileExactHigh', 'Resample'), 'contingencyResample': ('contingency', 'Resample'), 'quantileBFloat16Resample': ('quantileBFloat16', 'Resample'), 'groupArrayInsertAtResample': ('groupArrayInsertAt', 'Resample'), 'quantileBFloat16WeightedResample': ('quantileBFloat16Weighted', 'Resample'), 'quantileExactWeightedResample': ('quantileExactWeighted', 'Resample'), 'quantilesExactResample': ('quantilesExact', 'Resample'), 'quantileResample': ('quantile', 'Resample'), 'quantilesInterpolatedWeightedResample': ('quantilesInterpolatedWeighted', 'Resample'), 'groupBitAndResample': ('groupBitAnd', 'Resample'), 'topKWeightedResample': ('topKWeighted', 'Resample'), 'groupArrayMovingAvgResample': ('groupArrayMovingAvg', 'Resample'), 'groupBitOrResample': ('groupBitOr', 'Resample'), 'quantileTDigestWeightedResample': ('quantileTDigestWeighted', 'Resample'), 'minResample': ('min', 'Resample'), 'maxIntersectionsResample': ('maxIntersections', 'Resample'), 'stddevPopResample': ('stddevPop', 'Resample'), 'quantilesTimingResample': ('quantilesTiming', 'Resample'), 'sumCountResample': ('sumCount', 'Resample'), 'uniqResample': ('uniq', 'Resample'), 'quantileDeterministicResample': ('quantileDeterministic', 'Resample'), 'entropyResample': ('entropy', 'Resample'), 'groupBitmapAndResample': ('groupBitmapAnd', 'Resample'), 'uniqHLL12Resample': ('uniqHLL12', 'Resample'), 'sequenceMatchResample': ('sequenceMatch', 'Resample'), 'sequenceNextNodeResample': ('sequenceNextNode', 'Resample'), 'quantileTimingWeightedResample': ('quantileTimingWeighted', 'Resample'), 'kurtPopResample': ('kurtPop', 'Resample'), 'quantilesGKResample': ('quantilesGK', 'Resample'), 'meanZTestResample': ('meanZTest', 'Resample'), 'argMinResample': ('argMin', 'Resample'), 'stddevSampResample': ('stddevSamp', 'Resample'), 'deltaSumTimestampResample': ('deltaSumTimestamp', 'Resample'), 'stochasticLogisticRegressionResample': ('stochasticLogisticRegression', 'Resample'), 'uniqCombined64Resample': ('uniqCombined64', 'Resample'), 'quantilesBFloat16WeightedResample': ('quantilesBFloat16Weighted', 'Resample'), 'groupArrayMovingSumResample': ('groupArrayMovingSum', 'Resample'), 'kolmogorovSmirnovTestResample': ('kolmogorovSmirnovTest', 'Resample'), 'maxResample': ('max', 'Resample'), 'quantileExactLowResample': ('quantileExactLow', 'Resample'), 'quantileTDigestResample': ('quantileTDigest', 'Resample'), 'exponentialMovingAverageArgMin': ('exponentialMovingAverage', 'ArgMin'), 'boundingRatioArgMin': ('boundingRatio', 'ArgMin'), 'cramersVBiasCorrectedArgMin': ('cramersVBiasCorrected', 'ArgMin'), 'quantilesDeterministicArgMin': ('quantilesDeterministic', 'ArgMin'), 'quantilesTimingWeightedArgMin': ('quantilesTimingWeighted', 'ArgMin'), 'quantileInterpolatedWeightedArgMin': ('quantileInterpolatedWeighted', 'ArgMin'), 'avgWeightedArgMin': ('avgWeighted', 'ArgMin'), 'medianArgMin': ('median', 'ArgMin'), 'quantilesExactLowArgMin': ('quantilesExactLow', 'ArgMin'), 'sumMapArgMin': ('sumMap', 'ArgMin'), 'simpleLinearRegressionArgMin': ('simpleLinearRegression', 'ArgMin'), 'uniqUpToArgMin': ('uniqUpTo', 'ArgMin'), 'maxMapArgMin': ('maxMap', 'ArgMin'), 'minMapArgMin': ('minMap', 'ArgMin'), 'argMaxArgMin': ('argMax', 'ArgMin'), 'categoricalInformationValueArgMin': ('categoricalInformationValue', 'ArgMin'), 'quantileExactArgMin': ('quantileExact', 'ArgMin'), 'quantilesExactWeightedArgMin': ('quantilesExactWeighted', 'ArgMin'), 'cramersVArgMin': ('cramersV', 'ArgMin'), 'quantileTimingArgMin': ('quantileTiming', 'ArgMin'), 'varSampArgMin': ('varSamp', 'ArgMin'), 'skewSampArgMin': ('skewSamp', 'ArgMin'), 'covarSampArgMin': ('covarSamp', 'ArgMin'), 'groupUniqArrayArgMin': ('groupUniqArray', 'ArgMin'), 'exponentialTimeDecayedAvgArgMin': ('exponentialTimeDecayedAvg', 'ArgMin'), 'anyLastArgMin': ('anyLast', 'ArgMin'), 'sequenceCountArgMin': ('sequenceCount', 'ArgMin'), 'kurtSampArgMin': ('kurtSamp', 'ArgMin'), 'quantilesArgMin': ('quantiles', 'ArgMin'), 'welchTTestArgMin': ('welchTTest', 'ArgMin'), 'groupArrayLastArgMin': ('groupArrayLast', 'ArgMin'), 'quantilesTDigestArgMin': ('quantilesTDigest', 'ArgMin'), 'quantileGKArgMin': ('quantileGK', 'ArgMin'), 'varPopArgMin': ('varPop', 'ArgMin'), 'rankCorrArgMin': ('rankCorr', 'ArgMin'), 'stochasticLinearRegressionArgMin': ('stochasticLinearRegression', 'ArgMin'), 'histogramArgMin': ('histogram', 'ArgMin'), 'quantilesBFloat16ArgMin': ('quantilesBFloat16', 'ArgMin'), 'avgArgMin': ('avg', 'ArgMin'), 'groupBitmapOrArgMin': ('groupBitmapOr', 'ArgMin'), 'windowFunnelArgMin': ('windowFunnel', 'ArgMin'), 'sumWithOverflowArgMin': ('sumWithOverflow', 'ArgMin'), 'uniqExactArgMin': ('uniqExact', 'ArgMin'), 'mannWhitneyUTestArgMin': ('mannWhitneyUTest', 'ArgMin'), 'uniqThetaArgMin': ('uniqTheta', 'ArgMin'), 'maxIntersectionsPositionArgMin': ('maxIntersectionsPosition', 'ArgMin'), 'topKArgMin': ('topK', 'ArgMin'), 'sumKahanArgMin': ('sumKahan', 'ArgMin'), 'sparkBarArgMin': ('sparkBar', 'ArgMin'), 'groupArrayArgMin': ('groupArray', 'ArgMin'), 'skewPopArgMin': ('skewPop', 'ArgMin'), 'groupBitmapArgMin': ('groupBitmap', 'ArgMin'), 'retentionArgMin': ('retention', 'ArgMin'), 'intervalLengthSumArgMin': ('intervalLengthSum', 'ArgMin'), 'quantilesExactHighArgMin': ('quantilesExactHigh', 'ArgMin'), 'corrArgMin': ('corr', 'ArgMin'), 'countArgMin': ('count', 'ArgMin'), 'largestTriangleThreeBucketsArgMin': ('largestTriangleThreeBuckets', 'ArgMin'), 'covarPopArgMin': ('covarPop', 'ArgMin'), 'groupBitXorArgMin': ('groupBitXor', 'ArgMin'), 'studentTTestArgMin': ('studentTTest', 'ArgMin'), 'anyArgMin': ('any', 'ArgMin'), 'anyHeavyArgMin': ('anyHeavy', 'ArgMin'), 'groupBitmapXorArgMin': ('groupBitmapXor', 'ArgMin'), 'last_valueArgMin': ('last_value', 'ArgMin'), 'sumArgMin': ('sum', 'ArgMin'), 'groupArraySampleArgMin': ('groupArraySample', 'ArgMin'), 'first_valueArgMin': ('first_value', 'ArgMin'), 'uniqCombinedArgMin': ('uniqCombined', 'ArgMin'), 'theilsUArgMin': ('theilsU', 'ArgMin'), 'deltaSumArgMin': ('deltaSum', 'ArgMin'), 'quantilesTDigestWeightedArgMin': ('quantilesTDigestWeighted', 'ArgMin'), 'quantileExactHighArgMin': ('quantileExactHigh', 'ArgMin'), 'contingencyArgMin': ('contingency', 'ArgMin'), 'quantileBFloat16ArgMin': ('quantileBFloat16', 'ArgMin'), 'groupArrayInsertAtArgMin': ('groupArrayInsertAt', 'ArgMin'), 'quantileBFloat16WeightedArgMin': ('quantileBFloat16Weighted', 'ArgMin'), 'quantileExactWeightedArgMin': ('quantileExactWeighted', 'ArgMin'), 'quantilesExactArgMin': ('quantilesExact', 'ArgMin'), 'quantileArgMin': ('quantile', 'ArgMin'), 'quantilesInterpolatedWeightedArgMin': ('quantilesInterpolatedWeighted', 'ArgMin'), 'groupBitAndArgMin': ('groupBitAnd', 'ArgMin'), 'topKWeightedArgMin': ('topKWeighted', 'ArgMin'), 'groupArrayMovingAvgArgMin': ('groupArrayMovingAvg', 'ArgMin'), 'groupBitOrArgMin': ('groupBitOr', 'ArgMin'), 'quantileTDigestWeightedArgMin': ('quantileTDigestWeighted', 'ArgMin'), 'minArgMin': ('min', 'ArgMin'), 'maxIntersectionsArgMin': ('maxIntersections', 'ArgMin'), 'stddevPopArgMin': ('stddevPop', 'ArgMin'), 'quantilesTimingArgMin': ('quantilesTiming', 'ArgMin'), 'sumCountArgMin': ('sumCount', 'ArgMin'), 'uniqArgMin': ('uniq', 'ArgMin'), 'quantileDeterministicArgMin': ('quantileDeterministic', 'ArgMin'), 'entropyArgMin': ('entropy', 'ArgMin'), 'groupBitmapAndArgMin': ('groupBitmapAnd', 'ArgMin'), 'uniqHLL12ArgMin': ('uniqHLL12', 'ArgMin'), 'sequenceMatchArgMin': ('sequenceMatch', 'ArgMin'), 'sequenceNextNodeArgMin': ('sequenceNextNode', 'ArgMin'), 'quantileTimingWeightedArgMin': ('quantileTimingWeighted', 'ArgMin'), 'kurtPopArgMin': ('kurtPop', 'ArgMin'), 'quantilesGKArgMin': ('quantilesGK', 'ArgMin'), 'meanZTestArgMin': ('meanZTest', 'ArgMin'), 'argMinArgMin': ('argMin', 'ArgMin'), 'stddevSampArgMin': ('stddevSamp', 'ArgMin'), 'deltaSumTimestampArgMin': ('deltaSumTimestamp', 'ArgMin'), 'stochasticLogisticRegressionArgMin': ('stochasticLogisticRegression', 'ArgMin'), 'uniqCombined64ArgMin': ('uniqCombined64', 'ArgMin'), 'quantilesBFloat16WeightedArgMin': ('quantilesBFloat16Weighted', 'ArgMin'), 'groupArrayMovingSumArgMin': ('groupArrayMovingSum', 'ArgMin'), 'kolmogorovSmirnovTestArgMin': ('kolmogorovSmirnovTest', 'ArgMin'), 'maxArgMin': ('max', 'ArgMin'), 'quantileExactLowArgMin': ('quantileExactLow', 'ArgMin'), 'quantileTDigestArgMin': ('quantileTDigest', 'ArgMin'), 'exponentialMovingAverageArgMax': ('exponentialMovingAverage', 'ArgMax'), 'boundingRatioArgMax': ('boundingRatio', 'ArgMax'), 'cramersVBiasCorrectedArgMax': ('cramersVBiasCorrected', 'ArgMax'), 'quantilesDeterministicArgMax': ('quantilesDeterministic', 'ArgMax'), 'quantilesTimingWeightedArgMax': ('quantilesTimingWeighted', 'ArgMax'), 'quantileInterpolatedWeightedArgMax': ('quantileInterpolatedWeighted', 'ArgMax'), 'avgWeightedArgMax': ('avgWeighted', 'ArgMax'), 'medianArgMax': ('median', 'ArgMax'), 'quantilesExactLowArgMax': ('quantilesExactLow', 'ArgMax'), 'sumMapArgMax': ('sumMap', 'ArgMax'), 'simpleLinearRegressionArgMax': ('simpleLinearRegression', 'ArgMax'), 'uniqUpToArgMax': ('uniqUpTo', 'ArgMax'), 'maxMapArgMax': ('maxMap', 'ArgMax'), 'minMapArgMax': ('minMap', 'ArgMax'), 'argMaxArgMax': ('argMax', 'ArgMax'), 'categoricalInformationValueArgMax': ('categoricalInformationValue', 'ArgMax'), 'quantileExactArgMax': ('quantileExact', 'ArgMax'), 'quantilesExactWeightedArgMax': ('quantilesExactWeighted', 'ArgMax'), 'cramersVArgMax': ('cramersV', 'ArgMax'), 'quantileTimingArgMax': ('quantileTiming', 'ArgMax'), 'varSampArgMax': ('varSamp', 'ArgMax'), 'skewSampArgMax': ('skewSamp', 'ArgMax'), 'covarSampArgMax': ('covarSamp', 'ArgMax'), 'groupUniqArrayArgMax': ('groupUniqArray', 'ArgMax'), 'exponentialTimeDecayedAvgArgMax': ('exponentialTimeDecayedAvg', 'ArgMax'), 'anyLastArgMax': ('anyLast', 'ArgMax'), 'sequenceCountArgMax': ('sequenceCount', 'ArgMax'), 'kurtSampArgMax': ('kurtSamp', 'ArgMax'), 'quantilesArgMax': ('quantiles', 'ArgMax'), 'welchTTestArgMax': ('welchTTest', 'ArgMax'), 'groupArrayLastArgMax': ('groupArrayLast', 'ArgMax'), 'quantilesTDigestArgMax': ('quantilesTDigest', 'ArgMax'), 'quantileGKArgMax': ('quantileGK', 'ArgMax'), 'varPopArgMax': ('varPop', 'ArgMax'), 'rankCorrArgMax': ('rankCorr', 'ArgMax'), 'stochasticLinearRegressionArgMax': ('stochasticLinearRegression', 'ArgMax'), 'histogramArgMax': ('histogram', 'ArgMax'), 'quantilesBFloat16ArgMax': ('quantilesBFloat16', 'ArgMax'), 'avgArgMax': ('avg', 'ArgMax'), 'groupBitmapOrArgMax': ('groupBitmapOr', 'ArgMax'), 'windowFunnelArgMax': ('windowFunnel', 'ArgMax'), 'sumWithOverflowArgMax': ('sumWithOverflow', 'ArgMax'), 'uniqExactArgMax': ('uniqExact', 'ArgMax'), 'mannWhitneyUTestArgMax': ('mannWhitneyUTest', 'ArgMax'), 'uniqThetaArgMax': ('uniqTheta', 'ArgMax'), 'maxIntersectionsPositionArgMax': ('maxIntersectionsPosition', 'ArgMax'), 'topKArgMax': ('topK', 'ArgMax'), 'sumKahanArgMax': ('sumKahan', 'ArgMax'), 'sparkBarArgMax': ('sparkBar', 'ArgMax'), 'groupArrayArgMax': ('groupArray', 'ArgMax'), 'skewPopArgMax': ('skewPop', 'ArgMax'), 'groupBitmapArgMax': ('groupBitmap', 'ArgMax'), 'retentionArgMax': ('retention', 'ArgMax'), 'intervalLengthSumArgMax': ('intervalLengthSum', 'ArgMax'), 'quantilesExactHighArgMax': ('quantilesExactHigh', 'ArgMax'), 'corrArgMax': ('corr', 'ArgMax'), 'countArgMax': ('count', 'ArgMax'), 'largestTriangleThreeBucketsArgMax': ('largestTriangleThreeBuckets', 'ArgMax'), 'covarPopArgMax': ('covarPop', 'ArgMax'), 'groupBitXorArgMax': ('groupBitXor', 'ArgMax'), 'studentTTestArgMax': ('studentTTest', 'ArgMax'), 'anyArgMax': ('any', 'ArgMax'), 'anyHeavyArgMax': ('anyHeavy', 'ArgMax'), 'groupBitmapXorArgMax': ('groupBitmapXor', 'ArgMax'), 'last_valueArgMax': ('last_value', 'ArgMax'), 'sumArgMax': ('sum', 'ArgMax'), 'groupArraySampleArgMax': ('groupArraySample', 'ArgMax'), 'first_valueArgMax': ('first_value', 'ArgMax'), 'uniqCombinedArgMax': ('uniqCombined', 'ArgMax'), 'theilsUArgMax': ('theilsU', 'ArgMax'), 'deltaSumArgMax': ('deltaSum', 'ArgMax'), 'quantilesTDigestWeightedArgMax': ('quantilesTDigestWeighted', 'ArgMax'), 'quantileExactHighArgMax': ('quantileExactHigh', 'ArgMax'), 'contingencyArgMax': ('contingency', 'ArgMax'), 'quantileBFloat16ArgMax': ('quantileBFloat16', 'ArgMax'), 'groupArrayInsertAtArgMax': ('groupArrayInsertAt', 'ArgMax'), 'quantileBFloat16WeightedArgMax': ('quantileBFloat16Weighted', 'ArgMax'), 'quantileExactWeightedArgMax': ('quantileExactWeighted', 'ArgMax'), 'quantilesExactArgMax': ('quantilesExact', 'ArgMax'), 'quantileArgMax': ('quantile', 'ArgMax'), 'quantilesInterpolatedWeightedArgMax': ('quantilesInterpolatedWeighted', 'ArgMax'), 'groupBitAndArgMax': ('groupBitAnd', 'ArgMax'), 'topKWeightedArgMax': ('topKWeighted', 'ArgMax'), 'groupArrayMovingAvgArgMax': ('groupArrayMovingAvg', 'ArgMax'), 'groupBitOrArgMax': ('groupBitOr', 'ArgMax'), 'quantileTDigestWeightedArgMax': ('quantileTDigestWeighted', 'ArgMax'), 'minArgMax': ('min', 'ArgMax'), 'maxIntersectionsArgMax': ('maxIntersections', 'ArgMax'), 'stddevPopArgMax': ('stddevPop', 'ArgMax'), 'quantilesTimingArgMax': ('quantilesTiming', 'ArgMax'), 'sumCountArgMax': ('sumCount', 'ArgMax'), 'uniqArgMax': ('uniq', 'ArgMax'), 'quantileDeterministicArgMax': ('quantileDeterministic', 'ArgMax'), 'entropyArgMax': ('entropy', 'ArgMax'), 'groupBitmapAndArgMax': ('groupBitmapAnd', 'ArgMax'), 'uniqHLL12ArgMax': ('uniqHLL12', 'ArgMax'), 'sequenceMatchArgMax': ('sequenceMatch', 'ArgMax'), 'sequenceNextNodeArgMax': ('sequenceNextNode', 'ArgMax'), 'quantileTimingWeightedArgMax': ('quantileTimingWeighted', 'ArgMax'), 'kurtPopArgMax': ('kurtPop', 'ArgMax'), 'quantilesGKArgMax': ('quantilesGK', 'ArgMax'), 'meanZTestArgMax': ('meanZTest', 'ArgMax'), 'argMinArgMax': ('argMin', 'ArgMax'), 'stddevSampArgMax': ('stddevSamp', 'ArgMax'), 'deltaSumTimestampArgMax': ('deltaSumTimestamp', 'ArgMax'), 'stochasticLogisticRegressionArgMax': ('stochasticLogisticRegression', 'ArgMax'), 'uniqCombined64ArgMax': ('uniqCombined64', 'ArgMax'), 'quantilesBFloat16WeightedArgMax': ('quantilesBFloat16Weighted', 'ArgMax'), 'groupArrayMovingSumArgMax': ('groupArrayMovingSum', 'ArgMax'), 'kolmogorovSmirnovTestArgMax': ('kolmogorovSmirnovTest', 'ArgMax'), 'maxArgMax': ('max', 'ArgMax'), 'quantileExactLowArgMax': ('quantileExactLow', 'ArgMax'), 'quantileTDigestArgMax': ('quantileTDigest', 'ArgMax'), 'exponentialMovingAverage': ('exponentialMovingAverage', ''), 'boundingRatio': ('boundingRatio', ''), 'cramersVBiasCorrected': ('cramersVBiasCorrected', ''), 'quantilesDeterministic': ('quantilesDeterministic', ''), 'quantilesTimingWeighted': ('quantilesTimingWeighted', ''), 'quantileInterpolatedWeighted': ('quantileInterpolatedWeighted', ''), 'avgWeighted': ('avgWeighted', ''), 'median': ('median', ''), 'quantilesExactLow': ('quantilesExactLow', ''), 'simpleLinearRegression': ('simpleLinearRegression', ''), 'uniqUpTo': ('uniqUpTo', ''), 'argMax': ('argMax', ''), 'categoricalInformationValue': ('categoricalInformationValue', ''), 'quantileExact': ('quantileExact', ''), 'quantilesExactWeighted': ('quantilesExactWeighted', ''), 'cramersV': ('cramersV', ''), 'quantileTiming': ('quantileTiming', ''), 'varSamp': ('varSamp', ''), 'skewSamp': ('skewSamp', ''), 'covarSamp': ('covarSamp', ''), 'groupUniqArray': ('groupUniqArray', ''), 'exponentialTimeDecayedAvg': ('exponentialTimeDecayedAvg', ''), 'anyLast': ('anyLast', ''), 'sequenceCount': ('sequenceCount', ''), 'kurtSamp': ('kurtSamp', ''), 'quantiles': ('quantiles', ''), 'welchTTest': ('welchTTest', ''), 'groupArrayLast': ('groupArrayLast', ''), 'quantilesTDigest': ('quantilesTDigest', ''), 'quantileGK': ('quantileGK', ''), 'varPop': ('varPop', ''), 'rankCorr': ('rankCorr', ''), 'stochasticLinearRegression': ('stochasticLinearRegression', ''), 'histogram': ('histogram', ''), 'quantilesBFloat16': ('quantilesBFloat16', ''), 'avg': ('avg', ''), 'groupBitmapOr': ('groupBitmapOr', ''), 'windowFunnel': ('windowFunnel', ''), 'sumWithOverflow': ('sumWithOverflow', ''), 'uniqExact': ('uniqExact', ''), 'mannWhitneyUTest': ('mannWhitneyUTest', ''), 'uniqTheta': ('uniqTheta', ''), 'maxIntersectionsPosition': ('maxIntersectionsPosition', ''), 'topK': ('topK', ''), 'sumKahan': ('sumKahan', ''), 'sparkBar': ('sparkBar', ''), 'groupArray': ('groupArray', ''), 'skewPop': ('skewPop', ''), 'groupBitmap': ('groupBitmap', ''), 'retention': ('retention', ''), 'intervalLengthSum': ('intervalLengthSum', ''), 'quantilesExactHigh': ('quantilesExactHigh', ''), 'corr': ('corr', ''), 'count': ('count', ''), 'largestTriangleThreeBuckets': ('largestTriangleThreeBuckets', ''), 'covarPop': ('covarPop', ''), 'groupBitXor': ('groupBitXor', ''), 'studentTTest': ('studentTTest', ''), 'any': ('any', ''), 'anyHeavy': ('anyHeavy', ''), 'groupBitmapXor': ('groupBitmapXor', ''), 'last_value': ('last_value', ''), 'sum': ('sum', ''), 'groupArraySample': ('groupArraySample', ''), 'first_value': ('first_value', ''), 'uniqCombined': ('uniqCombined', ''), 'theilsU': ('theilsU', ''), 'deltaSum': ('deltaSum', ''), 'quantilesTDigestWeighted': ('quantilesTDigestWeighted', ''), 'quantileExactHigh': ('quantileExactHigh', ''), 'contingency': ('contingency', ''), 'quantileBFloat16': ('quantileBFloat16', ''), 'groupArrayInsertAt': ('groupArrayInsertAt', ''), 'quantileBFloat16Weighted': ('quantileBFloat16Weighted', ''), 'quantileExactWeighted': ('quantileExactWeighted', ''), 'quantilesExact': ('quantilesExact', ''), 'quantile': ('quantile', ''), 'quantilesInterpolatedWeighted': ('quantilesInterpolatedWeighted', ''), 'groupBitAnd': ('groupBitAnd', ''), 'topKWeighted': ('topKWeighted', ''), 'groupArrayMovingAvg': ('groupArrayMovingAvg', ''), 'groupBitOr': ('groupBitOr', ''), 'quantileTDigestWeighted': ('quantileTDigestWeighted', ''), 'min': ('min', ''), 'maxIntersections': ('maxIntersections', ''), 'stddevPop': ('stddevPop', ''), 'quantilesTiming': ('quantilesTiming', ''), 'sumCount': ('sumCount', ''), 'uniq': ('uniq', ''), 'quantileDeterministic': ('quantileDeterministic', ''), 'entropy': ('entropy', ''), 'groupBitmapAnd': ('groupBitmapAnd', ''), 'uniqHLL12': ('uniqHLL12', ''), 'sequenceMatch': ('sequenceMatch', ''), 'sequenceNextNode': ('sequenceNextNode', ''), 'quantileTimingWeighted': ('quantileTimingWeighted', ''), 'kurtPop': ('kurtPop', ''), 'quantilesGK': ('quantilesGK', ''), 'meanZTest': ('meanZTest', ''), 'argMin': ('argMin', ''), 'stddevSamp': ('stddevSamp', ''), 'deltaSumTimestamp': ('deltaSumTimestamp', ''), 'stochasticLogisticRegression': ('stochasticLogisticRegression', ''), 'uniqCombined64': ('uniqCombined64', ''), 'quantilesBFloat16Weighted': ('quantilesBFloat16Weighted', ''), 'groupArrayMovingSum': ('groupArrayMovingSum', ''), 'kolmogorovSmirnovTest': ('kolmogorovSmirnovTest', ''), 'max': ('max', ''), 'quantileExactLow': ('quantileExactLow', ''), 'quantileTDigest': ('quantileTDigest', '')}
FUNCTIONS_WITH_ALIASED_ARGS = {'TUPLE', 'STRUCT'}
FUNCTION_PARSERS = {'CAST': <function Parser.<lambda>>, 'CONVERT': <function Parser.<lambda>>, 'DECODE': <function Parser.<lambda>>, 'EXTRACT': <function Parser.<lambda>>, 'GAP_FILL': <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>>, 'CONNECT_BY_ROOT': <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>._parse_binary_range>, <TokenType.ILIKE: 'ILIKE'>: <function binary_range_parser.<locals>._parse_binary_range>, <TokenType.IN: 'IN'>: <function Parser.<lambda>>, <TokenType.IRLIKE: 'IRLIKE'>: <function binary_range_parser.<locals>._parse_binary_range>, <TokenType.IS: 'IS'>: <function Parser.<lambda>>, <TokenType.LIKE: 'LIKE'>: <function binary_range_parser.<locals>._parse_binary_range>, <TokenType.OVERLAPS: 'OVERLAPS'>: <function binary_range_parser.<locals>._parse_binary_range>, <TokenType.RLIKE: 'RLIKE'>: <function binary_range_parser.<locals>._parse_binary_range>, <TokenType.SIMILAR_TO: 'SIMILAR_TO'>: <function binary_range_parser.<locals>._parse_binary_range>, <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.CROSS: 'CROSS'>, <TokenType.OUTER: 'OUTER'>, <TokenType.STRAIGHT_JOIN: 'STRAIGHT_JOIN'>, <TokenType.INNER: 'INNER'>, <TokenType.ANY: 'ANY'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.ASOF: 'ASOF'>, <TokenType.SEMI: 'SEMI'>}
TABLE_ALIAS_TOKENS = {<TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.INT: 'INT'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.FALSE: 'FALSE'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.ENUM: 'ENUM'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.ROWS: 'ROWS'>, <TokenType.UINT256: 'UINT256'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.VIEW: 'VIEW'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.COPY: 'COPY'>, <TokenType.INT128: 'INT128'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.UINT: 'UINT'>, <TokenType.IS: 'IS'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.INDEX: 'INDEX'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.TRUE: 'TRUE'>, <TokenType.STORAGE_INTEGRATION: 'STORAGE_INTEGRATION'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.DATE32: 'DATE32'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.DELETE: 'DELETE'>, <TokenType.RENAME: 'RENAME'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.TEXT: 'TEXT'>, <TokenType.UINT128: 'UINT128'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.ROLLUP: 'ROLLUP'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.SHOW: 'SHOW'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.ALL: 'ALL'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.YEAR: 'YEAR'>, <TokenType.MONEY: 'MONEY'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.TABLE: 'TABLE'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.IPV4: 'IPV4'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.PROCEDURE: 'PROCEDURE'>, <TokenType.FIRST: 'FIRST'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.USE: 'USE'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.JSON: 'JSON'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.CUBE: 'CUBE'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.CACHE: 'CACHE'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.VAR: 'VAR'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.WAREHOUSE: 'WAREHOUSE'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.CHAR: 'CHAR'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.TIME: 'TIME'>, <TokenType.ROW: 'ROW'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.ORDINALITY: 'ORDINALITY'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.XML: 'XML'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.MERGE: 'MERGE'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.REFERENCES: 'REFERENCES'>, <TokenType.DIV: 'DIV'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.KEEP: 'KEEP'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.DESC: 'DESC'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.RANGE: 'RANGE'>, <TokenType.JSONB: 'JSONB'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.TAG: 'TAG'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.KILL: 'KILL'>, <TokenType.NULL: 'NULL'>, <TokenType.NAME: 'NAME'>, <TokenType.LIST: 'LIST'>, <TokenType.NEXT: 'NEXT'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.STREAMLIT: 'STREAMLIT'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.SET: 'SET'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.MAP: 'MAP'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.IPV6: 'IPV6'>, <TokenType.END: 'END'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.UUID: 'UUID'>, <TokenType.CASE: 'CASE'>, <TokenType.UNIQUE: 'UNIQUE'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.MODEL: 'MODEL'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.INET: 'INET'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.ASC: 'ASC'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.DATE: 'DATE'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.BINARY: 'BINARY'>, <TokenType.UNIQUEIDENTIFIER: 'UNIQUEIDENTIFIER'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.INT256: 'INT256'>, <TokenType.STRAIGHT_JOIN: 'STRAIGHT_JOIN'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.NESTED: 'NESTED'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.SUPER: 'SUPER'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.LOAD: 'LOAD'>, <TokenType.BIT: 'BIT'>, <TokenType.SOME: 'SOME'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.TOP: 'TOP'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.FILTER: 'FILTER'>}
ALIAS_TOKENS = {<TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.INT: 'INT'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.FALSE: 'FALSE'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.ENUM: 'ENUM'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.ROWS: 'ROWS'>, <TokenType.UINT256: 'UINT256'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.VIEW: 'VIEW'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.COPY: 'COPY'>, <TokenType.INT128: 'INT128'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.UINT: 'UINT'>, <TokenType.IS: 'IS'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.INDEX: 'INDEX'>, <TokenType.FINAL: 'FINAL'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.TRUE: 'TRUE'>, <TokenType.STORAGE_INTEGRATION: 'STORAGE_INTEGRATION'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.DATE32: 'DATE32'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.DELETE: 'DELETE'>, <TokenType.RENAME: 'RENAME'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.TEXT: 'TEXT'>, <TokenType.UINT128: 'UINT128'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.ROLLUP: 'ROLLUP'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.LEFT: 'LEFT'>, <TokenType.SHOW: 'SHOW'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.ALL: 'ALL'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.YEAR: 'YEAR'>, <TokenType.MONEY: 'MONEY'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.TABLE: 'TABLE'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.IPV4: 'IPV4'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.APPLY: 'APPLY'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.FULL: 'FULL'>, <TokenType.PROCEDURE: 'PROCEDURE'>, <TokenType.FIRST: 'FIRST'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.SETTINGS: 'SETTINGS'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.USE: 'USE'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.JSON: 'JSON'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.CUBE: 'CUBE'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.CACHE: 'CACHE'>, <TokenType.WINDOW: 'WINDOW'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.VAR: 'VAR'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.WAREHOUSE: 'WAREHOUSE'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.CHAR: 'CHAR'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.TIME: 'TIME'>, <TokenType.ROW: 'ROW'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.ORDINALITY: 'ORDINALITY'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.XML: 'XML'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.MERGE: 'MERGE'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.REFERENCES: 'REFERENCES'>, <TokenType.DIV: 'DIV'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.KEEP: 'KEEP'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.DESC: 'DESC'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.SEMI: 'SEMI'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.RANGE: 'RANGE'>, <TokenType.JSONB: 'JSONB'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.ANTI: 'ANTI'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.NATURAL: 'NATURAL'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.TAG: 'TAG'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.KILL: 'KILL'>, <TokenType.NULL: 'NULL'>, <TokenType.NAME: 'NAME'>, <TokenType.LIST: 'LIST'>, <TokenType.NEXT: 'NEXT'>, <TokenType.ANY: 'ANY'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.ASOF: 'ASOF'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.STREAMLIT: 'STREAMLIT'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.SET: 'SET'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.MAP: 'MAP'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.IPV6: 'IPV6'>, <TokenType.END: 'END'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.UUID: 'UUID'>, <TokenType.CASE: 'CASE'>, <TokenType.UNIQUE: 'UNIQUE'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.MODEL: 'MODEL'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.INET: 'INET'>, <TokenType.RIGHT: 'RIGHT'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.ASC: 'ASC'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.DATE: 'DATE'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.BINARY: 'BINARY'>, <TokenType.UNIQUEIDENTIFIER: 'UNIQUEIDENTIFIER'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.INT256: 'INT256'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.NESTED: 'NESTED'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.SUPER: 'SUPER'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.LOAD: 'LOAD'>, <TokenType.BIT: 'BIT'>, <TokenType.SOME: 'SOME'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.TOP: 'TOP'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.FILTER: 'FILTER'>}
LOG_DEFAULTS_TO_LN = True
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>>, 'SET': <function Parser.<lambda>>, 'AS': <function Parser.<lambda>>, 'REPLACE': <function ClickHouse.Parser.<lambda>>}
SCHEMA_UNNAMED_CONSTRAINTS = {'CHECK', 'PERIOD', 'PRIMARY KEY', 'FOREIGN KEY', 'EXCLUDE', 'LIKE', 'INDEX', 'UNIQUE'}
SHOW_TRIE: Dict = {}
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
DB_CREATABLES
CREATABLES
ALTERABLES
INTERVAL_VARS
ARRAY_CONSTRUCTORS
COMMENT_TABLE_ALIAS_TOKENS
UPDATE_ALIAS_TOKENS
TRIM_TYPES
CONJUNCTION
ASSIGNMENT
DISJUNCTION
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
TYPE_CONVERTERS
DDL_SELECT_TOKENS
PRE_VOLATILE_TOKENS
TRANSACTION_KIND
TRANSACTION_CHARACTERISTICS
CONFLICT_ACTIONS
CREATE_SEQUENCE
ISOLATED_LOADING_OPTIONS
USABLES
CAST_ACTIONS
SCHEMA_BINDING_OPTIONS
KEY_CONSTRAINT_OPTIONS
INSERT_ALTERNATIVES
CLONE_KEYWORDS
HISTORICAL_DATA_PREFIX
HISTORICAL_DATA_KIND
OPCLASS_FOLLOW_KEYWORDS
OPTYPE_FOLLOW_TOKENS
TABLE_INDEX_HINT_TOKENS
VIEW_ATTRIBUTES
WINDOW_ALIAS_TOKENS
WINDOW_BEFORE_PAREN_TOKENS
WINDOW_SIDES
JSON_KEY_VALUE_SEPARATOR_TOKENS
FETCH_TOKENS
ADD_CONSTRAINT_TOKENS
DISTINCT_TOKENS
NULL_TOKENS
UNNEST_OFFSET_ALIAS_TOKENS
SELECT_START_TOKENS
COPY_INTO_VARLEN_OPTIONS
STRICT_CAST
PREFIXED_PIVOT_COLUMNS
IDENTIFY_PIVOT_STRINGS
ALTER_TABLE_ADD_REQUIRED_FOR_EACH_COLUMN
TABLESAMPLE_CSV
DEFAULT_SAMPLING_METHOD
SET_REQUIRES_ASSIGNMENT_DELIMITER
TRIM_PATTERN_FIRST
STRING_ALIASES
SET_OP_MODIFIERS
NO_PAREN_IF_COMMANDS
JSON_ARROWS_REQUIRE_JSON_TYPE
COLON_IS_VARIANT_EXTRACT
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
class ClickHouse.Generator(sqlglot.generator.Generator):
 707    class Generator(generator.Generator):
 708        QUERY_HINTS = False
 709        STRUCT_DELIMITER = ("(", ")")
 710        NVL2_SUPPORTED = False
 711        TABLESAMPLE_REQUIRES_PARENS = False
 712        TABLESAMPLE_SIZE_IS_ROWS = False
 713        TABLESAMPLE_KEYWORDS = "SAMPLE"
 714        LAST_DAY_SUPPORTS_DATE_PART = False
 715        CAN_IMPLEMENT_ARRAY_ANY = True
 716        SUPPORTS_TO_NUMBER = False
 717        JOIN_HINTS = False
 718        TABLE_HINTS = False
 719        EXPLICIT_SET_OP = True
 720        GROUPINGS_SEP = ""
 721        SET_OP_MODIFIERS = False
 722        SUPPORTS_TABLE_ALIAS_COLUMNS = False
 723        VALUES_AS_TABLE = False
 724
 725        STRING_TYPE_MAPPING = {
 726            exp.DataType.Type.CHAR: "String",
 727            exp.DataType.Type.LONGBLOB: "String",
 728            exp.DataType.Type.LONGTEXT: "String",
 729            exp.DataType.Type.MEDIUMBLOB: "String",
 730            exp.DataType.Type.MEDIUMTEXT: "String",
 731            exp.DataType.Type.TINYBLOB: "String",
 732            exp.DataType.Type.TINYTEXT: "String",
 733            exp.DataType.Type.TEXT: "String",
 734            exp.DataType.Type.VARBINARY: "String",
 735            exp.DataType.Type.VARCHAR: "String",
 736        }
 737
 738        SUPPORTED_JSON_PATH_PARTS = {
 739            exp.JSONPathKey,
 740            exp.JSONPathRoot,
 741            exp.JSONPathSubscript,
 742        }
 743
 744        TYPE_MAPPING = {
 745            **generator.Generator.TYPE_MAPPING,
 746            **STRING_TYPE_MAPPING,
 747            exp.DataType.Type.ARRAY: "Array",
 748            exp.DataType.Type.BIGINT: "Int64",
 749            exp.DataType.Type.DATE32: "Date32",
 750            exp.DataType.Type.DATETIME64: "DateTime64",
 751            exp.DataType.Type.DOUBLE: "Float64",
 752            exp.DataType.Type.ENUM: "Enum",
 753            exp.DataType.Type.ENUM8: "Enum8",
 754            exp.DataType.Type.ENUM16: "Enum16",
 755            exp.DataType.Type.FIXEDSTRING: "FixedString",
 756            exp.DataType.Type.FLOAT: "Float32",
 757            exp.DataType.Type.INT: "Int32",
 758            exp.DataType.Type.MEDIUMINT: "Int32",
 759            exp.DataType.Type.INT128: "Int128",
 760            exp.DataType.Type.INT256: "Int256",
 761            exp.DataType.Type.LOWCARDINALITY: "LowCardinality",
 762            exp.DataType.Type.MAP: "Map",
 763            exp.DataType.Type.NESTED: "Nested",
 764            exp.DataType.Type.NULLABLE: "Nullable",
 765            exp.DataType.Type.SMALLINT: "Int16",
 766            exp.DataType.Type.STRUCT: "Tuple",
 767            exp.DataType.Type.TINYINT: "Int8",
 768            exp.DataType.Type.UBIGINT: "UInt64",
 769            exp.DataType.Type.UINT: "UInt32",
 770            exp.DataType.Type.UINT128: "UInt128",
 771            exp.DataType.Type.UINT256: "UInt256",
 772            exp.DataType.Type.USMALLINT: "UInt16",
 773            exp.DataType.Type.UTINYINT: "UInt8",
 774            exp.DataType.Type.IPV4: "IPv4",
 775            exp.DataType.Type.IPV6: "IPv6",
 776            exp.DataType.Type.AGGREGATEFUNCTION: "AggregateFunction",
 777            exp.DataType.Type.SIMPLEAGGREGATEFUNCTION: "SimpleAggregateFunction",
 778        }
 779
 780        TRANSFORMS = {
 781            **generator.Generator.TRANSFORMS,
 782            exp.AnyValue: rename_func("any"),
 783            exp.ApproxDistinct: rename_func("uniq"),
 784            exp.ArrayFilter: lambda self, e: self.func("arrayFilter", e.expression, e.this),
 785            exp.ArraySize: rename_func("LENGTH"),
 786            exp.ArraySum: rename_func("arraySum"),
 787            exp.ArgMax: arg_max_or_min_no_count("argMax"),
 788            exp.ArgMin: arg_max_or_min_no_count("argMin"),
 789            exp.Array: inline_array_sql,
 790            exp.CastToStrType: rename_func("CAST"),
 791            exp.CountIf: rename_func("countIf"),
 792            exp.CompressColumnConstraint: lambda self,
 793            e: f"CODEC({self.expressions(e, key='this', flat=True)})",
 794            exp.ComputedColumnConstraint: lambda self,
 795            e: f"{'MATERIALIZED' if e.args.get('persisted') else 'ALIAS'} {self.sql(e, 'this')}",
 796            exp.CurrentDate: lambda self, e: self.func("CURRENT_DATE"),
 797            exp.DateAdd: _datetime_delta_sql("DATE_ADD"),
 798            exp.DateDiff: _datetime_delta_sql("DATE_DIFF"),
 799            exp.DateStrToDate: rename_func("toDate"),
 800            exp.DateSub: _datetime_delta_sql("DATE_SUB"),
 801            exp.Explode: rename_func("arrayJoin"),
 802            exp.Final: lambda self, e: f"{self.sql(e, 'this')} FINAL",
 803            exp.IsNan: rename_func("isNaN"),
 804            exp.JSONExtract: json_extract_segments("JSONExtractString", quoted_index=False),
 805            exp.JSONExtractScalar: json_extract_segments("JSONExtractString", quoted_index=False),
 806            exp.JSONPathKey: json_path_key_only_name,
 807            exp.JSONPathRoot: lambda *_: "",
 808            exp.Map: lambda self, e: _lower_func(var_map_sql(self, e)),
 809            exp.Nullif: rename_func("nullIf"),
 810            exp.PartitionedByProperty: lambda self, e: f"PARTITION BY {self.sql(e, 'this')}",
 811            exp.Pivot: no_pivot_sql,
 812            exp.Quantile: _quantile_sql,
 813            exp.RegexpLike: lambda self, e: self.func("match", e.this, e.expression),
 814            exp.Rand: rename_func("randCanonical"),
 815            exp.StartsWith: rename_func("startsWith"),
 816            exp.StrPosition: lambda self, e: self.func(
 817                "position", e.this, e.args.get("substr"), e.args.get("position")
 818            ),
 819            exp.TimeToStr: lambda self, e: self.func(
 820                "DATE_FORMAT", e.this, self.format_time(e), e.args.get("timezone")
 821            ),
 822            exp.TimestampAdd: _datetime_delta_sql("TIMESTAMP_ADD"),
 823            exp.TimestampSub: _datetime_delta_sql("TIMESTAMP_SUB"),
 824            exp.VarMap: lambda self, e: _lower_func(var_map_sql(self, e)),
 825            exp.Xor: lambda self, e: self.func("xor", e.this, e.expression, *e.expressions),
 826            exp.MD5Digest: rename_func("MD5"),
 827            exp.MD5: lambda self, e: self.func("LOWER", self.func("HEX", self.func("MD5", e.this))),
 828            exp.SHA: rename_func("SHA1"),
 829            exp.SHA2: sha256_sql,
 830            exp.UnixToTime: _unix_to_time_sql,
 831            exp.TimestampTrunc: timestamptrunc_sql(zone=True),
 832            exp.Variance: rename_func("varSamp"),
 833            exp.SchemaCommentProperty: lambda self, e: self.naked_property(e),
 834            exp.Stddev: rename_func("stddevSamp"),
 835        }
 836
 837        PROPERTIES_LOCATION = {
 838            **generator.Generator.PROPERTIES_LOCATION,
 839            exp.VolatileProperty: exp.Properties.Location.UNSUPPORTED,
 840            exp.PartitionedByProperty: exp.Properties.Location.POST_SCHEMA,
 841            exp.OnCluster: exp.Properties.Location.POST_NAME,
 842        }
 843
 844        # there's no list in docs, but it can be found in Clickhouse code
 845        # see `ClickHouse/src/Parsers/ParserCreate*.cpp`
 846        ON_CLUSTER_TARGETS = {
 847            "DATABASE",
 848            "TABLE",
 849            "VIEW",
 850            "DICTIONARY",
 851            "INDEX",
 852            "FUNCTION",
 853            "NAMED COLLECTION",
 854        }
 855
 856        def strtodate_sql(self, expression: exp.StrToDate) -> str:
 857            strtodate_sql = self.function_fallback_sql(expression)
 858
 859            if not isinstance(expression.parent, exp.Cast):
 860                # StrToDate returns DATEs in other dialects (eg. postgres), so
 861                # this branch aims to improve the transpilation to clickhouse
 862                return f"CAST({strtodate_sql} AS DATE)"
 863
 864            return strtodate_sql
 865
 866        def cast_sql(self, expression: exp.Cast, safe_prefix: t.Optional[str] = None) -> str:
 867            this = expression.this
 868
 869            if isinstance(this, exp.StrToDate) and expression.to == exp.DataType.build("datetime"):
 870                return self.sql(this)
 871
 872            return super().cast_sql(expression, safe_prefix=safe_prefix)
 873
 874        def _jsonpathsubscript_sql(self, expression: exp.JSONPathSubscript) -> str:
 875            this = self.json_path_part(expression.this)
 876            return str(int(this) + 1) if is_int(this) else this
 877
 878        def likeproperty_sql(self, expression: exp.LikeProperty) -> str:
 879            return f"AS {self.sql(expression, 'this')}"
 880
 881        def _any_to_has(
 882            self,
 883            expression: exp.EQ | exp.NEQ,
 884            default: t.Callable[[t.Any], str],
 885            prefix: str = "",
 886        ) -> str:
 887            if isinstance(expression.left, exp.Any):
 888                arr = expression.left
 889                this = expression.right
 890            elif isinstance(expression.right, exp.Any):
 891                arr = expression.right
 892                this = expression.left
 893            else:
 894                return default(expression)
 895
 896            return prefix + self.func("has", arr.this.unnest(), this)
 897
 898        def eq_sql(self, expression: exp.EQ) -> str:
 899            return self._any_to_has(expression, super().eq_sql)
 900
 901        def neq_sql(self, expression: exp.NEQ) -> str:
 902            return self._any_to_has(expression, super().neq_sql, "NOT ")
 903
 904        def regexpilike_sql(self, expression: exp.RegexpILike) -> str:
 905            # Manually add a flag to make the search case-insensitive
 906            regex = self.func("CONCAT", "'(?i)'", expression.expression)
 907            return self.func("match", expression.this, regex)
 908
 909        def datatype_sql(self, expression: exp.DataType) -> str:
 910            # String is the standard ClickHouse type, every other variant is just an alias.
 911            # Additionally, any supplied length parameter will be ignored.
 912            #
 913            # https://clickhouse.com/docs/en/sql-reference/data-types/string
 914            if expression.this in self.STRING_TYPE_MAPPING:
 915                return "String"
 916
 917            return super().datatype_sql(expression)
 918
 919        def cte_sql(self, expression: exp.CTE) -> str:
 920            if expression.args.get("scalar"):
 921                this = self.sql(expression, "this")
 922                alias = self.sql(expression, "alias")
 923                return f"{this} AS {alias}"
 924
 925            return super().cte_sql(expression)
 926
 927        def after_limit_modifiers(self, expression: exp.Expression) -> t.List[str]:
 928            return super().after_limit_modifiers(expression) + [
 929                (
 930                    self.seg("SETTINGS ") + self.expressions(expression, key="settings", flat=True)
 931                    if expression.args.get("settings")
 932                    else ""
 933                ),
 934                (
 935                    self.seg("FORMAT ") + self.sql(expression, "format")
 936                    if expression.args.get("format")
 937                    else ""
 938                ),
 939            ]
 940
 941        def parameterizedagg_sql(self, expression: exp.ParameterizedAgg) -> str:
 942            params = self.expressions(expression, key="params", flat=True)
 943            return self.func(expression.name, *expression.expressions) + f"({params})"
 944
 945        def anonymousaggfunc_sql(self, expression: exp.AnonymousAggFunc) -> str:
 946            return self.func(expression.name, *expression.expressions)
 947
 948        def combinedaggfunc_sql(self, expression: exp.CombinedAggFunc) -> str:
 949            return self.anonymousaggfunc_sql(expression)
 950
 951        def combinedparameterizedagg_sql(self, expression: exp.CombinedParameterizedAgg) -> str:
 952            return self.parameterizedagg_sql(expression)
 953
 954        def placeholder_sql(self, expression: exp.Placeholder) -> str:
 955            return f"{{{expression.name}: {self.sql(expression, 'kind')}}}"
 956
 957        def oncluster_sql(self, expression: exp.OnCluster) -> str:
 958            return f"ON CLUSTER {self.sql(expression, 'this')}"
 959
 960        def createable_sql(self, expression: exp.Create, locations: t.DefaultDict) -> str:
 961            if expression.kind in self.ON_CLUSTER_TARGETS and locations.get(
 962                exp.Properties.Location.POST_NAME
 963            ):
 964                this_name = self.sql(expression.this, "this")
 965                this_properties = " ".join(
 966                    [self.sql(prop) for prop in locations[exp.Properties.Location.POST_NAME]]
 967                )
 968                this_schema = self.schema_columns_sql(expression.this)
 969                return f"{this_name}{self.sep()}{this_properties}{self.sep()}{this_schema}"
 970
 971            return super().createable_sql(expression, locations)
 972
 973        def prewhere_sql(self, expression: exp.PreWhere) -> str:
 974            this = self.indent(self.sql(expression, "this"))
 975            return f"{self.seg('PREWHERE')}{self.sep()}{this}"
 976
 977        def indexcolumnconstraint_sql(self, expression: exp.IndexColumnConstraint) -> str:
 978            this = self.sql(expression, "this")
 979            this = f" {this}" if this else ""
 980            expr = self.sql(expression, "expression")
 981            expr = f" {expr}" if expr else ""
 982            index_type = self.sql(expression, "index_type")
 983            index_type = f" TYPE {index_type}" if index_type else ""
 984            granularity = self.sql(expression, "granularity")
 985            granularity = f" GRANULARITY {granularity}" if granularity else ""
 986
 987            return f"INDEX{this}{expr}{index_type}{granularity}"
 988
 989        def partition_sql(self, expression: exp.Partition) -> str:
 990            return f"PARTITION {self.expressions(expression, flat=True)}"
 991
 992        def partitionid_sql(self, expression: exp.PartitionId) -> str:
 993            return f"ID {self.sql(expression.this)}"
 994
 995        def replacepartition_sql(self, expression: exp.ReplacePartition) -> str:
 996            return (
 997                f"REPLACE {self.sql(expression.expression)} FROM {self.sql(expression, 'source')}"
 998            )
 999
1000        def projectiondef_sql(self, expression: exp.ProjectionDef) -> str:
1001            return f"PROJECTION {self.sql(expression.this)} {self.wrap(expression.expression)}"

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
QUERY_HINTS = False
STRUCT_DELIMITER = ('(', ')')
NVL2_SUPPORTED = False
TABLESAMPLE_REQUIRES_PARENS = False
TABLESAMPLE_SIZE_IS_ROWS = False
TABLESAMPLE_KEYWORDS = 'SAMPLE'
LAST_DAY_SUPPORTS_DATE_PART = False
CAN_IMPLEMENT_ARRAY_ANY = True
SUPPORTS_TO_NUMBER = False
JOIN_HINTS = False
TABLE_HINTS = False
EXPLICIT_SET_OP = True
GROUPINGS_SEP = ''
SET_OP_MODIFIERS = False
SUPPORTS_TABLE_ALIAS_COLUMNS = False
VALUES_AS_TABLE = False
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'}
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.AllowedValuesProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.AutoRefreshProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.BackupProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CaseSpecificColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CharacterSetColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CharacterSetProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ClusteredColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CollateColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CommentColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ConnectByRoot'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CopyGrantsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.DateFormatColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.DefaultColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.DynamicProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.EmptyProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.EncodeColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.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.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.PivotAny'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ProjectionPolicyColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.RemoteWithConnectionModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ReturnsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SampleProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SecureProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SetConfigProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SetProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SettingsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SharingProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SqlReadWriteProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SqlSecurityProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.StabilityProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Stream'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.StreamingTableProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.StrictProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TemporaryProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TagColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TitleColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ToMap'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ToTableProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TransformModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TransientProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.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.WithSchemaBindingProperty'>: <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 _datetime_delta_sql.<locals>._delta_sql>, <class 'sqlglot.expressions.DateDiff'>: <function _datetime_delta_sql.<locals>._delta_sql>, <class 'sqlglot.expressions.DateStrToDate'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.DateSub'>: <function _datetime_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.JSONExtract'>: <function json_extract_segments.<locals>._json_extract_segments>, <class 'sqlglot.expressions.JSONExtractScalar'>: <function json_extract_segments.<locals>._json_extract_segments>, <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.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.TimestampAdd'>: <function _datetime_delta_sql.<locals>._delta_sql>, <class 'sqlglot.expressions.TimestampSub'>: <function _datetime_delta_sql.<locals>._delta_sql>, <class 'sqlglot.expressions.Xor'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.MD5Digest'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.MD5'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.SHA'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.SHA2'>: <function sha256_sql>, <class 'sqlglot.expressions.UnixToTime'>: <function _unix_to_time_sql>, <class 'sqlglot.expressions.TimestampTrunc'>: <function timestamptrunc_sql.<locals>._timestamptrunc_sql>, <class 'sqlglot.expressions.Variance'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.SchemaCommentProperty'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.Stddev'>: <function rename_func.<locals>.<lambda>>}
PROPERTIES_LOCATION = {<class 'sqlglot.expressions.AllowedValuesProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.AlgorithmProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.AutoIncrementProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.AutoRefreshProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.BackupProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.BlockCompressionProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.CharacterSetProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ChecksumProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.CollateProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.CopyGrantsProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.Cluster'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ClusteredByProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DataBlocksizeProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.DataDeletionProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DefinerProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.DictRange'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DictProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DynamicProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.DistKeyProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DistStyleProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.EmptyProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.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.SecureProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <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.StreamingTableProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.StrictProperty'>: <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.WithSchemaBindingProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.WithSystemVersioningProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.OnCluster'>: <Location.POST_NAME: 'POST_NAME'>}
ON_CLUSTER_TARGETS = {'DATABASE', 'FUNCTION', 'INDEX', 'DICTIONARY', 'TABLE', 'VIEW', 'NAMED COLLECTION'}
def strtodate_sql(self, expression: sqlglot.expressions.StrToDate) -> str:
856        def strtodate_sql(self, expression: exp.StrToDate) -> str:
857            strtodate_sql = self.function_fallback_sql(expression)
858
859            if not isinstance(expression.parent, exp.Cast):
860                # StrToDate returns DATEs in other dialects (eg. postgres), so
861                # this branch aims to improve the transpilation to clickhouse
862                return f"CAST({strtodate_sql} AS DATE)"
863
864            return strtodate_sql
def cast_sql( self, expression: sqlglot.expressions.Cast, safe_prefix: Optional[str] = None) -> str:
866        def cast_sql(self, expression: exp.Cast, safe_prefix: t.Optional[str] = None) -> str:
867            this = expression.this
868
869            if isinstance(this, exp.StrToDate) and expression.to == exp.DataType.build("datetime"):
870                return self.sql(this)
871
872            return super().cast_sql(expression, safe_prefix=safe_prefix)
def likeproperty_sql(self, expression: sqlglot.expressions.LikeProperty) -> str:
878        def likeproperty_sql(self, expression: exp.LikeProperty) -> str:
879            return f"AS {self.sql(expression, 'this')}"
def eq_sql(self, expression: sqlglot.expressions.EQ) -> str:
898        def eq_sql(self, expression: exp.EQ) -> str:
899            return self._any_to_has(expression, super().eq_sql)
def neq_sql(self, expression: sqlglot.expressions.NEQ) -> str:
901        def neq_sql(self, expression: exp.NEQ) -> str:
902            return self._any_to_has(expression, super().neq_sql, "NOT ")
def regexpilike_sql(self, expression: sqlglot.expressions.RegexpILike) -> str:
904        def regexpilike_sql(self, expression: exp.RegexpILike) -> str:
905            # Manually add a flag to make the search case-insensitive
906            regex = self.func("CONCAT", "'(?i)'", expression.expression)
907            return self.func("match", expression.this, regex)
def datatype_sql(self, expression: sqlglot.expressions.DataType) -> str:
909        def datatype_sql(self, expression: exp.DataType) -> str:
910            # String is the standard ClickHouse type, every other variant is just an alias.
911            # Additionally, any supplied length parameter will be ignored.
912            #
913            # https://clickhouse.com/docs/en/sql-reference/data-types/string
914            if expression.this in self.STRING_TYPE_MAPPING:
915                return "String"
916
917            return super().datatype_sql(expression)
def cte_sql(self, expression: sqlglot.expressions.CTE) -> str:
919        def cte_sql(self, expression: exp.CTE) -> str:
920            if expression.args.get("scalar"):
921                this = self.sql(expression, "this")
922                alias = self.sql(expression, "alias")
923                return f"{this} AS {alias}"
924
925            return super().cte_sql(expression)
def after_limit_modifiers(self, expression: sqlglot.expressions.Expression) -> List[str]:
927        def after_limit_modifiers(self, expression: exp.Expression) -> t.List[str]:
928            return super().after_limit_modifiers(expression) + [
929                (
930                    self.seg("SETTINGS ") + self.expressions(expression, key="settings", flat=True)
931                    if expression.args.get("settings")
932                    else ""
933                ),
934                (
935                    self.seg("FORMAT ") + self.sql(expression, "format")
936                    if expression.args.get("format")
937                    else ""
938                ),
939            ]
def parameterizedagg_sql(self, expression: sqlglot.expressions.ParameterizedAgg) -> str:
941        def parameterizedagg_sql(self, expression: exp.ParameterizedAgg) -> str:
942            params = self.expressions(expression, key="params", flat=True)
943            return self.func(expression.name, *expression.expressions) + f"({params})"
def anonymousaggfunc_sql(self, expression: sqlglot.expressions.AnonymousAggFunc) -> str:
945        def anonymousaggfunc_sql(self, expression: exp.AnonymousAggFunc) -> str:
946            return self.func(expression.name, *expression.expressions)
def combinedaggfunc_sql(self, expression: sqlglot.expressions.CombinedAggFunc) -> str:
948        def combinedaggfunc_sql(self, expression: exp.CombinedAggFunc) -> str:
949            return self.anonymousaggfunc_sql(expression)
def combinedparameterizedagg_sql(self, expression: sqlglot.expressions.CombinedParameterizedAgg) -> str:
951        def combinedparameterizedagg_sql(self, expression: exp.CombinedParameterizedAgg) -> str:
952            return self.parameterizedagg_sql(expression)
def placeholder_sql(self, expression: sqlglot.expressions.Placeholder) -> str:
954        def placeholder_sql(self, expression: exp.Placeholder) -> str:
955            return f"{{{expression.name}: {self.sql(expression, 'kind')}}}"
def oncluster_sql(self, expression: sqlglot.expressions.OnCluster) -> str:
957        def oncluster_sql(self, expression: exp.OnCluster) -> str:
958            return f"ON CLUSTER {self.sql(expression, 'this')}"
def createable_sql( self, expression: sqlglot.expressions.Create, locations: DefaultDict) -> str:
960        def createable_sql(self, expression: exp.Create, locations: t.DefaultDict) -> str:
961            if expression.kind in self.ON_CLUSTER_TARGETS and locations.get(
962                exp.Properties.Location.POST_NAME
963            ):
964                this_name = self.sql(expression.this, "this")
965                this_properties = " ".join(
966                    [self.sql(prop) for prop in locations[exp.Properties.Location.POST_NAME]]
967                )
968                this_schema = self.schema_columns_sql(expression.this)
969                return f"{this_name}{self.sep()}{this_properties}{self.sep()}{this_schema}"
970
971            return super().createable_sql(expression, locations)
def prewhere_sql(self, expression: sqlglot.expressions.PreWhere) -> str:
973        def prewhere_sql(self, expression: exp.PreWhere) -> str:
974            this = self.indent(self.sql(expression, "this"))
975            return f"{self.seg('PREWHERE')}{self.sep()}{this}"
def indexcolumnconstraint_sql(self, expression: sqlglot.expressions.IndexColumnConstraint) -> str:
977        def indexcolumnconstraint_sql(self, expression: exp.IndexColumnConstraint) -> str:
978            this = self.sql(expression, "this")
979            this = f" {this}" if this else ""
980            expr = self.sql(expression, "expression")
981            expr = f" {expr}" if expr else ""
982            index_type = self.sql(expression, "index_type")
983            index_type = f" TYPE {index_type}" if index_type else ""
984            granularity = self.sql(expression, "granularity")
985            granularity = f" GRANULARITY {granularity}" if granularity else ""
986
987            return f"INDEX{this}{expr}{index_type}{granularity}"
def partition_sql(self, expression: sqlglot.expressions.Partition) -> str:
989        def partition_sql(self, expression: exp.Partition) -> str:
990            return f"PARTITION {self.expressions(expression, flat=True)}"
def partitionid_sql(self, expression: sqlglot.expressions.PartitionId) -> str:
992        def partitionid_sql(self, expression: exp.PartitionId) -> str:
993            return f"ID {self.sql(expression.this)}"
def replacepartition_sql(self, expression: sqlglot.expressions.ReplacePartition) -> str:
995        def replacepartition_sql(self, expression: exp.ReplacePartition) -> str:
996            return (
997                f"REPLACE {self.sql(expression.expression)} FROM {self.sql(expression, 'source')}"
998            )
def projectiondef_sql(self, expression: sqlglot.expressions.ProjectionDef) -> str:
1000        def projectiondef_sql(self, expression: exp.ProjectionDef) -> str:
1001            return f"PROJECTION {self.sql(expression.this)} {self.wrap(expression.expression)}"
SELECT_KINDS: Tuple[str, ...] = ()
TRY_SUPPORTED = False
SUPPORTS_UESCAPE = False
AFTER_HAVING_MODIFIER_TRANSFORMS = {'windows': <function Generator.<lambda>>, 'qualify': <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
EXTRACT_ALLOWS_QUOTES
TZ_TO_WITH_TIME_ZONE
ALTER_TABLE_INCLUDE_COLUMN_KEYWORD
UNNEST_WITH_ORDINALITY
AGGREGATE_FILTER_SUPPORTED
SEMI_ANTI_JOIN_WITH_SIDE
COMPUTED_COLUMN_WITH_TYPE
SUPPORTS_TABLE_COPY
TABLESAMPLE_WITH_METHOD
TABLESAMPLE_SEED_KEYWORD
COLLATE_IS_FUNC
DATA_TYPE_SPECIFIERS_ALLOWED
ENSURE_BOOLS
CTE_RECURSIVE_KEYWORD_REQUIRED
SUPPORTS_SINGLE_ARG_CONCAT
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_EXCEPT
HEX_FUNC
WITH_PROPERTIES_PREFIX
QUOTE_JSON_PATH
PAD_FILL_PATTERN_IS_REQUIRED
SUPPORTS_EXPLODING_PROJECTIONS
ARRAY_CONCAT_IS_VAR_LEN
SUPPORTS_CONVERT_TIMEZONE
PARSE_JSON_NAME
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
hex_sql
lowerhex_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
options_modifier
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
currentdate_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
alterset_sql
alter_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
struct_sql
partitionrange_sql
truncatetable_sql
convert_sql
copyparameter_sql
credentials_sql
copy_sql
semicolon_sql
datadeletionproperty_sql
maskingpolicycolumnconstraint_sql
gapfill_sql
scope_resolution
scoperesolution_sql
parsejson_sql
rand_sql
changes_sql
pad_sql
summarize_sql
explodinggenerateseries_sql
arrayconcat_sql
converttimezone_sql