Edit on GitHub

sqlglot.dialects.clickhouse

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

CREATABLE_KIND_MAPPING = {'DATABASE': 'SCHEMA'}

Helper for dialects that use a different name for the same creatable kind. For example, the Clickhouse equivalent of CREATE SCHEMA is CREATE DATABASE.

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 = {}
INVERSE_CREATABLE_KIND_MAPPING: dict[str, str] = {'SCHEMA': 'DATABASE'}
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):
150    class Tokenizer(tokens.Tokenizer):
151        COMMENTS = ["--", "#", "#!", ("/*", "*/")]
152        IDENTIFIERS = ['"', "`"]
153        STRING_ESCAPES = ["'", "\\"]
154        BIT_STRINGS = [("0b", "")]
155        HEX_STRINGS = [("0x", ""), ("0X", "")]
156        HEREDOC_STRINGS = ["$"]
157
158        KEYWORDS = {
159            **tokens.Tokenizer.KEYWORDS,
160            "ATTACH": TokenType.COMMAND,
161            "DATE32": TokenType.DATE32,
162            "DATETIME64": TokenType.DATETIME64,
163            "DICTIONARY": TokenType.DICTIONARY,
164            "ENUM8": TokenType.ENUM8,
165            "ENUM16": TokenType.ENUM16,
166            "FINAL": TokenType.FINAL,
167            "FIXEDSTRING": TokenType.FIXEDSTRING,
168            "FLOAT32": TokenType.FLOAT,
169            "FLOAT64": TokenType.DOUBLE,
170            "GLOBAL": TokenType.GLOBAL,
171            "INT256": TokenType.INT256,
172            "LOWCARDINALITY": TokenType.LOWCARDINALITY,
173            "MAP": TokenType.MAP,
174            "NESTED": TokenType.NESTED,
175            "SAMPLE": TokenType.TABLE_SAMPLE,
176            "TUPLE": TokenType.STRUCT,
177            "UINT128": TokenType.UINT128,
178            "UINT16": TokenType.USMALLINT,
179            "UINT256": TokenType.UINT256,
180            "UINT32": TokenType.UINT,
181            "UINT64": TokenType.UBIGINT,
182            "UINT8": TokenType.UTINYINT,
183            "IPV4": TokenType.IPV4,
184            "IPV6": TokenType.IPV6,
185            "AGGREGATEFUNCTION": TokenType.AGGREGATEFUNCTION,
186            "SIMPLEAGGREGATEFUNCTION": TokenType.SIMPLEAGGREGATEFUNCTION,
187            "SYSTEM": TokenType.COMMAND,
188            "PREWHERE": TokenType.PREWHERE,
189        }
190        KEYWORDS.pop("/*+")
191
192        SINGLE_TOKENS = {
193            **tokens.Tokenizer.SINGLE_TOKENS,
194            "$": TokenType.HEREDOC_STRING,
195        }
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):
197    class Parser(parser.Parser):
198        # Tested in ClickHouse's playground, it seems that the following two queries do the same thing
199        # * select x from t1 union all select x from t2 limit 1;
200        # * select x from t1 union all (select x from t2 limit 1);
201        MODIFIERS_ATTACHED_TO_SET_OP = False
202        INTERVAL_SPANS = False
203
204        FUNCTIONS = {
205            **parser.Parser.FUNCTIONS,
206            "ANY": exp.AnyValue.from_arg_list,
207            "ARRAYSUM": exp.ArraySum.from_arg_list,
208            "COUNTIF": _build_count_if,
209            "DATE_ADD": build_date_delta(exp.DateAdd, default_unit=None),
210            "DATEADD": build_date_delta(exp.DateAdd, default_unit=None),
211            "DATE_DIFF": build_date_delta(exp.DateDiff, default_unit=None),
212            "DATEDIFF": build_date_delta(exp.DateDiff, default_unit=None),
213            "DATE_FORMAT": _build_date_format,
214            "DATE_SUB": build_date_delta(exp.DateSub, default_unit=None),
215            "DATESUB": build_date_delta(exp.DateSub, default_unit=None),
216            "FORMATDATETIME": _build_date_format,
217            "JSONEXTRACTSTRING": build_json_extract_path(
218                exp.JSONExtractScalar, zero_based_indexing=False
219            ),
220            "MAP": parser.build_var_map,
221            "MATCH": exp.RegexpLike.from_arg_list,
222            "RANDCANONICAL": exp.Rand.from_arg_list,
223            "STR_TO_DATE": _build_str_to_date,
224            "TUPLE": exp.Struct.from_arg_list,
225            "TIMESTAMP_SUB": build_date_delta(exp.TimestampSub, default_unit=None),
226            "TIMESTAMPSUB": build_date_delta(exp.TimestampSub, default_unit=None),
227            "TIMESTAMP_ADD": build_date_delta(exp.TimestampAdd, default_unit=None),
228            "TIMESTAMPADD": build_date_delta(exp.TimestampAdd, default_unit=None),
229            "UNIQ": exp.ApproxDistinct.from_arg_list,
230            "XOR": lambda args: exp.Xor(expressions=args),
231            "MD5": exp.MD5Digest.from_arg_list,
232            "SHA256": lambda args: exp.SHA2(this=seq_get(args, 0), length=exp.Literal.number(256)),
233            "SHA512": lambda args: exp.SHA2(this=seq_get(args, 0), length=exp.Literal.number(512)),
234        }
235
236        AGG_FUNCTIONS = {
237            "count",
238            "min",
239            "max",
240            "sum",
241            "avg",
242            "any",
243            "stddevPop",
244            "stddevSamp",
245            "varPop",
246            "varSamp",
247            "corr",
248            "covarPop",
249            "covarSamp",
250            "entropy",
251            "exponentialMovingAverage",
252            "intervalLengthSum",
253            "kolmogorovSmirnovTest",
254            "mannWhitneyUTest",
255            "median",
256            "rankCorr",
257            "sumKahan",
258            "studentTTest",
259            "welchTTest",
260            "anyHeavy",
261            "anyLast",
262            "boundingRatio",
263            "first_value",
264            "last_value",
265            "argMin",
266            "argMax",
267            "avgWeighted",
268            "topK",
269            "topKWeighted",
270            "deltaSum",
271            "deltaSumTimestamp",
272            "groupArray",
273            "groupArrayLast",
274            "groupUniqArray",
275            "groupArrayInsertAt",
276            "groupArrayMovingAvg",
277            "groupArrayMovingSum",
278            "groupArraySample",
279            "groupBitAnd",
280            "groupBitOr",
281            "groupBitXor",
282            "groupBitmap",
283            "groupBitmapAnd",
284            "groupBitmapOr",
285            "groupBitmapXor",
286            "sumWithOverflow",
287            "sumMap",
288            "minMap",
289            "maxMap",
290            "skewSamp",
291            "skewPop",
292            "kurtSamp",
293            "kurtPop",
294            "uniq",
295            "uniqExact",
296            "uniqCombined",
297            "uniqCombined64",
298            "uniqHLL12",
299            "uniqTheta",
300            "quantile",
301            "quantiles",
302            "quantileExact",
303            "quantilesExact",
304            "quantileExactLow",
305            "quantilesExactLow",
306            "quantileExactHigh",
307            "quantilesExactHigh",
308            "quantileExactWeighted",
309            "quantilesExactWeighted",
310            "quantileTiming",
311            "quantilesTiming",
312            "quantileTimingWeighted",
313            "quantilesTimingWeighted",
314            "quantileDeterministic",
315            "quantilesDeterministic",
316            "quantileTDigest",
317            "quantilesTDigest",
318            "quantileTDigestWeighted",
319            "quantilesTDigestWeighted",
320            "quantileBFloat16",
321            "quantilesBFloat16",
322            "quantileBFloat16Weighted",
323            "quantilesBFloat16Weighted",
324            "simpleLinearRegression",
325            "stochasticLinearRegression",
326            "stochasticLogisticRegression",
327            "categoricalInformationValue",
328            "contingency",
329            "cramersV",
330            "cramersVBiasCorrected",
331            "theilsU",
332            "maxIntersections",
333            "maxIntersectionsPosition",
334            "meanZTest",
335            "quantileInterpolatedWeighted",
336            "quantilesInterpolatedWeighted",
337            "quantileGK",
338            "quantilesGK",
339            "sparkBar",
340            "sumCount",
341            "largestTriangleThreeBuckets",
342            "histogram",
343            "sequenceMatch",
344            "sequenceCount",
345            "windowFunnel",
346            "retention",
347            "uniqUpTo",
348            "sequenceNextNode",
349            "exponentialTimeDecayedAvg",
350        }
351
352        AGG_FUNCTIONS_SUFFIXES = [
353            "If",
354            "Array",
355            "ArrayIf",
356            "Map",
357            "SimpleState",
358            "State",
359            "Merge",
360            "MergeState",
361            "ForEach",
362            "Distinct",
363            "OrDefault",
364            "OrNull",
365            "Resample",
366            "ArgMin",
367            "ArgMax",
368        ]
369
370        FUNC_TOKENS = {
371            *parser.Parser.FUNC_TOKENS,
372            TokenType.SET,
373        }
374
375        RESERVED_TOKENS = parser.Parser.RESERVED_TOKENS - {TokenType.SELECT}
376
377        ID_VAR_TOKENS = {
378            *parser.Parser.ID_VAR_TOKENS,
379            TokenType.LIKE,
380        }
381
382        AGG_FUNC_MAPPING = (
383            lambda functions, suffixes: {
384                f"{f}{sfx}": (f, sfx) for sfx in (suffixes + [""]) for f in functions
385            }
386        )(AGG_FUNCTIONS, AGG_FUNCTIONS_SUFFIXES)
387
388        FUNCTIONS_WITH_ALIASED_ARGS = {*parser.Parser.FUNCTIONS_WITH_ALIASED_ARGS, "TUPLE"}
389
390        FUNCTION_PARSERS = {
391            **parser.Parser.FUNCTION_PARSERS,
392            "ARRAYJOIN": lambda self: self.expression(exp.Explode, this=self._parse_expression()),
393            "QUANTILE": lambda self: self._parse_quantile(),
394        }
395
396        FUNCTION_PARSERS.pop("MATCH")
397
398        NO_PAREN_FUNCTION_PARSERS = parser.Parser.NO_PAREN_FUNCTION_PARSERS.copy()
399        NO_PAREN_FUNCTION_PARSERS.pop("ANY")
400
401        RANGE_PARSERS = {
402            **parser.Parser.RANGE_PARSERS,
403            TokenType.GLOBAL: lambda self, this: self._match(TokenType.IN)
404            and self._parse_in(this, is_global=True),
405        }
406
407        # The PLACEHOLDER entry is popped because 1) it doesn't affect Clickhouse (it corresponds to
408        # the postgres-specific JSONBContains parser) and 2) it makes parsing the ternary op simpler.
409        COLUMN_OPERATORS = parser.Parser.COLUMN_OPERATORS.copy()
410        COLUMN_OPERATORS.pop(TokenType.PLACEHOLDER)
411
412        JOIN_KINDS = {
413            *parser.Parser.JOIN_KINDS,
414            TokenType.ANY,
415            TokenType.ASOF,
416            TokenType.ARRAY,
417        }
418
419        TABLE_ALIAS_TOKENS = parser.Parser.TABLE_ALIAS_TOKENS - {
420            TokenType.ANY,
421            TokenType.ARRAY,
422            TokenType.FINAL,
423            TokenType.FORMAT,
424            TokenType.SETTINGS,
425        }
426
427        ALIAS_TOKENS = parser.Parser.ALIAS_TOKENS - {
428            TokenType.FORMAT,
429        }
430
431        LOG_DEFAULTS_TO_LN = True
432
433        QUERY_MODIFIER_PARSERS = {
434            **parser.Parser.QUERY_MODIFIER_PARSERS,
435            TokenType.SETTINGS: lambda self: (
436                "settings",
437                self._advance() or self._parse_csv(self._parse_assignment),
438            ),
439            TokenType.FORMAT: lambda self: ("format", self._advance() or self._parse_id_var()),
440        }
441
442        CONSTRAINT_PARSERS = {
443            **parser.Parser.CONSTRAINT_PARSERS,
444            "INDEX": lambda self: self._parse_index_constraint(),
445            "CODEC": lambda self: self._parse_compress(),
446        }
447
448        ALTER_PARSERS = {
449            **parser.Parser.ALTER_PARSERS,
450            "REPLACE": lambda self: self._parse_alter_table_replace(),
451        }
452
453        SCHEMA_UNNAMED_CONSTRAINTS = {
454            *parser.Parser.SCHEMA_UNNAMED_CONSTRAINTS,
455            "INDEX",
456        }
457
458        PLACEHOLDER_PARSERS = {
459            **parser.Parser.PLACEHOLDER_PARSERS,
460            TokenType.L_BRACE: lambda self: self._parse_query_parameter(),
461        }
462
463        def _parse_types(
464            self, check_func: bool = False, schema: bool = False, allow_identifiers: bool = True
465        ) -> t.Optional[exp.Expression]:
466            dtype = super()._parse_types(
467                check_func=check_func, schema=schema, allow_identifiers=allow_identifiers
468            )
469            if isinstance(dtype, exp.DataType):
470                # Mark every type as non-nullable which is ClickHouse's default. This marker
471                # helps us transpile types from other dialects to ClickHouse, so that we can
472                # e.g. produce `CAST(x AS Nullable(String))` from `CAST(x AS TEXT)`. If there
473                # is a `NULL` value in `x`, the former would fail in ClickHouse without the
474                # `Nullable` type constructor
475                dtype.set("nullable", False)
476
477            return dtype
478
479        def _parse_extract(self) -> exp.Extract | exp.Anonymous:
480            index = self._index
481            this = self._parse_bitwise()
482            if self._match(TokenType.FROM):
483                self._retreat(index)
484                return super()._parse_extract()
485
486            # We return Anonymous here because extract and regexpExtract have different semantics,
487            # so parsing extract(foo, bar) into RegexpExtract can potentially break queries. E.g.,
488            # `extract('foobar', 'b')` works, but ClickHouse crashes for `regexpExtract('foobar', 'b')`.
489            #
490            # TODO: can we somehow convert the former into an equivalent `regexpExtract` call?
491            self._match(TokenType.COMMA)
492            return self.expression(
493                exp.Anonymous, this="extract", expressions=[this, self._parse_bitwise()]
494            )
495
496        def _parse_assignment(self) -> t.Optional[exp.Expression]:
497            this = super()._parse_assignment()
498
499            if self._match(TokenType.PLACEHOLDER):
500                return self.expression(
501                    exp.If,
502                    this=this,
503                    true=self._parse_assignment(),
504                    false=self._match(TokenType.COLON) and self._parse_assignment(),
505                )
506
507            return this
508
509        def _parse_query_parameter(self) -> t.Optional[exp.Expression]:
510            """
511            Parse a placeholder expression like SELECT {abc: UInt32} or FROM {table: Identifier}
512            https://clickhouse.com/docs/en/sql-reference/syntax#defining-and-using-query-parameters
513            """
514            this = self._parse_id_var()
515            self._match(TokenType.COLON)
516            kind = self._parse_types(check_func=False, allow_identifiers=False) or (
517                self._match_text_seq("IDENTIFIER") and "Identifier"
518            )
519
520            if not kind:
521                self.raise_error("Expecting a placeholder type or 'Identifier' for tables")
522            elif not self._match(TokenType.R_BRACE):
523                self.raise_error("Expecting }")
524
525            return self.expression(exp.Placeholder, this=this, kind=kind)
526
527        def _parse_in(self, this: t.Optional[exp.Expression], is_global: bool = False) -> exp.In:
528            this = super()._parse_in(this)
529            this.set("is_global", is_global)
530            return this
531
532        def _parse_table(
533            self,
534            schema: bool = False,
535            joins: bool = False,
536            alias_tokens: t.Optional[t.Collection[TokenType]] = None,
537            parse_bracket: bool = False,
538            is_db_reference: bool = False,
539            parse_partition: bool = False,
540        ) -> t.Optional[exp.Expression]:
541            this = super()._parse_table(
542                schema=schema,
543                joins=joins,
544                alias_tokens=alias_tokens,
545                parse_bracket=parse_bracket,
546                is_db_reference=is_db_reference,
547            )
548
549            if self._match(TokenType.FINAL):
550                this = self.expression(exp.Final, this=this)
551
552            return this
553
554        def _parse_position(self, haystack_first: bool = False) -> exp.StrPosition:
555            return super()._parse_position(haystack_first=True)
556
557        # https://clickhouse.com/docs/en/sql-reference/statements/select/with/
558        def _parse_cte(self) -> exp.CTE:
559            # WITH <identifier> AS <subquery expression>
560            cte: t.Optional[exp.CTE] = self._try_parse(super()._parse_cte)
561
562            if not cte:
563                # WITH <expression> AS <identifier>
564                cte = self.expression(
565                    exp.CTE,
566                    this=self._parse_assignment(),
567                    alias=self._parse_table_alias(),
568                    scalar=True,
569                )
570
571            return cte
572
573        def _parse_join_parts(
574            self,
575        ) -> t.Tuple[t.Optional[Token], t.Optional[Token], t.Optional[Token]]:
576            is_global = self._match(TokenType.GLOBAL) and self._prev
577            kind_pre = self._match_set(self.JOIN_KINDS, advance=False) and self._prev
578
579            if kind_pre:
580                kind = self._match_set(self.JOIN_KINDS) and self._prev
581                side = self._match_set(self.JOIN_SIDES) and self._prev
582                return is_global, side, kind
583
584            return (
585                is_global,
586                self._match_set(self.JOIN_SIDES) and self._prev,
587                self._match_set(self.JOIN_KINDS) and self._prev,
588            )
589
590        def _parse_join(
591            self, skip_join_token: bool = False, parse_bracket: bool = False
592        ) -> t.Optional[exp.Join]:
593            join = super()._parse_join(skip_join_token=skip_join_token, parse_bracket=True)
594            if join:
595                join.set("global", join.args.pop("method", None))
596
597            return join
598
599        def _parse_function(
600            self,
601            functions: t.Optional[t.Dict[str, t.Callable]] = None,
602            anonymous: bool = False,
603            optional_parens: bool = True,
604            any_token: bool = False,
605        ) -> t.Optional[exp.Expression]:
606            expr = super()._parse_function(
607                functions=functions,
608                anonymous=anonymous,
609                optional_parens=optional_parens,
610                any_token=any_token,
611            )
612
613            func = expr.this if isinstance(expr, exp.Window) else expr
614
615            # Aggregate functions can be split in 2 parts: <func_name><suffix>
616            parts = (
617                self.AGG_FUNC_MAPPING.get(func.this) if isinstance(func, exp.Anonymous) else None
618            )
619
620            if parts:
621                params = self._parse_func_params(func)
622
623                kwargs = {
624                    "this": func.this,
625                    "expressions": func.expressions,
626                }
627                if parts[1]:
628                    kwargs["parts"] = parts
629                    exp_class = exp.CombinedParameterizedAgg if params else exp.CombinedAggFunc
630                else:
631                    exp_class = exp.ParameterizedAgg if params else exp.AnonymousAggFunc
632
633                kwargs["exp_class"] = exp_class
634                if params:
635                    kwargs["params"] = params
636
637                func = self.expression(**kwargs)
638
639                if isinstance(expr, exp.Window):
640                    # The window's func was parsed as Anonymous in base parser, fix its
641                    # type to be ClickHouse style CombinedAnonymousAggFunc / AnonymousAggFunc
642                    expr.set("this", func)
643                elif params:
644                    # Params have blocked super()._parse_function() from parsing the following window
645                    # (if that exists) as they're standing between the function call and the window spec
646                    expr = self._parse_window(func)
647                else:
648                    expr = func
649
650            return expr
651
652        def _parse_func_params(
653            self, this: t.Optional[exp.Func] = None
654        ) -> t.Optional[t.List[exp.Expression]]:
655            if self._match_pair(TokenType.R_PAREN, TokenType.L_PAREN):
656                return self._parse_csv(self._parse_lambda)
657
658            if self._match(TokenType.L_PAREN):
659                params = self._parse_csv(self._parse_lambda)
660                self._match_r_paren(this)
661                return params
662
663            return None
664
665        def _parse_quantile(self) -> exp.Quantile:
666            this = self._parse_lambda()
667            params = self._parse_func_params()
668            if params:
669                return self.expression(exp.Quantile, this=params[0], quantile=this)
670            return self.expression(exp.Quantile, this=this, quantile=exp.Literal.number(0.5))
671
672        def _parse_wrapped_id_vars(self, optional: bool = False) -> t.List[exp.Expression]:
673            return super()._parse_wrapped_id_vars(optional=True)
674
675        def _parse_primary_key(
676            self, wrapped_optional: bool = False, in_props: bool = False
677        ) -> exp.PrimaryKeyColumnConstraint | exp.PrimaryKey:
678            return super()._parse_primary_key(
679                wrapped_optional=wrapped_optional or in_props, in_props=in_props
680            )
681
682        def _parse_on_property(self) -> t.Optional[exp.Expression]:
683            index = self._index
684            if self._match_text_seq("CLUSTER"):
685                this = self._parse_id_var()
686                if this:
687                    return self.expression(exp.OnCluster, this=this)
688                else:
689                    self._retreat(index)
690            return None
691
692        def _parse_index_constraint(
693            self, kind: t.Optional[str] = None
694        ) -> exp.IndexColumnConstraint:
695            # INDEX name1 expr TYPE type1(args) GRANULARITY value
696            this = self._parse_id_var()
697            expression = self._parse_assignment()
698
699            index_type = self._match_text_seq("TYPE") and (
700                self._parse_function() or self._parse_var()
701            )
702
703            granularity = self._match_text_seq("GRANULARITY") and self._parse_term()
704
705            return self.expression(
706                exp.IndexColumnConstraint,
707                this=this,
708                expression=expression,
709                index_type=index_type,
710                granularity=granularity,
711            )
712
713        def _parse_partition(self) -> t.Optional[exp.Partition]:
714            # https://clickhouse.com/docs/en/sql-reference/statements/alter/partition#how-to-set-partition-expression
715            if not self._match(TokenType.PARTITION):
716                return None
717
718            if self._match_text_seq("ID"):
719                # Corresponds to the PARTITION ID <string_value> syntax
720                expressions: t.List[exp.Expression] = [
721                    self.expression(exp.PartitionId, this=self._parse_string())
722                ]
723            else:
724                expressions = self._parse_expressions()
725
726            return self.expression(exp.Partition, expressions=expressions)
727
728        def _parse_alter_table_replace(self) -> t.Optional[exp.Expression]:
729            partition = self._parse_partition()
730
731            if not partition or not self._match(TokenType.FROM):
732                return None
733
734            return self.expression(
735                exp.ReplacePartition, expression=partition, source=self._parse_table_parts()
736            )
737
738        def _parse_projection_def(self) -> t.Optional[exp.ProjectionDef]:
739            if not self._match_text_seq("PROJECTION"):
740                return None
741
742            return self.expression(
743                exp.ProjectionDef,
744                this=self._parse_id_var(),
745                expression=self._parse_wrapped(self._parse_statement),
746            )
747
748        def _parse_constraint(self) -> t.Optional[exp.Expression]:
749            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': <function Parser.<lambda>>, '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'>>, 'FROM_ISO8601_TIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FromISO8601Timestamp'>>, 'GAP_FILL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GapFill'>>, 'GENERATE_DATE_ARRAY': <function Parser.<lambda>>, 'GENERATE_SERIES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GenerateSeries'>>, 'GENERATE_TIMESTAMP_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GenerateTimestampArray'>>, '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>>, 'LTRIM': <function Parser.<lambda>>, 'MOD': <function build_mod>, 'RIGHTPAD': <function Parser.<lambda>>, 'RPAD': <function Parser.<lambda>>, 'RTRIM': <function Parser.<lambda>>, 'SCOPE_RESOLUTION': <function Parser.<lambda>>, '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 = {'contingency', 'deltaSumTimestamp', 'stochasticLogisticRegression', 'last_value', 'argMax', 'quantilesExactWeighted', 'uniq', 'sum', 'quantileTDigestWeighted', 'groupBitmapXor', 'cramersVBiasCorrected', 'largestTriangleThreeBuckets', 'varPop', 'kurtSamp', 'stddevPop', 'varSamp', 'groupArray', 'studentTTest', 'sequenceCount', 'intervalLengthSum', 'maxIntersections', 'meanZTest', 'sequenceMatch', 'retention', 'sequenceNextNode', 'skewSamp', 'quantilesExactHigh', 'uniqExact', 'kurtPop', 'sumCount', 'entropy', 'quantilesDeterministic', 'minMap', 'stochasticLinearRegression', 'theilsU', 'groupBitmapOr', 'quantilesBFloat16', 'histogram', 'groupBitAnd', 'quantileGK', 'quantileDeterministic', 'categoricalInformationValue', 'avg', 'groupUniqArray', 'maxIntersectionsPosition', 'exponentialTimeDecayedAvg', 'simpleLinearRegression', 'quantileTiming', 'sparkBar', 'anyLast', 'stddevSamp', 'quantilesTimingWeighted', 'cramersV', 'argMin', 'median', 'any', 'covarSamp', 'quantileExactHigh', 'min', 'sumMap', 'quantileBFloat16Weighted', 'maxMap', 'quantilesExactLow', 'groupArrayInsertAt', 'uniqUpTo', 'exponentialMovingAverage', 'count', 'groupBitmap', 'uniqHLL12', 'covarPop', 'welchTTest', 'quantileTDigest', 'avgWeighted', 'first_value', 'groupBitmapAnd', 'quantileBFloat16', 'quantilesGK', 'uniqCombined', 'quantilesBFloat16Weighted', 'uniqTheta', 'groupArraySample', 'quantilesInterpolatedWeighted', 'quantileExactWeighted', 'boundingRatio', 'quantilesExact', 'groupArrayMovingAvg', 'groupArrayLast', 'groupArrayMovingSum', 'quantilesTiming', 'quantileExact', 'quantileTimingWeighted', 'skewPop', 'sumKahan', 'quantileInterpolatedWeighted', 'rankCorr', 'kolmogorovSmirnovTest', 'topK', 'quantilesTDigestWeighted', 'quantile', 'quantileExactLow', 'groupBitXor', 'uniqCombined64', 'topKWeighted', 'groupBitOr', 'quantilesTDigest', 'deltaSum', 'quantiles', 'corr', 'mannWhitneyUTest', 'max', 'sumWithOverflow', 'anyHeavy', 'windowFunnel'}
AGG_FUNCTIONS_SUFFIXES = ['If', 'Array', 'ArrayIf', 'Map', 'SimpleState', 'State', 'Merge', 'MergeState', 'ForEach', 'Distinct', 'OrDefault', 'OrNull', 'Resample', 'ArgMin', 'ArgMax']
FUNC_TOKENS = {<TokenType.DATE32: 'DATE32'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.SET: 'SET'>, <TokenType.ROW: 'ROW'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.NAME: 'NAME'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.ILIKE: 'ILIKE'>, <TokenType.INET: 'INET'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.UINT: 'UINT'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.NULL: 'NULL'>, <TokenType.RLIKE: 'RLIKE'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.NESTED: 'NESTED'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.LIKE: 'LIKE'>, <TokenType.UUID: 'UUID'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.WINDOW: 'WINDOW'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.GLOB: 'GLOB'>, <TokenType.XML: 'XML'>, <TokenType.BIT: 'BIT'>, <TokenType.VAR: 'VAR'>, <TokenType.TIME: 'TIME'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.ANY: 'ANY'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.MERGE: 'MERGE'>, <TokenType.RANGE: 'RANGE'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.UNIQUEIDENTIFIER: 'UNIQUEIDENTIFIER'>, <TokenType.ALL: 'ALL'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.UINT128: 'UINT128'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.IPV6: 'IPV6'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.MAP: 'MAP'>, <TokenType.FILTER: 'FILTER'>, <TokenType.INT128: 'INT128'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.JSONB: 'JSONB'>, <TokenType.FIRST: 'FIRST'>, <TokenType.ENUM: 'ENUM'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.DATE: 'DATE'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.YEAR: 'YEAR'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.TABLE: 'TABLE'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.PRIMARY_KEY: 'PRIMARY_KEY'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.INT256: 'INT256'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.BINARY: 'BINARY'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.INDEX: 'INDEX'>, <TokenType.INSERT: 'INSERT'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.INT: 'INT'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.IPV4: 'IPV4'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.LEFT: 'LEFT'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.LIST: 'LIST'>, <TokenType.CHAR: 'CHAR'>, <TokenType.UINT256: 'UINT256'>, <TokenType.TEXT: 'TEXT'>, <TokenType.JSON: 'JSON'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.FORMAT: 'FORMAT'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.XOR: 'XOR'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.MONEY: 'MONEY'>, <TokenType.RIGHT: 'RIGHT'>, <TokenType.SUPER: 'SUPER'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.SOME: 'SOME'>}
RESERVED_TOKENS = {<TokenType.R_BRACKET: 'R_BRACKET'>, <TokenType.PIPE: 'PIPE'>, <TokenType.DASH: 'DASH'>, <TokenType.PARAMETER: 'PARAMETER'>, <TokenType.NOT: 'NOT'>, <TokenType.L_BRACKET: 'L_BRACKET'>, <TokenType.PLACEHOLDER: 'PLACEHOLDER'>, <TokenType.HASH: 'HASH'>, <TokenType.EQ: 'EQ'>, <TokenType.STAR: 'STAR'>, <TokenType.R_BRACE: 'R_BRACE'>, <TokenType.TILDA: 'TILDA'>, <TokenType.DOT: 'DOT'>, <TokenType.L_PAREN: 'L_PAREN'>, <TokenType.GT: 'GT'>, <TokenType.LT: 'LT'>, <TokenType.SEMICOLON: 'SEMICOLON'>, <TokenType.SLASH: 'SLASH'>, <TokenType.COLON: 'COLON'>, <TokenType.COMMA: 'COMMA'>, <TokenType.BACKSLASH: 'BACKSLASH'>, <TokenType.PLUS: 'PLUS'>, <TokenType.AMP: 'AMP'>, <TokenType.L_BRACE: 'L_BRACE'>, <TokenType.MOD: 'MOD'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.R_PAREN: 'R_PAREN'>, <TokenType.CARET: 'CARET'>}
ID_VAR_TOKENS = {<TokenType.PROCEDURE: 'PROCEDURE'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.DATE32: 'DATE32'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.ORDINALITY: 'ORDINALITY'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.SET: 'SET'>, <TokenType.ROW: 'ROW'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.NAME: 'NAME'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.UNIQUE: 'UNIQUE'>, <TokenType.KILL: 'KILL'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.STREAMLIT: 'STREAMLIT'>, <TokenType.INET: 'INET'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.ASOF: 'ASOF'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.UINT: 'UINT'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.DESC: 'DESC'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.SEMI: 'SEMI'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.CACHE: 'CACHE'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.NULL: 'NULL'>, <TokenType.TOP: 'TOP'>, <TokenType.CASE: 'CASE'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.NESTED: 'NESTED'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.UUID: 'UUID'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.TRUE: 'TRUE'>, <TokenType.ROWS: 'ROWS'>, <TokenType.WINDOW: 'WINDOW'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.LIKE: 'LIKE'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.XML: 'XML'>, <TokenType.BIT: 'BIT'>, <TokenType.VAR: 'VAR'>, <TokenType.TIME: 'TIME'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.ANY: 'ANY'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.MERGE: 'MERGE'>, <TokenType.RANGE: 'RANGE'>, <TokenType.LOAD: 'LOAD'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.UNIQUEIDENTIFIER: 'UNIQUEIDENTIFIER'>, <TokenType.ALL: 'ALL'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.UINT128: 'UINT128'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.COPY: 'COPY'>, <TokenType.IPV6: 'IPV6'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.ASC: 'ASC'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.TAG: 'TAG'>, <TokenType.VIEW: 'VIEW'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.DIV: 'DIV'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.REFERENCES: 'REFERENCES'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.APPLY: 'APPLY'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.CUBE: 'CUBE'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.MAP: 'MAP'>, <TokenType.FILTER: 'FILTER'>, <TokenType.INT128: 'INT128'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.JSONB: 'JSONB'>, <TokenType.DELETE: 'DELETE'>, <TokenType.FIRST: 'FIRST'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.ENUM: 'ENUM'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.STORAGE_INTEGRATION: 'STORAGE_INTEGRATION'>, <TokenType.NEXT: 'NEXT'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.DATE: 'DATE'>, <TokenType.YEAR: 'YEAR'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.TABLE: 'TABLE'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.STRAIGHT_JOIN: 'STRAIGHT_JOIN'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.FINAL: 'FINAL'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.INT256: 'INT256'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.BINARY: 'BINARY'>, <TokenType.INDEX: 'INDEX'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.FULL: 'FULL'>, <TokenType.IS: 'IS'>, <TokenType.ROLLUP: 'ROLLUP'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.SHOW: 'SHOW'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.INT: 'INT'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.NATURAL: 'NATURAL'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.IPV4: 'IPV4'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.RENAME: 'RENAME'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.USE: 'USE'>, <TokenType.LEFT: 'LEFT'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.LIST: 'LIST'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.CHAR: 'CHAR'>, <TokenType.KEEP: 'KEEP'>, <TokenType.UINT256: 'UINT256'>, <TokenType.TEXT: 'TEXT'>, <TokenType.ANTI: 'ANTI'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.JSON: 'JSON'>, <TokenType.WAREHOUSE: 'WAREHOUSE'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.END: 'END'>, <TokenType.FORMAT: 'FORMAT'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.MODEL: 'MODEL'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.FALSE: 'FALSE'>, <TokenType.SETTINGS: 'SETTINGS'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.MONEY: 'MONEY'>, <TokenType.RIGHT: 'RIGHT'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.SUPER: 'SUPER'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.SOME: 'SOME'>}
AGG_FUNC_MAPPING = {'contingencyIf': ('contingency', 'If'), 'deltaSumTimestampIf': ('deltaSumTimestamp', 'If'), 'stochasticLogisticRegressionIf': ('stochasticLogisticRegression', 'If'), 'last_valueIf': ('last_value', 'If'), 'argMaxIf': ('argMax', 'If'), 'quantilesExactWeightedIf': ('quantilesExactWeighted', 'If'), 'uniqIf': ('uniq', 'If'), 'sumIf': ('sum', 'If'), 'quantileTDigestWeightedIf': ('quantileTDigestWeighted', 'If'), 'groupBitmapXorIf': ('groupBitmapXor', 'If'), 'cramersVBiasCorrectedIf': ('cramersVBiasCorrected', 'If'), 'largestTriangleThreeBucketsIf': ('largestTriangleThreeBuckets', 'If'), 'varPopIf': ('varPop', 'If'), 'kurtSampIf': ('kurtSamp', 'If'), 'stddevPopIf': ('stddevPop', 'If'), 'varSampIf': ('varSamp', 'If'), 'groupArrayIf': ('groupArray', 'If'), 'studentTTestIf': ('studentTTest', 'If'), 'sequenceCountIf': ('sequenceCount', 'If'), 'intervalLengthSumIf': ('intervalLengthSum', 'If'), 'maxIntersectionsIf': ('maxIntersections', 'If'), 'meanZTestIf': ('meanZTest', 'If'), 'sequenceMatchIf': ('sequenceMatch', 'If'), 'retentionIf': ('retention', 'If'), 'sequenceNextNodeIf': ('sequenceNextNode', 'If'), 'skewSampIf': ('skewSamp', 'If'), 'quantilesExactHighIf': ('quantilesExactHigh', 'If'), 'uniqExactIf': ('uniqExact', 'If'), 'kurtPopIf': ('kurtPop', 'If'), 'sumCountIf': ('sumCount', 'If'), 'entropyIf': ('entropy', 'If'), 'quantilesDeterministicIf': ('quantilesDeterministic', 'If'), 'minMapIf': ('minMap', 'If'), 'stochasticLinearRegressionIf': ('stochasticLinearRegression', 'If'), 'theilsUIf': ('theilsU', 'If'), 'groupBitmapOrIf': ('groupBitmapOr', 'If'), 'quantilesBFloat16If': ('quantilesBFloat16', 'If'), 'histogramIf': ('histogram', 'If'), 'groupBitAndIf': ('groupBitAnd', 'If'), 'quantileGKIf': ('quantileGK', 'If'), 'quantileDeterministicIf': ('quantileDeterministic', 'If'), 'categoricalInformationValueIf': ('categoricalInformationValue', 'If'), 'avgIf': ('avg', 'If'), 'groupUniqArrayIf': ('groupUniqArray', 'If'), 'maxIntersectionsPositionIf': ('maxIntersectionsPosition', 'If'), 'exponentialTimeDecayedAvgIf': ('exponentialTimeDecayedAvg', 'If'), 'simpleLinearRegressionIf': ('simpleLinearRegression', 'If'), 'quantileTimingIf': ('quantileTiming', 'If'), 'sparkBarIf': ('sparkBar', 'If'), 'anyLastIf': ('anyLast', 'If'), 'stddevSampIf': ('stddevSamp', 'If'), 'quantilesTimingWeightedIf': ('quantilesTimingWeighted', 'If'), 'cramersVIf': ('cramersV', 'If'), 'argMinIf': ('argMin', 'If'), 'medianIf': ('median', 'If'), 'anyIf': ('any', 'If'), 'covarSampIf': ('covarSamp', 'If'), 'quantileExactHighIf': ('quantileExactHigh', 'If'), 'minIf': ('min', 'If'), 'sumMapIf': ('sumMap', 'If'), 'quantileBFloat16WeightedIf': ('quantileBFloat16Weighted', 'If'), 'maxMapIf': ('maxMap', 'If'), 'quantilesExactLowIf': ('quantilesExactLow', 'If'), 'groupArrayInsertAtIf': ('groupArrayInsertAt', 'If'), 'uniqUpToIf': ('uniqUpTo', 'If'), 'exponentialMovingAverageIf': ('exponentialMovingAverage', 'If'), 'countIf': ('count', 'If'), 'groupBitmapIf': ('groupBitmap', 'If'), 'uniqHLL12If': ('uniqHLL12', 'If'), 'covarPopIf': ('covarPop', 'If'), 'welchTTestIf': ('welchTTest', 'If'), 'quantileTDigestIf': ('quantileTDigest', 'If'), 'avgWeightedIf': ('avgWeighted', 'If'), 'first_valueIf': ('first_value', 'If'), 'groupBitmapAndIf': ('groupBitmapAnd', 'If'), 'quantileBFloat16If': ('quantileBFloat16', 'If'), 'quantilesGKIf': ('quantilesGK', 'If'), 'uniqCombinedIf': ('uniqCombined', 'If'), 'quantilesBFloat16WeightedIf': ('quantilesBFloat16Weighted', 'If'), 'uniqThetaIf': ('uniqTheta', 'If'), 'groupArraySampleIf': ('groupArraySample', 'If'), 'quantilesInterpolatedWeightedIf': ('quantilesInterpolatedWeighted', 'If'), 'quantileExactWeightedIf': ('quantileExactWeighted', 'If'), 'boundingRatioIf': ('boundingRatio', 'If'), 'quantilesExactIf': ('quantilesExact', 'If'), 'groupArrayMovingAvgIf': ('groupArrayMovingAvg', 'If'), 'groupArrayLastIf': ('groupArrayLast', 'If'), 'groupArrayMovingSumIf': ('groupArrayMovingSum', 'If'), 'quantilesTimingIf': ('quantilesTiming', 'If'), 'quantileExactIf': ('quantileExact', 'If'), 'quantileTimingWeightedIf': ('quantileTimingWeighted', 'If'), 'skewPopIf': ('skewPop', 'If'), 'sumKahanIf': ('sumKahan', 'If'), 'quantileInterpolatedWeightedIf': ('quantileInterpolatedWeighted', 'If'), 'rankCorrIf': ('rankCorr', 'If'), 'kolmogorovSmirnovTestIf': ('kolmogorovSmirnovTest', 'If'), 'topKIf': ('topK', 'If'), 'quantilesTDigestWeightedIf': ('quantilesTDigestWeighted', 'If'), 'quantileIf': ('quantile', 'If'), 'quantileExactLowIf': ('quantileExactLow', 'If'), 'groupBitXorIf': ('groupBitXor', 'If'), 'uniqCombined64If': ('uniqCombined64', 'If'), 'topKWeightedIf': ('topKWeighted', 'If'), 'groupBitOrIf': ('groupBitOr', 'If'), 'quantilesTDigestIf': ('quantilesTDigest', 'If'), 'deltaSumIf': ('deltaSum', 'If'), 'quantilesIf': ('quantiles', 'If'), 'corrIf': ('corr', 'If'), 'mannWhitneyUTestIf': ('mannWhitneyUTest', 'If'), 'maxIf': ('max', 'If'), 'sumWithOverflowIf': ('sumWithOverflow', 'If'), 'anyHeavyIf': ('anyHeavy', 'If'), 'windowFunnelIf': ('windowFunnel', 'If'), 'contingencyArray': ('contingency', 'Array'), 'deltaSumTimestampArray': ('deltaSumTimestamp', 'Array'), 'stochasticLogisticRegressionArray': ('stochasticLogisticRegression', 'Array'), 'last_valueArray': ('last_value', 'Array'), 'argMaxArray': ('argMax', 'Array'), 'quantilesExactWeightedArray': ('quantilesExactWeighted', 'Array'), 'uniqArray': ('uniq', 'Array'), 'sumArray': ('sum', 'Array'), 'quantileTDigestWeightedArray': ('quantileTDigestWeighted', 'Array'), 'groupBitmapXorArray': ('groupBitmapXor', 'Array'), 'cramersVBiasCorrectedArray': ('cramersVBiasCorrected', 'Array'), 'largestTriangleThreeBucketsArray': ('largestTriangleThreeBuckets', 'Array'), 'varPopArray': ('varPop', 'Array'), 'kurtSampArray': ('kurtSamp', 'Array'), 'stddevPopArray': ('stddevPop', 'Array'), 'varSampArray': ('varSamp', 'Array'), 'groupArrayArray': ('groupArray', 'Array'), 'studentTTestArray': ('studentTTest', 'Array'), 'sequenceCountArray': ('sequenceCount', 'Array'), 'intervalLengthSumArray': ('intervalLengthSum', 'Array'), 'maxIntersectionsArray': ('maxIntersections', 'Array'), 'meanZTestArray': ('meanZTest', 'Array'), 'sequenceMatchArray': ('sequenceMatch', 'Array'), 'retentionArray': ('retention', 'Array'), 'sequenceNextNodeArray': ('sequenceNextNode', 'Array'), 'skewSampArray': ('skewSamp', 'Array'), 'quantilesExactHighArray': ('quantilesExactHigh', 'Array'), 'uniqExactArray': ('uniqExact', 'Array'), 'kurtPopArray': ('kurtPop', 'Array'), 'sumCountArray': ('sumCount', 'Array'), 'entropyArray': ('entropy', 'Array'), 'quantilesDeterministicArray': ('quantilesDeterministic', 'Array'), 'minMapArray': ('minMap', 'Array'), 'stochasticLinearRegressionArray': ('stochasticLinearRegression', 'Array'), 'theilsUArray': ('theilsU', 'Array'), 'groupBitmapOrArray': ('groupBitmapOr', 'Array'), 'quantilesBFloat16Array': ('quantilesBFloat16', 'Array'), 'histogramArray': ('histogram', 'Array'), 'groupBitAndArray': ('groupBitAnd', 'Array'), 'quantileGKArray': ('quantileGK', 'Array'), 'quantileDeterministicArray': ('quantileDeterministic', 'Array'), 'categoricalInformationValueArray': ('categoricalInformationValue', 'Array'), 'avgArray': ('avg', 'Array'), 'groupUniqArrayArray': ('groupUniqArray', 'Array'), 'maxIntersectionsPositionArray': ('maxIntersectionsPosition', 'Array'), 'exponentialTimeDecayedAvgArray': ('exponentialTimeDecayedAvg', 'Array'), 'simpleLinearRegressionArray': ('simpleLinearRegression', 'Array'), 'quantileTimingArray': ('quantileTiming', 'Array'), 'sparkBarArray': ('sparkBar', 'Array'), 'anyLastArray': ('anyLast', 'Array'), 'stddevSampArray': ('stddevSamp', 'Array'), 'quantilesTimingWeightedArray': ('quantilesTimingWeighted', 'Array'), 'cramersVArray': ('cramersV', 'Array'), 'argMinArray': ('argMin', 'Array'), 'medianArray': ('median', 'Array'), 'anyArray': ('any', 'Array'), 'covarSampArray': ('covarSamp', 'Array'), 'quantileExactHighArray': ('quantileExactHigh', 'Array'), 'minArray': ('min', 'Array'), 'sumMapArray': ('sumMap', 'Array'), 'quantileBFloat16WeightedArray': ('quantileBFloat16Weighted', 'Array'), 'maxMapArray': ('maxMap', 'Array'), 'quantilesExactLowArray': ('quantilesExactLow', 'Array'), 'groupArrayInsertAtArray': ('groupArrayInsertAt', 'Array'), 'uniqUpToArray': ('uniqUpTo', 'Array'), 'exponentialMovingAverageArray': ('exponentialMovingAverage', 'Array'), 'countArray': ('count', 'Array'), 'groupBitmapArray': ('groupBitmap', 'Array'), 'uniqHLL12Array': ('uniqHLL12', 'Array'), 'covarPopArray': ('covarPop', 'Array'), 'welchTTestArray': ('welchTTest', 'Array'), 'quantileTDigestArray': ('quantileTDigest', 'Array'), 'avgWeightedArray': ('avgWeighted', 'Array'), 'first_valueArray': ('first_value', 'Array'), 'groupBitmapAndArray': ('groupBitmapAnd', 'Array'), 'quantileBFloat16Array': ('quantileBFloat16', 'Array'), 'quantilesGKArray': ('quantilesGK', 'Array'), 'uniqCombinedArray': ('uniqCombined', 'Array'), 'quantilesBFloat16WeightedArray': ('quantilesBFloat16Weighted', 'Array'), 'uniqThetaArray': ('uniqTheta', 'Array'), 'groupArraySampleArray': ('groupArraySample', 'Array'), 'quantilesInterpolatedWeightedArray': ('quantilesInterpolatedWeighted', 'Array'), 'quantileExactWeightedArray': ('quantileExactWeighted', 'Array'), 'boundingRatioArray': ('boundingRatio', 'Array'), 'quantilesExactArray': ('quantilesExact', 'Array'), 'groupArrayMovingAvgArray': ('groupArrayMovingAvg', 'Array'), 'groupArrayLastArray': ('groupArrayLast', 'Array'), 'groupArrayMovingSumArray': ('groupArrayMovingSum', 'Array'), 'quantilesTimingArray': ('quantilesTiming', 'Array'), 'quantileExactArray': ('quantileExact', 'Array'), 'quantileTimingWeightedArray': ('quantileTimingWeighted', 'Array'), 'skewPopArray': ('skewPop', 'Array'), 'sumKahanArray': ('sumKahan', 'Array'), 'quantileInterpolatedWeightedArray': ('quantileInterpolatedWeighted', 'Array'), 'rankCorrArray': ('rankCorr', 'Array'), 'kolmogorovSmirnovTestArray': ('kolmogorovSmirnovTest', 'Array'), 'topKArray': ('topK', 'Array'), 'quantilesTDigestWeightedArray': ('quantilesTDigestWeighted', 'Array'), 'quantileArray': ('quantile', 'Array'), 'quantileExactLowArray': ('quantileExactLow', 'Array'), 'groupBitXorArray': ('groupBitXor', 'Array'), 'uniqCombined64Array': ('uniqCombined64', 'Array'), 'topKWeightedArray': ('topKWeighted', 'Array'), 'groupBitOrArray': ('groupBitOr', 'Array'), 'quantilesTDigestArray': ('quantilesTDigest', 'Array'), 'deltaSumArray': ('deltaSum', 'Array'), 'quantilesArray': ('quantiles', 'Array'), 'corrArray': ('corr', 'Array'), 'mannWhitneyUTestArray': ('mannWhitneyUTest', 'Array'), 'maxArray': ('max', 'Array'), 'sumWithOverflowArray': ('sumWithOverflow', 'Array'), 'anyHeavyArray': ('anyHeavy', 'Array'), 'windowFunnelArray': ('windowFunnel', 'Array'), 'contingencyArrayIf': ('contingency', 'ArrayIf'), 'deltaSumTimestampArrayIf': ('deltaSumTimestamp', 'ArrayIf'), 'stochasticLogisticRegressionArrayIf': ('stochasticLogisticRegression', 'ArrayIf'), 'last_valueArrayIf': ('last_value', 'ArrayIf'), 'argMaxArrayIf': ('argMax', 'ArrayIf'), 'quantilesExactWeightedArrayIf': ('quantilesExactWeighted', 'ArrayIf'), 'uniqArrayIf': ('uniq', 'ArrayIf'), 'sumArrayIf': ('sum', 'ArrayIf'), 'quantileTDigestWeightedArrayIf': ('quantileTDigestWeighted', 'ArrayIf'), 'groupBitmapXorArrayIf': ('groupBitmapXor', 'ArrayIf'), 'cramersVBiasCorrectedArrayIf': ('cramersVBiasCorrected', 'ArrayIf'), 'largestTriangleThreeBucketsArrayIf': ('largestTriangleThreeBuckets', 'ArrayIf'), 'varPopArrayIf': ('varPop', 'ArrayIf'), 'kurtSampArrayIf': ('kurtSamp', 'ArrayIf'), 'stddevPopArrayIf': ('stddevPop', 'ArrayIf'), 'varSampArrayIf': ('varSamp', 'ArrayIf'), 'groupArrayArrayIf': ('groupArray', 'ArrayIf'), 'studentTTestArrayIf': ('studentTTest', 'ArrayIf'), 'sequenceCountArrayIf': ('sequenceCount', 'ArrayIf'), 'intervalLengthSumArrayIf': ('intervalLengthSum', 'ArrayIf'), 'maxIntersectionsArrayIf': ('maxIntersections', 'ArrayIf'), 'meanZTestArrayIf': ('meanZTest', 'ArrayIf'), 'sequenceMatchArrayIf': ('sequenceMatch', 'ArrayIf'), 'retentionArrayIf': ('retention', 'ArrayIf'), 'sequenceNextNodeArrayIf': ('sequenceNextNode', 'ArrayIf'), 'skewSampArrayIf': ('skewSamp', 'ArrayIf'), 'quantilesExactHighArrayIf': ('quantilesExactHigh', 'ArrayIf'), 'uniqExactArrayIf': ('uniqExact', 'ArrayIf'), 'kurtPopArrayIf': ('kurtPop', 'ArrayIf'), 'sumCountArrayIf': ('sumCount', 'ArrayIf'), 'entropyArrayIf': ('entropy', 'ArrayIf'), 'quantilesDeterministicArrayIf': ('quantilesDeterministic', 'ArrayIf'), 'minMapArrayIf': ('minMap', 'ArrayIf'), 'stochasticLinearRegressionArrayIf': ('stochasticLinearRegression', 'ArrayIf'), 'theilsUArrayIf': ('theilsU', 'ArrayIf'), 'groupBitmapOrArrayIf': ('groupBitmapOr', 'ArrayIf'), 'quantilesBFloat16ArrayIf': ('quantilesBFloat16', 'ArrayIf'), 'histogramArrayIf': ('histogram', 'ArrayIf'), 'groupBitAndArrayIf': ('groupBitAnd', 'ArrayIf'), 'quantileGKArrayIf': ('quantileGK', 'ArrayIf'), 'quantileDeterministicArrayIf': ('quantileDeterministic', 'ArrayIf'), 'categoricalInformationValueArrayIf': ('categoricalInformationValue', 'ArrayIf'), 'avgArrayIf': ('avg', 'ArrayIf'), 'groupUniqArrayArrayIf': ('groupUniqArray', 'ArrayIf'), 'maxIntersectionsPositionArrayIf': ('maxIntersectionsPosition', 'ArrayIf'), 'exponentialTimeDecayedAvgArrayIf': ('exponentialTimeDecayedAvg', 'ArrayIf'), 'simpleLinearRegressionArrayIf': ('simpleLinearRegression', 'ArrayIf'), 'quantileTimingArrayIf': ('quantileTiming', 'ArrayIf'), 'sparkBarArrayIf': ('sparkBar', 'ArrayIf'), 'anyLastArrayIf': ('anyLast', 'ArrayIf'), 'stddevSampArrayIf': ('stddevSamp', 'ArrayIf'), 'quantilesTimingWeightedArrayIf': ('quantilesTimingWeighted', 'ArrayIf'), 'cramersVArrayIf': ('cramersV', 'ArrayIf'), 'argMinArrayIf': ('argMin', 'ArrayIf'), 'medianArrayIf': ('median', 'ArrayIf'), 'anyArrayIf': ('any', 'ArrayIf'), 'covarSampArrayIf': ('covarSamp', 'ArrayIf'), 'quantileExactHighArrayIf': ('quantileExactHigh', 'ArrayIf'), 'minArrayIf': ('min', 'ArrayIf'), 'sumMapArrayIf': ('sumMap', 'ArrayIf'), 'quantileBFloat16WeightedArrayIf': ('quantileBFloat16Weighted', 'ArrayIf'), 'maxMapArrayIf': ('maxMap', 'ArrayIf'), 'quantilesExactLowArrayIf': ('quantilesExactLow', 'ArrayIf'), 'groupArrayInsertAtArrayIf': ('groupArrayInsertAt', 'ArrayIf'), 'uniqUpToArrayIf': ('uniqUpTo', 'ArrayIf'), 'exponentialMovingAverageArrayIf': ('exponentialMovingAverage', 'ArrayIf'), 'countArrayIf': ('count', 'ArrayIf'), 'groupBitmapArrayIf': ('groupBitmap', 'ArrayIf'), 'uniqHLL12ArrayIf': ('uniqHLL12', 'ArrayIf'), 'covarPopArrayIf': ('covarPop', 'ArrayIf'), 'welchTTestArrayIf': ('welchTTest', 'ArrayIf'), 'quantileTDigestArrayIf': ('quantileTDigest', 'ArrayIf'), 'avgWeightedArrayIf': ('avgWeighted', 'ArrayIf'), 'first_valueArrayIf': ('first_value', 'ArrayIf'), 'groupBitmapAndArrayIf': ('groupBitmapAnd', 'ArrayIf'), 'quantileBFloat16ArrayIf': ('quantileBFloat16', 'ArrayIf'), 'quantilesGKArrayIf': ('quantilesGK', 'ArrayIf'), 'uniqCombinedArrayIf': ('uniqCombined', 'ArrayIf'), 'quantilesBFloat16WeightedArrayIf': ('quantilesBFloat16Weighted', 'ArrayIf'), 'uniqThetaArrayIf': ('uniqTheta', 'ArrayIf'), 'groupArraySampleArrayIf': ('groupArraySample', 'ArrayIf'), 'quantilesInterpolatedWeightedArrayIf': ('quantilesInterpolatedWeighted', 'ArrayIf'), 'quantileExactWeightedArrayIf': ('quantileExactWeighted', 'ArrayIf'), 'boundingRatioArrayIf': ('boundingRatio', 'ArrayIf'), 'quantilesExactArrayIf': ('quantilesExact', 'ArrayIf'), 'groupArrayMovingAvgArrayIf': ('groupArrayMovingAvg', 'ArrayIf'), 'groupArrayLastArrayIf': ('groupArrayLast', 'ArrayIf'), 'groupArrayMovingSumArrayIf': ('groupArrayMovingSum', 'ArrayIf'), 'quantilesTimingArrayIf': ('quantilesTiming', 'ArrayIf'), 'quantileExactArrayIf': ('quantileExact', 'ArrayIf'), 'quantileTimingWeightedArrayIf': ('quantileTimingWeighted', 'ArrayIf'), 'skewPopArrayIf': ('skewPop', 'ArrayIf'), 'sumKahanArrayIf': ('sumKahan', 'ArrayIf'), 'quantileInterpolatedWeightedArrayIf': ('quantileInterpolatedWeighted', 'ArrayIf'), 'rankCorrArrayIf': ('rankCorr', 'ArrayIf'), 'kolmogorovSmirnovTestArrayIf': ('kolmogorovSmirnovTest', 'ArrayIf'), 'topKArrayIf': ('topK', 'ArrayIf'), 'quantilesTDigestWeightedArrayIf': ('quantilesTDigestWeighted', 'ArrayIf'), 'quantileArrayIf': ('quantile', 'ArrayIf'), 'quantileExactLowArrayIf': ('quantileExactLow', 'ArrayIf'), 'groupBitXorArrayIf': ('groupBitXor', 'ArrayIf'), 'uniqCombined64ArrayIf': ('uniqCombined64', 'ArrayIf'), 'topKWeightedArrayIf': ('topKWeighted', 'ArrayIf'), 'groupBitOrArrayIf': ('groupBitOr', 'ArrayIf'), 'quantilesTDigestArrayIf': ('quantilesTDigest', 'ArrayIf'), 'deltaSumArrayIf': ('deltaSum', 'ArrayIf'), 'quantilesArrayIf': ('quantiles', 'ArrayIf'), 'corrArrayIf': ('corr', 'ArrayIf'), 'mannWhitneyUTestArrayIf': ('mannWhitneyUTest', 'ArrayIf'), 'maxArrayIf': ('max', 'ArrayIf'), 'sumWithOverflowArrayIf': ('sumWithOverflow', 'ArrayIf'), 'anyHeavyArrayIf': ('anyHeavy', 'ArrayIf'), 'windowFunnelArrayIf': ('windowFunnel', 'ArrayIf'), 'contingencyMap': ('contingency', 'Map'), 'deltaSumTimestampMap': ('deltaSumTimestamp', 'Map'), 'stochasticLogisticRegressionMap': ('stochasticLogisticRegression', 'Map'), 'last_valueMap': ('last_value', 'Map'), 'argMaxMap': ('argMax', 'Map'), 'quantilesExactWeightedMap': ('quantilesExactWeighted', 'Map'), 'uniqMap': ('uniq', 'Map'), 'sumMap': ('sumMap', ''), 'quantileTDigestWeightedMap': ('quantileTDigestWeighted', 'Map'), 'groupBitmapXorMap': ('groupBitmapXor', 'Map'), 'cramersVBiasCorrectedMap': ('cramersVBiasCorrected', 'Map'), 'largestTriangleThreeBucketsMap': ('largestTriangleThreeBuckets', 'Map'), 'varPopMap': ('varPop', 'Map'), 'kurtSampMap': ('kurtSamp', 'Map'), 'stddevPopMap': ('stddevPop', 'Map'), 'varSampMap': ('varSamp', 'Map'), 'groupArrayMap': ('groupArray', 'Map'), 'studentTTestMap': ('studentTTest', 'Map'), 'sequenceCountMap': ('sequenceCount', 'Map'), 'intervalLengthSumMap': ('intervalLengthSum', 'Map'), 'maxIntersectionsMap': ('maxIntersections', 'Map'), 'meanZTestMap': ('meanZTest', 'Map'), 'sequenceMatchMap': ('sequenceMatch', 'Map'), 'retentionMap': ('retention', 'Map'), 'sequenceNextNodeMap': ('sequenceNextNode', 'Map'), 'skewSampMap': ('skewSamp', 'Map'), 'quantilesExactHighMap': ('quantilesExactHigh', 'Map'), 'uniqExactMap': ('uniqExact', 'Map'), 'kurtPopMap': ('kurtPop', 'Map'), 'sumCountMap': ('sumCount', 'Map'), 'entropyMap': ('entropy', 'Map'), 'quantilesDeterministicMap': ('quantilesDeterministic', 'Map'), 'minMapMap': ('minMap', 'Map'), 'stochasticLinearRegressionMap': ('stochasticLinearRegression', 'Map'), 'theilsUMap': ('theilsU', 'Map'), 'groupBitmapOrMap': ('groupBitmapOr', 'Map'), 'quantilesBFloat16Map': ('quantilesBFloat16', 'Map'), 'histogramMap': ('histogram', 'Map'), 'groupBitAndMap': ('groupBitAnd', 'Map'), 'quantileGKMap': ('quantileGK', 'Map'), 'quantileDeterministicMap': ('quantileDeterministic', 'Map'), 'categoricalInformationValueMap': ('categoricalInformationValue', 'Map'), 'avgMap': ('avg', 'Map'), 'groupUniqArrayMap': ('groupUniqArray', 'Map'), 'maxIntersectionsPositionMap': ('maxIntersectionsPosition', 'Map'), 'exponentialTimeDecayedAvgMap': ('exponentialTimeDecayedAvg', 'Map'), 'simpleLinearRegressionMap': ('simpleLinearRegression', 'Map'), 'quantileTimingMap': ('quantileTiming', 'Map'), 'sparkBarMap': ('sparkBar', 'Map'), 'anyLastMap': ('anyLast', 'Map'), 'stddevSampMap': ('stddevSamp', 'Map'), 'quantilesTimingWeightedMap': ('quantilesTimingWeighted', 'Map'), 'cramersVMap': ('cramersV', 'Map'), 'argMinMap': ('argMin', 'Map'), 'medianMap': ('median', 'Map'), 'anyMap': ('any', 'Map'), 'covarSampMap': ('covarSamp', 'Map'), 'quantileExactHighMap': ('quantileExactHigh', 'Map'), 'minMap': ('minMap', ''), 'sumMapMap': ('sumMap', 'Map'), 'quantileBFloat16WeightedMap': ('quantileBFloat16Weighted', 'Map'), 'maxMapMap': ('maxMap', 'Map'), 'quantilesExactLowMap': ('quantilesExactLow', 'Map'), 'groupArrayInsertAtMap': ('groupArrayInsertAt', 'Map'), 'uniqUpToMap': ('uniqUpTo', 'Map'), 'exponentialMovingAverageMap': ('exponentialMovingAverage', 'Map'), 'countMap': ('count', 'Map'), 'groupBitmapMap': ('groupBitmap', 'Map'), 'uniqHLL12Map': ('uniqHLL12', 'Map'), 'covarPopMap': ('covarPop', 'Map'), 'welchTTestMap': ('welchTTest', 'Map'), 'quantileTDigestMap': ('quantileTDigest', 'Map'), 'avgWeightedMap': ('avgWeighted', 'Map'), 'first_valueMap': ('first_value', 'Map'), 'groupBitmapAndMap': ('groupBitmapAnd', 'Map'), 'quantileBFloat16Map': ('quantileBFloat16', 'Map'), 'quantilesGKMap': ('quantilesGK', 'Map'), 'uniqCombinedMap': ('uniqCombined', 'Map'), 'quantilesBFloat16WeightedMap': ('quantilesBFloat16Weighted', 'Map'), 'uniqThetaMap': ('uniqTheta', 'Map'), 'groupArraySampleMap': ('groupArraySample', 'Map'), 'quantilesInterpolatedWeightedMap': ('quantilesInterpolatedWeighted', 'Map'), 'quantileExactWeightedMap': ('quantileExactWeighted', 'Map'), 'boundingRatioMap': ('boundingRatio', 'Map'), 'quantilesExactMap': ('quantilesExact', 'Map'), 'groupArrayMovingAvgMap': ('groupArrayMovingAvg', 'Map'), 'groupArrayLastMap': ('groupArrayLast', 'Map'), 'groupArrayMovingSumMap': ('groupArrayMovingSum', 'Map'), 'quantilesTimingMap': ('quantilesTiming', 'Map'), 'quantileExactMap': ('quantileExact', 'Map'), 'quantileTimingWeightedMap': ('quantileTimingWeighted', 'Map'), 'skewPopMap': ('skewPop', 'Map'), 'sumKahanMap': ('sumKahan', 'Map'), 'quantileInterpolatedWeightedMap': ('quantileInterpolatedWeighted', 'Map'), 'rankCorrMap': ('rankCorr', 'Map'), 'kolmogorovSmirnovTestMap': ('kolmogorovSmirnovTest', 'Map'), 'topKMap': ('topK', 'Map'), 'quantilesTDigestWeightedMap': ('quantilesTDigestWeighted', 'Map'), 'quantileMap': ('quantile', 'Map'), 'quantileExactLowMap': ('quantileExactLow', 'Map'), 'groupBitXorMap': ('groupBitXor', 'Map'), 'uniqCombined64Map': ('uniqCombined64', 'Map'), 'topKWeightedMap': ('topKWeighted', 'Map'), 'groupBitOrMap': ('groupBitOr', 'Map'), 'quantilesTDigestMap': ('quantilesTDigest', 'Map'), 'deltaSumMap': ('deltaSum', 'Map'), 'quantilesMap': ('quantiles', 'Map'), 'corrMap': ('corr', 'Map'), 'mannWhitneyUTestMap': ('mannWhitneyUTest', 'Map'), 'maxMap': ('maxMap', ''), 'sumWithOverflowMap': ('sumWithOverflow', 'Map'), 'anyHeavyMap': ('anyHeavy', 'Map'), 'windowFunnelMap': ('windowFunnel', 'Map'), 'contingencySimpleState': ('contingency', 'SimpleState'), 'deltaSumTimestampSimpleState': ('deltaSumTimestamp', 'SimpleState'), 'stochasticLogisticRegressionSimpleState': ('stochasticLogisticRegression', 'SimpleState'), 'last_valueSimpleState': ('last_value', 'SimpleState'), 'argMaxSimpleState': ('argMax', 'SimpleState'), 'quantilesExactWeightedSimpleState': ('quantilesExactWeighted', 'SimpleState'), 'uniqSimpleState': ('uniq', 'SimpleState'), 'sumSimpleState': ('sum', 'SimpleState'), 'quantileTDigestWeightedSimpleState': ('quantileTDigestWeighted', 'SimpleState'), 'groupBitmapXorSimpleState': ('groupBitmapXor', 'SimpleState'), 'cramersVBiasCorrectedSimpleState': ('cramersVBiasCorrected', 'SimpleState'), 'largestTriangleThreeBucketsSimpleState': ('largestTriangleThreeBuckets', 'SimpleState'), 'varPopSimpleState': ('varPop', 'SimpleState'), 'kurtSampSimpleState': ('kurtSamp', 'SimpleState'), 'stddevPopSimpleState': ('stddevPop', 'SimpleState'), 'varSampSimpleState': ('varSamp', 'SimpleState'), 'groupArraySimpleState': ('groupArray', 'SimpleState'), 'studentTTestSimpleState': ('studentTTest', 'SimpleState'), 'sequenceCountSimpleState': ('sequenceCount', 'SimpleState'), 'intervalLengthSumSimpleState': ('intervalLengthSum', 'SimpleState'), 'maxIntersectionsSimpleState': ('maxIntersections', 'SimpleState'), 'meanZTestSimpleState': ('meanZTest', 'SimpleState'), 'sequenceMatchSimpleState': ('sequenceMatch', 'SimpleState'), 'retentionSimpleState': ('retention', 'SimpleState'), 'sequenceNextNodeSimpleState': ('sequenceNextNode', 'SimpleState'), 'skewSampSimpleState': ('skewSamp', 'SimpleState'), 'quantilesExactHighSimpleState': ('quantilesExactHigh', 'SimpleState'), 'uniqExactSimpleState': ('uniqExact', 'SimpleState'), 'kurtPopSimpleState': ('kurtPop', 'SimpleState'), 'sumCountSimpleState': ('sumCount', 'SimpleState'), 'entropySimpleState': ('entropy', 'SimpleState'), 'quantilesDeterministicSimpleState': ('quantilesDeterministic', 'SimpleState'), 'minMapSimpleState': ('minMap', 'SimpleState'), 'stochasticLinearRegressionSimpleState': ('stochasticLinearRegression', 'SimpleState'), 'theilsUSimpleState': ('theilsU', 'SimpleState'), 'groupBitmapOrSimpleState': ('groupBitmapOr', 'SimpleState'), 'quantilesBFloat16SimpleState': ('quantilesBFloat16', 'SimpleState'), 'histogramSimpleState': ('histogram', 'SimpleState'), 'groupBitAndSimpleState': ('groupBitAnd', 'SimpleState'), 'quantileGKSimpleState': ('quantileGK', 'SimpleState'), 'quantileDeterministicSimpleState': ('quantileDeterministic', 'SimpleState'), 'categoricalInformationValueSimpleState': ('categoricalInformationValue', 'SimpleState'), 'avgSimpleState': ('avg', 'SimpleState'), 'groupUniqArraySimpleState': ('groupUniqArray', 'SimpleState'), 'maxIntersectionsPositionSimpleState': ('maxIntersectionsPosition', 'SimpleState'), 'exponentialTimeDecayedAvgSimpleState': ('exponentialTimeDecayedAvg', 'SimpleState'), 'simpleLinearRegressionSimpleState': ('simpleLinearRegression', 'SimpleState'), 'quantileTimingSimpleState': ('quantileTiming', 'SimpleState'), 'sparkBarSimpleState': ('sparkBar', 'SimpleState'), 'anyLastSimpleState': ('anyLast', 'SimpleState'), 'stddevSampSimpleState': ('stddevSamp', 'SimpleState'), 'quantilesTimingWeightedSimpleState': ('quantilesTimingWeighted', 'SimpleState'), 'cramersVSimpleState': ('cramersV', 'SimpleState'), 'argMinSimpleState': ('argMin', 'SimpleState'), 'medianSimpleState': ('median', 'SimpleState'), 'anySimpleState': ('any', 'SimpleState'), 'covarSampSimpleState': ('covarSamp', 'SimpleState'), 'quantileExactHighSimpleState': ('quantileExactHigh', 'SimpleState'), 'minSimpleState': ('min', 'SimpleState'), 'sumMapSimpleState': ('sumMap', 'SimpleState'), 'quantileBFloat16WeightedSimpleState': ('quantileBFloat16Weighted', 'SimpleState'), 'maxMapSimpleState': ('maxMap', 'SimpleState'), 'quantilesExactLowSimpleState': ('quantilesExactLow', 'SimpleState'), 'groupArrayInsertAtSimpleState': ('groupArrayInsertAt', 'SimpleState'), 'uniqUpToSimpleState': ('uniqUpTo', 'SimpleState'), 'exponentialMovingAverageSimpleState': ('exponentialMovingAverage', 'SimpleState'), 'countSimpleState': ('count', 'SimpleState'), 'groupBitmapSimpleState': ('groupBitmap', 'SimpleState'), 'uniqHLL12SimpleState': ('uniqHLL12', 'SimpleState'), 'covarPopSimpleState': ('covarPop', 'SimpleState'), 'welchTTestSimpleState': ('welchTTest', 'SimpleState'), 'quantileTDigestSimpleState': ('quantileTDigest', 'SimpleState'), 'avgWeightedSimpleState': ('avgWeighted', 'SimpleState'), 'first_valueSimpleState': ('first_value', 'SimpleState'), 'groupBitmapAndSimpleState': ('groupBitmapAnd', 'SimpleState'), 'quantileBFloat16SimpleState': ('quantileBFloat16', 'SimpleState'), 'quantilesGKSimpleState': ('quantilesGK', 'SimpleState'), 'uniqCombinedSimpleState': ('uniqCombined', 'SimpleState'), 'quantilesBFloat16WeightedSimpleState': ('quantilesBFloat16Weighted', 'SimpleState'), 'uniqThetaSimpleState': ('uniqTheta', 'SimpleState'), 'groupArraySampleSimpleState': ('groupArraySample', 'SimpleState'), 'quantilesInterpolatedWeightedSimpleState': ('quantilesInterpolatedWeighted', 'SimpleState'), 'quantileExactWeightedSimpleState': ('quantileExactWeighted', 'SimpleState'), 'boundingRatioSimpleState': ('boundingRatio', 'SimpleState'), 'quantilesExactSimpleState': ('quantilesExact', 'SimpleState'), 'groupArrayMovingAvgSimpleState': ('groupArrayMovingAvg', 'SimpleState'), 'groupArrayLastSimpleState': ('groupArrayLast', 'SimpleState'), 'groupArrayMovingSumSimpleState': ('groupArrayMovingSum', 'SimpleState'), 'quantilesTimingSimpleState': ('quantilesTiming', 'SimpleState'), 'quantileExactSimpleState': ('quantileExact', 'SimpleState'), 'quantileTimingWeightedSimpleState': ('quantileTimingWeighted', 'SimpleState'), 'skewPopSimpleState': ('skewPop', 'SimpleState'), 'sumKahanSimpleState': ('sumKahan', 'SimpleState'), 'quantileInterpolatedWeightedSimpleState': ('quantileInterpolatedWeighted', 'SimpleState'), 'rankCorrSimpleState': ('rankCorr', 'SimpleState'), 'kolmogorovSmirnovTestSimpleState': ('kolmogorovSmirnovTest', 'SimpleState'), 'topKSimpleState': ('topK', 'SimpleState'), 'quantilesTDigestWeightedSimpleState': ('quantilesTDigestWeighted', 'SimpleState'), 'quantileSimpleState': ('quantile', 'SimpleState'), 'quantileExactLowSimpleState': ('quantileExactLow', 'SimpleState'), 'groupBitXorSimpleState': ('groupBitXor', 'SimpleState'), 'uniqCombined64SimpleState': ('uniqCombined64', 'SimpleState'), 'topKWeightedSimpleState': ('topKWeighted', 'SimpleState'), 'groupBitOrSimpleState': ('groupBitOr', 'SimpleState'), 'quantilesTDigestSimpleState': ('quantilesTDigest', 'SimpleState'), 'deltaSumSimpleState': ('deltaSum', 'SimpleState'), 'quantilesSimpleState': ('quantiles', 'SimpleState'), 'corrSimpleState': ('corr', 'SimpleState'), 'mannWhitneyUTestSimpleState': ('mannWhitneyUTest', 'SimpleState'), 'maxSimpleState': ('max', 'SimpleState'), 'sumWithOverflowSimpleState': ('sumWithOverflow', 'SimpleState'), 'anyHeavySimpleState': ('anyHeavy', 'SimpleState'), 'windowFunnelSimpleState': ('windowFunnel', 'SimpleState'), 'contingencyState': ('contingency', 'State'), 'deltaSumTimestampState': ('deltaSumTimestamp', 'State'), 'stochasticLogisticRegressionState': ('stochasticLogisticRegression', 'State'), 'last_valueState': ('last_value', 'State'), 'argMaxState': ('argMax', 'State'), 'quantilesExactWeightedState': ('quantilesExactWeighted', 'State'), 'uniqState': ('uniq', 'State'), 'sumState': ('sum', 'State'), 'quantileTDigestWeightedState': ('quantileTDigestWeighted', 'State'), 'groupBitmapXorState': ('groupBitmapXor', 'State'), 'cramersVBiasCorrectedState': ('cramersVBiasCorrected', 'State'), 'largestTriangleThreeBucketsState': ('largestTriangleThreeBuckets', 'State'), 'varPopState': ('varPop', 'State'), 'kurtSampState': ('kurtSamp', 'State'), 'stddevPopState': ('stddevPop', 'State'), 'varSampState': ('varSamp', 'State'), 'groupArrayState': ('groupArray', 'State'), 'studentTTestState': ('studentTTest', 'State'), 'sequenceCountState': ('sequenceCount', 'State'), 'intervalLengthSumState': ('intervalLengthSum', 'State'), 'maxIntersectionsState': ('maxIntersections', 'State'), 'meanZTestState': ('meanZTest', 'State'), 'sequenceMatchState': ('sequenceMatch', 'State'), 'retentionState': ('retention', 'State'), 'sequenceNextNodeState': ('sequenceNextNode', 'State'), 'skewSampState': ('skewSamp', 'State'), 'quantilesExactHighState': ('quantilesExactHigh', 'State'), 'uniqExactState': ('uniqExact', 'State'), 'kurtPopState': ('kurtPop', 'State'), 'sumCountState': ('sumCount', 'State'), 'entropyState': ('entropy', 'State'), 'quantilesDeterministicState': ('quantilesDeterministic', 'State'), 'minMapState': ('minMap', 'State'), 'stochasticLinearRegressionState': ('stochasticLinearRegression', 'State'), 'theilsUState': ('theilsU', 'State'), 'groupBitmapOrState': ('groupBitmapOr', 'State'), 'quantilesBFloat16State': ('quantilesBFloat16', 'State'), 'histogramState': ('histogram', 'State'), 'groupBitAndState': ('groupBitAnd', 'State'), 'quantileGKState': ('quantileGK', 'State'), 'quantileDeterministicState': ('quantileDeterministic', 'State'), 'categoricalInformationValueState': ('categoricalInformationValue', 'State'), 'avgState': ('avg', 'State'), 'groupUniqArrayState': ('groupUniqArray', 'State'), 'maxIntersectionsPositionState': ('maxIntersectionsPosition', 'State'), 'exponentialTimeDecayedAvgState': ('exponentialTimeDecayedAvg', 'State'), 'simpleLinearRegressionState': ('simpleLinearRegression', 'State'), 'quantileTimingState': ('quantileTiming', 'State'), 'sparkBarState': ('sparkBar', 'State'), 'anyLastState': ('anyLast', 'State'), 'stddevSampState': ('stddevSamp', 'State'), 'quantilesTimingWeightedState': ('quantilesTimingWeighted', 'State'), 'cramersVState': ('cramersV', 'State'), 'argMinState': ('argMin', 'State'), 'medianState': ('median', 'State'), 'anyState': ('any', 'State'), 'covarSampState': ('covarSamp', 'State'), 'quantileExactHighState': ('quantileExactHigh', 'State'), 'minState': ('min', 'State'), 'sumMapState': ('sumMap', 'State'), 'quantileBFloat16WeightedState': ('quantileBFloat16Weighted', 'State'), 'maxMapState': ('maxMap', 'State'), 'quantilesExactLowState': ('quantilesExactLow', 'State'), 'groupArrayInsertAtState': ('groupArrayInsertAt', 'State'), 'uniqUpToState': ('uniqUpTo', 'State'), 'exponentialMovingAverageState': ('exponentialMovingAverage', 'State'), 'countState': ('count', 'State'), 'groupBitmapState': ('groupBitmap', 'State'), 'uniqHLL12State': ('uniqHLL12', 'State'), 'covarPopState': ('covarPop', 'State'), 'welchTTestState': ('welchTTest', 'State'), 'quantileTDigestState': ('quantileTDigest', 'State'), 'avgWeightedState': ('avgWeighted', 'State'), 'first_valueState': ('first_value', 'State'), 'groupBitmapAndState': ('groupBitmapAnd', 'State'), 'quantileBFloat16State': ('quantileBFloat16', 'State'), 'quantilesGKState': ('quantilesGK', 'State'), 'uniqCombinedState': ('uniqCombined', 'State'), 'quantilesBFloat16WeightedState': ('quantilesBFloat16Weighted', 'State'), 'uniqThetaState': ('uniqTheta', 'State'), 'groupArraySampleState': ('groupArraySample', 'State'), 'quantilesInterpolatedWeightedState': ('quantilesInterpolatedWeighted', 'State'), 'quantileExactWeightedState': ('quantileExactWeighted', 'State'), 'boundingRatioState': ('boundingRatio', 'State'), 'quantilesExactState': ('quantilesExact', 'State'), 'groupArrayMovingAvgState': ('groupArrayMovingAvg', 'State'), 'groupArrayLastState': ('groupArrayLast', 'State'), 'groupArrayMovingSumState': ('groupArrayMovingSum', 'State'), 'quantilesTimingState': ('quantilesTiming', 'State'), 'quantileExactState': ('quantileExact', 'State'), 'quantileTimingWeightedState': ('quantileTimingWeighted', 'State'), 'skewPopState': ('skewPop', 'State'), 'sumKahanState': ('sumKahan', 'State'), 'quantileInterpolatedWeightedState': ('quantileInterpolatedWeighted', 'State'), 'rankCorrState': ('rankCorr', 'State'), 'kolmogorovSmirnovTestState': ('kolmogorovSmirnovTest', 'State'), 'topKState': ('topK', 'State'), 'quantilesTDigestWeightedState': ('quantilesTDigestWeighted', 'State'), 'quantileState': ('quantile', 'State'), 'quantileExactLowState': ('quantileExactLow', 'State'), 'groupBitXorState': ('groupBitXor', 'State'), 'uniqCombined64State': ('uniqCombined64', 'State'), 'topKWeightedState': ('topKWeighted', 'State'), 'groupBitOrState': ('groupBitOr', 'State'), 'quantilesTDigestState': ('quantilesTDigest', 'State'), 'deltaSumState': ('deltaSum', 'State'), 'quantilesState': ('quantiles', 'State'), 'corrState': ('corr', 'State'), 'mannWhitneyUTestState': ('mannWhitneyUTest', 'State'), 'maxState': ('max', 'State'), 'sumWithOverflowState': ('sumWithOverflow', 'State'), 'anyHeavyState': ('anyHeavy', 'State'), 'windowFunnelState': ('windowFunnel', 'State'), 'contingencyMerge': ('contingency', 'Merge'), 'deltaSumTimestampMerge': ('deltaSumTimestamp', 'Merge'), 'stochasticLogisticRegressionMerge': ('stochasticLogisticRegression', 'Merge'), 'last_valueMerge': ('last_value', 'Merge'), 'argMaxMerge': ('argMax', 'Merge'), 'quantilesExactWeightedMerge': ('quantilesExactWeighted', 'Merge'), 'uniqMerge': ('uniq', 'Merge'), 'sumMerge': ('sum', 'Merge'), 'quantileTDigestWeightedMerge': ('quantileTDigestWeighted', 'Merge'), 'groupBitmapXorMerge': ('groupBitmapXor', 'Merge'), 'cramersVBiasCorrectedMerge': ('cramersVBiasCorrected', 'Merge'), 'largestTriangleThreeBucketsMerge': ('largestTriangleThreeBuckets', 'Merge'), 'varPopMerge': ('varPop', 'Merge'), 'kurtSampMerge': ('kurtSamp', 'Merge'), 'stddevPopMerge': ('stddevPop', 'Merge'), 'varSampMerge': ('varSamp', 'Merge'), 'groupArrayMerge': ('groupArray', 'Merge'), 'studentTTestMerge': ('studentTTest', 'Merge'), 'sequenceCountMerge': ('sequenceCount', 'Merge'), 'intervalLengthSumMerge': ('intervalLengthSum', 'Merge'), 'maxIntersectionsMerge': ('maxIntersections', 'Merge'), 'meanZTestMerge': ('meanZTest', 'Merge'), 'sequenceMatchMerge': ('sequenceMatch', 'Merge'), 'retentionMerge': ('retention', 'Merge'), 'sequenceNextNodeMerge': ('sequenceNextNode', 'Merge'), 'skewSampMerge': ('skewSamp', 'Merge'), 'quantilesExactHighMerge': ('quantilesExactHigh', 'Merge'), 'uniqExactMerge': ('uniqExact', 'Merge'), 'kurtPopMerge': ('kurtPop', 'Merge'), 'sumCountMerge': ('sumCount', 'Merge'), 'entropyMerge': ('entropy', 'Merge'), 'quantilesDeterministicMerge': ('quantilesDeterministic', 'Merge'), 'minMapMerge': ('minMap', 'Merge'), 'stochasticLinearRegressionMerge': ('stochasticLinearRegression', 'Merge'), 'theilsUMerge': ('theilsU', 'Merge'), 'groupBitmapOrMerge': ('groupBitmapOr', 'Merge'), 'quantilesBFloat16Merge': ('quantilesBFloat16', 'Merge'), 'histogramMerge': ('histogram', 'Merge'), 'groupBitAndMerge': ('groupBitAnd', 'Merge'), 'quantileGKMerge': ('quantileGK', 'Merge'), 'quantileDeterministicMerge': ('quantileDeterministic', 'Merge'), 'categoricalInformationValueMerge': ('categoricalInformationValue', 'Merge'), 'avgMerge': ('avg', 'Merge'), 'groupUniqArrayMerge': ('groupUniqArray', 'Merge'), 'maxIntersectionsPositionMerge': ('maxIntersectionsPosition', 'Merge'), 'exponentialTimeDecayedAvgMerge': ('exponentialTimeDecayedAvg', 'Merge'), 'simpleLinearRegressionMerge': ('simpleLinearRegression', 'Merge'), 'quantileTimingMerge': ('quantileTiming', 'Merge'), 'sparkBarMerge': ('sparkBar', 'Merge'), 'anyLastMerge': ('anyLast', 'Merge'), 'stddevSampMerge': ('stddevSamp', 'Merge'), 'quantilesTimingWeightedMerge': ('quantilesTimingWeighted', 'Merge'), 'cramersVMerge': ('cramersV', 'Merge'), 'argMinMerge': ('argMin', 'Merge'), 'medianMerge': ('median', 'Merge'), 'anyMerge': ('any', 'Merge'), 'covarSampMerge': ('covarSamp', 'Merge'), 'quantileExactHighMerge': ('quantileExactHigh', 'Merge'), 'minMerge': ('min', 'Merge'), 'sumMapMerge': ('sumMap', 'Merge'), 'quantileBFloat16WeightedMerge': ('quantileBFloat16Weighted', 'Merge'), 'maxMapMerge': ('maxMap', 'Merge'), 'quantilesExactLowMerge': ('quantilesExactLow', 'Merge'), 'groupArrayInsertAtMerge': ('groupArrayInsertAt', 'Merge'), 'uniqUpToMerge': ('uniqUpTo', 'Merge'), 'exponentialMovingAverageMerge': ('exponentialMovingAverage', 'Merge'), 'countMerge': ('count', 'Merge'), 'groupBitmapMerge': ('groupBitmap', 'Merge'), 'uniqHLL12Merge': ('uniqHLL12', 'Merge'), 'covarPopMerge': ('covarPop', 'Merge'), 'welchTTestMerge': ('welchTTest', 'Merge'), 'quantileTDigestMerge': ('quantileTDigest', 'Merge'), 'avgWeightedMerge': ('avgWeighted', 'Merge'), 'first_valueMerge': ('first_value', 'Merge'), 'groupBitmapAndMerge': ('groupBitmapAnd', 'Merge'), 'quantileBFloat16Merge': ('quantileBFloat16', 'Merge'), 'quantilesGKMerge': ('quantilesGK', 'Merge'), 'uniqCombinedMerge': ('uniqCombined', 'Merge'), 'quantilesBFloat16WeightedMerge': ('quantilesBFloat16Weighted', 'Merge'), 'uniqThetaMerge': ('uniqTheta', 'Merge'), 'groupArraySampleMerge': ('groupArraySample', 'Merge'), 'quantilesInterpolatedWeightedMerge': ('quantilesInterpolatedWeighted', 'Merge'), 'quantileExactWeightedMerge': ('quantileExactWeighted', 'Merge'), 'boundingRatioMerge': ('boundingRatio', 'Merge'), 'quantilesExactMerge': ('quantilesExact', 'Merge'), 'groupArrayMovingAvgMerge': ('groupArrayMovingAvg', 'Merge'), 'groupArrayLastMerge': ('groupArrayLast', 'Merge'), 'groupArrayMovingSumMerge': ('groupArrayMovingSum', 'Merge'), 'quantilesTimingMerge': ('quantilesTiming', 'Merge'), 'quantileExactMerge': ('quantileExact', 'Merge'), 'quantileTimingWeightedMerge': ('quantileTimingWeighted', 'Merge'), 'skewPopMerge': ('skewPop', 'Merge'), 'sumKahanMerge': ('sumKahan', 'Merge'), 'quantileInterpolatedWeightedMerge': ('quantileInterpolatedWeighted', 'Merge'), 'rankCorrMerge': ('rankCorr', 'Merge'), 'kolmogorovSmirnovTestMerge': ('kolmogorovSmirnovTest', 'Merge'), 'topKMerge': ('topK', 'Merge'), 'quantilesTDigestWeightedMerge': ('quantilesTDigestWeighted', 'Merge'), 'quantileMerge': ('quantile', 'Merge'), 'quantileExactLowMerge': ('quantileExactLow', 'Merge'), 'groupBitXorMerge': ('groupBitXor', 'Merge'), 'uniqCombined64Merge': ('uniqCombined64', 'Merge'), 'topKWeightedMerge': ('topKWeighted', 'Merge'), 'groupBitOrMerge': ('groupBitOr', 'Merge'), 'quantilesTDigestMerge': ('quantilesTDigest', 'Merge'), 'deltaSumMerge': ('deltaSum', 'Merge'), 'quantilesMerge': ('quantiles', 'Merge'), 'corrMerge': ('corr', 'Merge'), 'mannWhitneyUTestMerge': ('mannWhitneyUTest', 'Merge'), 'maxMerge': ('max', 'Merge'), 'sumWithOverflowMerge': ('sumWithOverflow', 'Merge'), 'anyHeavyMerge': ('anyHeavy', 'Merge'), 'windowFunnelMerge': ('windowFunnel', 'Merge'), 'contingencyMergeState': ('contingency', 'MergeState'), 'deltaSumTimestampMergeState': ('deltaSumTimestamp', 'MergeState'), 'stochasticLogisticRegressionMergeState': ('stochasticLogisticRegression', 'MergeState'), 'last_valueMergeState': ('last_value', 'MergeState'), 'argMaxMergeState': ('argMax', 'MergeState'), 'quantilesExactWeightedMergeState': ('quantilesExactWeighted', 'MergeState'), 'uniqMergeState': ('uniq', 'MergeState'), 'sumMergeState': ('sum', 'MergeState'), 'quantileTDigestWeightedMergeState': ('quantileTDigestWeighted', 'MergeState'), 'groupBitmapXorMergeState': ('groupBitmapXor', 'MergeState'), 'cramersVBiasCorrectedMergeState': ('cramersVBiasCorrected', 'MergeState'), 'largestTriangleThreeBucketsMergeState': ('largestTriangleThreeBuckets', 'MergeState'), 'varPopMergeState': ('varPop', 'MergeState'), 'kurtSampMergeState': ('kurtSamp', 'MergeState'), 'stddevPopMergeState': ('stddevPop', 'MergeState'), 'varSampMergeState': ('varSamp', 'MergeState'), 'groupArrayMergeState': ('groupArray', 'MergeState'), 'studentTTestMergeState': ('studentTTest', 'MergeState'), 'sequenceCountMergeState': ('sequenceCount', 'MergeState'), 'intervalLengthSumMergeState': ('intervalLengthSum', 'MergeState'), 'maxIntersectionsMergeState': ('maxIntersections', 'MergeState'), 'meanZTestMergeState': ('meanZTest', 'MergeState'), 'sequenceMatchMergeState': ('sequenceMatch', 'MergeState'), 'retentionMergeState': ('retention', 'MergeState'), 'sequenceNextNodeMergeState': ('sequenceNextNode', 'MergeState'), 'skewSampMergeState': ('skewSamp', 'MergeState'), 'quantilesExactHighMergeState': ('quantilesExactHigh', 'MergeState'), 'uniqExactMergeState': ('uniqExact', 'MergeState'), 'kurtPopMergeState': ('kurtPop', 'MergeState'), 'sumCountMergeState': ('sumCount', 'MergeState'), 'entropyMergeState': ('entropy', 'MergeState'), 'quantilesDeterministicMergeState': ('quantilesDeterministic', 'MergeState'), 'minMapMergeState': ('minMap', 'MergeState'), 'stochasticLinearRegressionMergeState': ('stochasticLinearRegression', 'MergeState'), 'theilsUMergeState': ('theilsU', 'MergeState'), 'groupBitmapOrMergeState': ('groupBitmapOr', 'MergeState'), 'quantilesBFloat16MergeState': ('quantilesBFloat16', 'MergeState'), 'histogramMergeState': ('histogram', 'MergeState'), 'groupBitAndMergeState': ('groupBitAnd', 'MergeState'), 'quantileGKMergeState': ('quantileGK', 'MergeState'), 'quantileDeterministicMergeState': ('quantileDeterministic', 'MergeState'), 'categoricalInformationValueMergeState': ('categoricalInformationValue', 'MergeState'), 'avgMergeState': ('avg', 'MergeState'), 'groupUniqArrayMergeState': ('groupUniqArray', 'MergeState'), 'maxIntersectionsPositionMergeState': ('maxIntersectionsPosition', 'MergeState'), 'exponentialTimeDecayedAvgMergeState': ('exponentialTimeDecayedAvg', 'MergeState'), 'simpleLinearRegressionMergeState': ('simpleLinearRegression', 'MergeState'), 'quantileTimingMergeState': ('quantileTiming', 'MergeState'), 'sparkBarMergeState': ('sparkBar', 'MergeState'), 'anyLastMergeState': ('anyLast', 'MergeState'), 'stddevSampMergeState': ('stddevSamp', 'MergeState'), 'quantilesTimingWeightedMergeState': ('quantilesTimingWeighted', 'MergeState'), 'cramersVMergeState': ('cramersV', 'MergeState'), 'argMinMergeState': ('argMin', 'MergeState'), 'medianMergeState': ('median', 'MergeState'), 'anyMergeState': ('any', 'MergeState'), 'covarSampMergeState': ('covarSamp', 'MergeState'), 'quantileExactHighMergeState': ('quantileExactHigh', 'MergeState'), 'minMergeState': ('min', 'MergeState'), 'sumMapMergeState': ('sumMap', 'MergeState'), 'quantileBFloat16WeightedMergeState': ('quantileBFloat16Weighted', 'MergeState'), 'maxMapMergeState': ('maxMap', 'MergeState'), 'quantilesExactLowMergeState': ('quantilesExactLow', 'MergeState'), 'groupArrayInsertAtMergeState': ('groupArrayInsertAt', 'MergeState'), 'uniqUpToMergeState': ('uniqUpTo', 'MergeState'), 'exponentialMovingAverageMergeState': ('exponentialMovingAverage', 'MergeState'), 'countMergeState': ('count', 'MergeState'), 'groupBitmapMergeState': ('groupBitmap', 'MergeState'), 'uniqHLL12MergeState': ('uniqHLL12', 'MergeState'), 'covarPopMergeState': ('covarPop', 'MergeState'), 'welchTTestMergeState': ('welchTTest', 'MergeState'), 'quantileTDigestMergeState': ('quantileTDigest', 'MergeState'), 'avgWeightedMergeState': ('avgWeighted', 'MergeState'), 'first_valueMergeState': ('first_value', 'MergeState'), 'groupBitmapAndMergeState': ('groupBitmapAnd', 'MergeState'), 'quantileBFloat16MergeState': ('quantileBFloat16', 'MergeState'), 'quantilesGKMergeState': ('quantilesGK', 'MergeState'), 'uniqCombinedMergeState': ('uniqCombined', 'MergeState'), 'quantilesBFloat16WeightedMergeState': ('quantilesBFloat16Weighted', 'MergeState'), 'uniqThetaMergeState': ('uniqTheta', 'MergeState'), 'groupArraySampleMergeState': ('groupArraySample', 'MergeState'), 'quantilesInterpolatedWeightedMergeState': ('quantilesInterpolatedWeighted', 'MergeState'), 'quantileExactWeightedMergeState': ('quantileExactWeighted', 'MergeState'), 'boundingRatioMergeState': ('boundingRatio', 'MergeState'), 'quantilesExactMergeState': ('quantilesExact', 'MergeState'), 'groupArrayMovingAvgMergeState': ('groupArrayMovingAvg', 'MergeState'), 'groupArrayLastMergeState': ('groupArrayLast', 'MergeState'), 'groupArrayMovingSumMergeState': ('groupArrayMovingSum', 'MergeState'), 'quantilesTimingMergeState': ('quantilesTiming', 'MergeState'), 'quantileExactMergeState': ('quantileExact', 'MergeState'), 'quantileTimingWeightedMergeState': ('quantileTimingWeighted', 'MergeState'), 'skewPopMergeState': ('skewPop', 'MergeState'), 'sumKahanMergeState': ('sumKahan', 'MergeState'), 'quantileInterpolatedWeightedMergeState': ('quantileInterpolatedWeighted', 'MergeState'), 'rankCorrMergeState': ('rankCorr', 'MergeState'), 'kolmogorovSmirnovTestMergeState': ('kolmogorovSmirnovTest', 'MergeState'), 'topKMergeState': ('topK', 'MergeState'), 'quantilesTDigestWeightedMergeState': ('quantilesTDigestWeighted', 'MergeState'), 'quantileMergeState': ('quantile', 'MergeState'), 'quantileExactLowMergeState': ('quantileExactLow', 'MergeState'), 'groupBitXorMergeState': ('groupBitXor', 'MergeState'), 'uniqCombined64MergeState': ('uniqCombined64', 'MergeState'), 'topKWeightedMergeState': ('topKWeighted', 'MergeState'), 'groupBitOrMergeState': ('groupBitOr', 'MergeState'), 'quantilesTDigestMergeState': ('quantilesTDigest', 'MergeState'), 'deltaSumMergeState': ('deltaSum', 'MergeState'), 'quantilesMergeState': ('quantiles', 'MergeState'), 'corrMergeState': ('corr', 'MergeState'), 'mannWhitneyUTestMergeState': ('mannWhitneyUTest', 'MergeState'), 'maxMergeState': ('max', 'MergeState'), 'sumWithOverflowMergeState': ('sumWithOverflow', 'MergeState'), 'anyHeavyMergeState': ('anyHeavy', 'MergeState'), 'windowFunnelMergeState': ('windowFunnel', 'MergeState'), 'contingencyForEach': ('contingency', 'ForEach'), 'deltaSumTimestampForEach': ('deltaSumTimestamp', 'ForEach'), 'stochasticLogisticRegressionForEach': ('stochasticLogisticRegression', 'ForEach'), 'last_valueForEach': ('last_value', 'ForEach'), 'argMaxForEach': ('argMax', 'ForEach'), 'quantilesExactWeightedForEach': ('quantilesExactWeighted', 'ForEach'), 'uniqForEach': ('uniq', 'ForEach'), 'sumForEach': ('sum', 'ForEach'), 'quantileTDigestWeightedForEach': ('quantileTDigestWeighted', 'ForEach'), 'groupBitmapXorForEach': ('groupBitmapXor', 'ForEach'), 'cramersVBiasCorrectedForEach': ('cramersVBiasCorrected', 'ForEach'), 'largestTriangleThreeBucketsForEach': ('largestTriangleThreeBuckets', 'ForEach'), 'varPopForEach': ('varPop', 'ForEach'), 'kurtSampForEach': ('kurtSamp', 'ForEach'), 'stddevPopForEach': ('stddevPop', 'ForEach'), 'varSampForEach': ('varSamp', 'ForEach'), 'groupArrayForEach': ('groupArray', 'ForEach'), 'studentTTestForEach': ('studentTTest', 'ForEach'), 'sequenceCountForEach': ('sequenceCount', 'ForEach'), 'intervalLengthSumForEach': ('intervalLengthSum', 'ForEach'), 'maxIntersectionsForEach': ('maxIntersections', 'ForEach'), 'meanZTestForEach': ('meanZTest', 'ForEach'), 'sequenceMatchForEach': ('sequenceMatch', 'ForEach'), 'retentionForEach': ('retention', 'ForEach'), 'sequenceNextNodeForEach': ('sequenceNextNode', 'ForEach'), 'skewSampForEach': ('skewSamp', 'ForEach'), 'quantilesExactHighForEach': ('quantilesExactHigh', 'ForEach'), 'uniqExactForEach': ('uniqExact', 'ForEach'), 'kurtPopForEach': ('kurtPop', 'ForEach'), 'sumCountForEach': ('sumCount', 'ForEach'), 'entropyForEach': ('entropy', 'ForEach'), 'quantilesDeterministicForEach': ('quantilesDeterministic', 'ForEach'), 'minMapForEach': ('minMap', 'ForEach'), 'stochasticLinearRegressionForEach': ('stochasticLinearRegression', 'ForEach'), 'theilsUForEach': ('theilsU', 'ForEach'), 'groupBitmapOrForEach': ('groupBitmapOr', 'ForEach'), 'quantilesBFloat16ForEach': ('quantilesBFloat16', 'ForEach'), 'histogramForEach': ('histogram', 'ForEach'), 'groupBitAndForEach': ('groupBitAnd', 'ForEach'), 'quantileGKForEach': ('quantileGK', 'ForEach'), 'quantileDeterministicForEach': ('quantileDeterministic', 'ForEach'), 'categoricalInformationValueForEach': ('categoricalInformationValue', 'ForEach'), 'avgForEach': ('avg', 'ForEach'), 'groupUniqArrayForEach': ('groupUniqArray', 'ForEach'), 'maxIntersectionsPositionForEach': ('maxIntersectionsPosition', 'ForEach'), 'exponentialTimeDecayedAvgForEach': ('exponentialTimeDecayedAvg', 'ForEach'), 'simpleLinearRegressionForEach': ('simpleLinearRegression', 'ForEach'), 'quantileTimingForEach': ('quantileTiming', 'ForEach'), 'sparkBarForEach': ('sparkBar', 'ForEach'), 'anyLastForEach': ('anyLast', 'ForEach'), 'stddevSampForEach': ('stddevSamp', 'ForEach'), 'quantilesTimingWeightedForEach': ('quantilesTimingWeighted', 'ForEach'), 'cramersVForEach': ('cramersV', 'ForEach'), 'argMinForEach': ('argMin', 'ForEach'), 'medianForEach': ('median', 'ForEach'), 'anyForEach': ('any', 'ForEach'), 'covarSampForEach': ('covarSamp', 'ForEach'), 'quantileExactHighForEach': ('quantileExactHigh', 'ForEach'), 'minForEach': ('min', 'ForEach'), 'sumMapForEach': ('sumMap', 'ForEach'), 'quantileBFloat16WeightedForEach': ('quantileBFloat16Weighted', 'ForEach'), 'maxMapForEach': ('maxMap', 'ForEach'), 'quantilesExactLowForEach': ('quantilesExactLow', 'ForEach'), 'groupArrayInsertAtForEach': ('groupArrayInsertAt', 'ForEach'), 'uniqUpToForEach': ('uniqUpTo', 'ForEach'), 'exponentialMovingAverageForEach': ('exponentialMovingAverage', 'ForEach'), 'countForEach': ('count', 'ForEach'), 'groupBitmapForEach': ('groupBitmap', 'ForEach'), 'uniqHLL12ForEach': ('uniqHLL12', 'ForEach'), 'covarPopForEach': ('covarPop', 'ForEach'), 'welchTTestForEach': ('welchTTest', 'ForEach'), 'quantileTDigestForEach': ('quantileTDigest', 'ForEach'), 'avgWeightedForEach': ('avgWeighted', 'ForEach'), 'first_valueForEach': ('first_value', 'ForEach'), 'groupBitmapAndForEach': ('groupBitmapAnd', 'ForEach'), 'quantileBFloat16ForEach': ('quantileBFloat16', 'ForEach'), 'quantilesGKForEach': ('quantilesGK', 'ForEach'), 'uniqCombinedForEach': ('uniqCombined', 'ForEach'), 'quantilesBFloat16WeightedForEach': ('quantilesBFloat16Weighted', 'ForEach'), 'uniqThetaForEach': ('uniqTheta', 'ForEach'), 'groupArraySampleForEach': ('groupArraySample', 'ForEach'), 'quantilesInterpolatedWeightedForEach': ('quantilesInterpolatedWeighted', 'ForEach'), 'quantileExactWeightedForEach': ('quantileExactWeighted', 'ForEach'), 'boundingRatioForEach': ('boundingRatio', 'ForEach'), 'quantilesExactForEach': ('quantilesExact', 'ForEach'), 'groupArrayMovingAvgForEach': ('groupArrayMovingAvg', 'ForEach'), 'groupArrayLastForEach': ('groupArrayLast', 'ForEach'), 'groupArrayMovingSumForEach': ('groupArrayMovingSum', 'ForEach'), 'quantilesTimingForEach': ('quantilesTiming', 'ForEach'), 'quantileExactForEach': ('quantileExact', 'ForEach'), 'quantileTimingWeightedForEach': ('quantileTimingWeighted', 'ForEach'), 'skewPopForEach': ('skewPop', 'ForEach'), 'sumKahanForEach': ('sumKahan', 'ForEach'), 'quantileInterpolatedWeightedForEach': ('quantileInterpolatedWeighted', 'ForEach'), 'rankCorrForEach': ('rankCorr', 'ForEach'), 'kolmogorovSmirnovTestForEach': ('kolmogorovSmirnovTest', 'ForEach'), 'topKForEach': ('topK', 'ForEach'), 'quantilesTDigestWeightedForEach': ('quantilesTDigestWeighted', 'ForEach'), 'quantileForEach': ('quantile', 'ForEach'), 'quantileExactLowForEach': ('quantileExactLow', 'ForEach'), 'groupBitXorForEach': ('groupBitXor', 'ForEach'), 'uniqCombined64ForEach': ('uniqCombined64', 'ForEach'), 'topKWeightedForEach': ('topKWeighted', 'ForEach'), 'groupBitOrForEach': ('groupBitOr', 'ForEach'), 'quantilesTDigestForEach': ('quantilesTDigest', 'ForEach'), 'deltaSumForEach': ('deltaSum', 'ForEach'), 'quantilesForEach': ('quantiles', 'ForEach'), 'corrForEach': ('corr', 'ForEach'), 'mannWhitneyUTestForEach': ('mannWhitneyUTest', 'ForEach'), 'maxForEach': ('max', 'ForEach'), 'sumWithOverflowForEach': ('sumWithOverflow', 'ForEach'), 'anyHeavyForEach': ('anyHeavy', 'ForEach'), 'windowFunnelForEach': ('windowFunnel', 'ForEach'), 'contingencyDistinct': ('contingency', 'Distinct'), 'deltaSumTimestampDistinct': ('deltaSumTimestamp', 'Distinct'), 'stochasticLogisticRegressionDistinct': ('stochasticLogisticRegression', 'Distinct'), 'last_valueDistinct': ('last_value', 'Distinct'), 'argMaxDistinct': ('argMax', 'Distinct'), 'quantilesExactWeightedDistinct': ('quantilesExactWeighted', 'Distinct'), 'uniqDistinct': ('uniq', 'Distinct'), 'sumDistinct': ('sum', 'Distinct'), 'quantileTDigestWeightedDistinct': ('quantileTDigestWeighted', 'Distinct'), 'groupBitmapXorDistinct': ('groupBitmapXor', 'Distinct'), 'cramersVBiasCorrectedDistinct': ('cramersVBiasCorrected', 'Distinct'), 'largestTriangleThreeBucketsDistinct': ('largestTriangleThreeBuckets', 'Distinct'), 'varPopDistinct': ('varPop', 'Distinct'), 'kurtSampDistinct': ('kurtSamp', 'Distinct'), 'stddevPopDistinct': ('stddevPop', 'Distinct'), 'varSampDistinct': ('varSamp', 'Distinct'), 'groupArrayDistinct': ('groupArray', 'Distinct'), 'studentTTestDistinct': ('studentTTest', 'Distinct'), 'sequenceCountDistinct': ('sequenceCount', 'Distinct'), 'intervalLengthSumDistinct': ('intervalLengthSum', 'Distinct'), 'maxIntersectionsDistinct': ('maxIntersections', 'Distinct'), 'meanZTestDistinct': ('meanZTest', 'Distinct'), 'sequenceMatchDistinct': ('sequenceMatch', 'Distinct'), 'retentionDistinct': ('retention', 'Distinct'), 'sequenceNextNodeDistinct': ('sequenceNextNode', 'Distinct'), 'skewSampDistinct': ('skewSamp', 'Distinct'), 'quantilesExactHighDistinct': ('quantilesExactHigh', 'Distinct'), 'uniqExactDistinct': ('uniqExact', 'Distinct'), 'kurtPopDistinct': ('kurtPop', 'Distinct'), 'sumCountDistinct': ('sumCount', 'Distinct'), 'entropyDistinct': ('entropy', 'Distinct'), 'quantilesDeterministicDistinct': ('quantilesDeterministic', 'Distinct'), 'minMapDistinct': ('minMap', 'Distinct'), 'stochasticLinearRegressionDistinct': ('stochasticLinearRegression', 'Distinct'), 'theilsUDistinct': ('theilsU', 'Distinct'), 'groupBitmapOrDistinct': ('groupBitmapOr', 'Distinct'), 'quantilesBFloat16Distinct': ('quantilesBFloat16', 'Distinct'), 'histogramDistinct': ('histogram', 'Distinct'), 'groupBitAndDistinct': ('groupBitAnd', 'Distinct'), 'quantileGKDistinct': ('quantileGK', 'Distinct'), 'quantileDeterministicDistinct': ('quantileDeterministic', 'Distinct'), 'categoricalInformationValueDistinct': ('categoricalInformationValue', 'Distinct'), 'avgDistinct': ('avg', 'Distinct'), 'groupUniqArrayDistinct': ('groupUniqArray', 'Distinct'), 'maxIntersectionsPositionDistinct': ('maxIntersectionsPosition', 'Distinct'), 'exponentialTimeDecayedAvgDistinct': ('exponentialTimeDecayedAvg', 'Distinct'), 'simpleLinearRegressionDistinct': ('simpleLinearRegression', 'Distinct'), 'quantileTimingDistinct': ('quantileTiming', 'Distinct'), 'sparkBarDistinct': ('sparkBar', 'Distinct'), 'anyLastDistinct': ('anyLast', 'Distinct'), 'stddevSampDistinct': ('stddevSamp', 'Distinct'), 'quantilesTimingWeightedDistinct': ('quantilesTimingWeighted', 'Distinct'), 'cramersVDistinct': ('cramersV', 'Distinct'), 'argMinDistinct': ('argMin', 'Distinct'), 'medianDistinct': ('median', 'Distinct'), 'anyDistinct': ('any', 'Distinct'), 'covarSampDistinct': ('covarSamp', 'Distinct'), 'quantileExactHighDistinct': ('quantileExactHigh', 'Distinct'), 'minDistinct': ('min', 'Distinct'), 'sumMapDistinct': ('sumMap', 'Distinct'), 'quantileBFloat16WeightedDistinct': ('quantileBFloat16Weighted', 'Distinct'), 'maxMapDistinct': ('maxMap', 'Distinct'), 'quantilesExactLowDistinct': ('quantilesExactLow', 'Distinct'), 'groupArrayInsertAtDistinct': ('groupArrayInsertAt', 'Distinct'), 'uniqUpToDistinct': ('uniqUpTo', 'Distinct'), 'exponentialMovingAverageDistinct': ('exponentialMovingAverage', 'Distinct'), 'countDistinct': ('count', 'Distinct'), 'groupBitmapDistinct': ('groupBitmap', 'Distinct'), 'uniqHLL12Distinct': ('uniqHLL12', 'Distinct'), 'covarPopDistinct': ('covarPop', 'Distinct'), 'welchTTestDistinct': ('welchTTest', 'Distinct'), 'quantileTDigestDistinct': ('quantileTDigest', 'Distinct'), 'avgWeightedDistinct': ('avgWeighted', 'Distinct'), 'first_valueDistinct': ('first_value', 'Distinct'), 'groupBitmapAndDistinct': ('groupBitmapAnd', 'Distinct'), 'quantileBFloat16Distinct': ('quantileBFloat16', 'Distinct'), 'quantilesGKDistinct': ('quantilesGK', 'Distinct'), 'uniqCombinedDistinct': ('uniqCombined', 'Distinct'), 'quantilesBFloat16WeightedDistinct': ('quantilesBFloat16Weighted', 'Distinct'), 'uniqThetaDistinct': ('uniqTheta', 'Distinct'), 'groupArraySampleDistinct': ('groupArraySample', 'Distinct'), 'quantilesInterpolatedWeightedDistinct': ('quantilesInterpolatedWeighted', 'Distinct'), 'quantileExactWeightedDistinct': ('quantileExactWeighted', 'Distinct'), 'boundingRatioDistinct': ('boundingRatio', 'Distinct'), 'quantilesExactDistinct': ('quantilesExact', 'Distinct'), 'groupArrayMovingAvgDistinct': ('groupArrayMovingAvg', 'Distinct'), 'groupArrayLastDistinct': ('groupArrayLast', 'Distinct'), 'groupArrayMovingSumDistinct': ('groupArrayMovingSum', 'Distinct'), 'quantilesTimingDistinct': ('quantilesTiming', 'Distinct'), 'quantileExactDistinct': ('quantileExact', 'Distinct'), 'quantileTimingWeightedDistinct': ('quantileTimingWeighted', 'Distinct'), 'skewPopDistinct': ('skewPop', 'Distinct'), 'sumKahanDistinct': ('sumKahan', 'Distinct'), 'quantileInterpolatedWeightedDistinct': ('quantileInterpolatedWeighted', 'Distinct'), 'rankCorrDistinct': ('rankCorr', 'Distinct'), 'kolmogorovSmirnovTestDistinct': ('kolmogorovSmirnovTest', 'Distinct'), 'topKDistinct': ('topK', 'Distinct'), 'quantilesTDigestWeightedDistinct': ('quantilesTDigestWeighted', 'Distinct'), 'quantileDistinct': ('quantile', 'Distinct'), 'quantileExactLowDistinct': ('quantileExactLow', 'Distinct'), 'groupBitXorDistinct': ('groupBitXor', 'Distinct'), 'uniqCombined64Distinct': ('uniqCombined64', 'Distinct'), 'topKWeightedDistinct': ('topKWeighted', 'Distinct'), 'groupBitOrDistinct': ('groupBitOr', 'Distinct'), 'quantilesTDigestDistinct': ('quantilesTDigest', 'Distinct'), 'deltaSumDistinct': ('deltaSum', 'Distinct'), 'quantilesDistinct': ('quantiles', 'Distinct'), 'corrDistinct': ('corr', 'Distinct'), 'mannWhitneyUTestDistinct': ('mannWhitneyUTest', 'Distinct'), 'maxDistinct': ('max', 'Distinct'), 'sumWithOverflowDistinct': ('sumWithOverflow', 'Distinct'), 'anyHeavyDistinct': ('anyHeavy', 'Distinct'), 'windowFunnelDistinct': ('windowFunnel', 'Distinct'), 'contingencyOrDefault': ('contingency', 'OrDefault'), 'deltaSumTimestampOrDefault': ('deltaSumTimestamp', 'OrDefault'), 'stochasticLogisticRegressionOrDefault': ('stochasticLogisticRegression', 'OrDefault'), 'last_valueOrDefault': ('last_value', 'OrDefault'), 'argMaxOrDefault': ('argMax', 'OrDefault'), 'quantilesExactWeightedOrDefault': ('quantilesExactWeighted', 'OrDefault'), 'uniqOrDefault': ('uniq', 'OrDefault'), 'sumOrDefault': ('sum', 'OrDefault'), 'quantileTDigestWeightedOrDefault': ('quantileTDigestWeighted', 'OrDefault'), 'groupBitmapXorOrDefault': ('groupBitmapXor', 'OrDefault'), 'cramersVBiasCorrectedOrDefault': ('cramersVBiasCorrected', 'OrDefault'), 'largestTriangleThreeBucketsOrDefault': ('largestTriangleThreeBuckets', 'OrDefault'), 'varPopOrDefault': ('varPop', 'OrDefault'), 'kurtSampOrDefault': ('kurtSamp', 'OrDefault'), 'stddevPopOrDefault': ('stddevPop', 'OrDefault'), 'varSampOrDefault': ('varSamp', 'OrDefault'), 'groupArrayOrDefault': ('groupArray', 'OrDefault'), 'studentTTestOrDefault': ('studentTTest', 'OrDefault'), 'sequenceCountOrDefault': ('sequenceCount', 'OrDefault'), 'intervalLengthSumOrDefault': ('intervalLengthSum', 'OrDefault'), 'maxIntersectionsOrDefault': ('maxIntersections', 'OrDefault'), 'meanZTestOrDefault': ('meanZTest', 'OrDefault'), 'sequenceMatchOrDefault': ('sequenceMatch', 'OrDefault'), 'retentionOrDefault': ('retention', 'OrDefault'), 'sequenceNextNodeOrDefault': ('sequenceNextNode', 'OrDefault'), 'skewSampOrDefault': ('skewSamp', 'OrDefault'), 'quantilesExactHighOrDefault': ('quantilesExactHigh', 'OrDefault'), 'uniqExactOrDefault': ('uniqExact', 'OrDefault'), 'kurtPopOrDefault': ('kurtPop', 'OrDefault'), 'sumCountOrDefault': ('sumCount', 'OrDefault'), 'entropyOrDefault': ('entropy', 'OrDefault'), 'quantilesDeterministicOrDefault': ('quantilesDeterministic', 'OrDefault'), 'minMapOrDefault': ('minMap', 'OrDefault'), 'stochasticLinearRegressionOrDefault': ('stochasticLinearRegression', 'OrDefault'), 'theilsUOrDefault': ('theilsU', 'OrDefault'), 'groupBitmapOrOrDefault': ('groupBitmapOr', 'OrDefault'), 'quantilesBFloat16OrDefault': ('quantilesBFloat16', 'OrDefault'), 'histogramOrDefault': ('histogram', 'OrDefault'), 'groupBitAndOrDefault': ('groupBitAnd', 'OrDefault'), 'quantileGKOrDefault': ('quantileGK', 'OrDefault'), 'quantileDeterministicOrDefault': ('quantileDeterministic', 'OrDefault'), 'categoricalInformationValueOrDefault': ('categoricalInformationValue', 'OrDefault'), 'avgOrDefault': ('avg', 'OrDefault'), 'groupUniqArrayOrDefault': ('groupUniqArray', 'OrDefault'), 'maxIntersectionsPositionOrDefault': ('maxIntersectionsPosition', 'OrDefault'), 'exponentialTimeDecayedAvgOrDefault': ('exponentialTimeDecayedAvg', 'OrDefault'), 'simpleLinearRegressionOrDefault': ('simpleLinearRegression', 'OrDefault'), 'quantileTimingOrDefault': ('quantileTiming', 'OrDefault'), 'sparkBarOrDefault': ('sparkBar', 'OrDefault'), 'anyLastOrDefault': ('anyLast', 'OrDefault'), 'stddevSampOrDefault': ('stddevSamp', 'OrDefault'), 'quantilesTimingWeightedOrDefault': ('quantilesTimingWeighted', 'OrDefault'), 'cramersVOrDefault': ('cramersV', 'OrDefault'), 'argMinOrDefault': ('argMin', 'OrDefault'), 'medianOrDefault': ('median', 'OrDefault'), 'anyOrDefault': ('any', 'OrDefault'), 'covarSampOrDefault': ('covarSamp', 'OrDefault'), 'quantileExactHighOrDefault': ('quantileExactHigh', 'OrDefault'), 'minOrDefault': ('min', 'OrDefault'), 'sumMapOrDefault': ('sumMap', 'OrDefault'), 'quantileBFloat16WeightedOrDefault': ('quantileBFloat16Weighted', 'OrDefault'), 'maxMapOrDefault': ('maxMap', 'OrDefault'), 'quantilesExactLowOrDefault': ('quantilesExactLow', 'OrDefault'), 'groupArrayInsertAtOrDefault': ('groupArrayInsertAt', 'OrDefault'), 'uniqUpToOrDefault': ('uniqUpTo', 'OrDefault'), 'exponentialMovingAverageOrDefault': ('exponentialMovingAverage', 'OrDefault'), 'countOrDefault': ('count', 'OrDefault'), 'groupBitmapOrDefault': ('groupBitmap', 'OrDefault'), 'uniqHLL12OrDefault': ('uniqHLL12', 'OrDefault'), 'covarPopOrDefault': ('covarPop', 'OrDefault'), 'welchTTestOrDefault': ('welchTTest', 'OrDefault'), 'quantileTDigestOrDefault': ('quantileTDigest', 'OrDefault'), 'avgWeightedOrDefault': ('avgWeighted', 'OrDefault'), 'first_valueOrDefault': ('first_value', 'OrDefault'), 'groupBitmapAndOrDefault': ('groupBitmapAnd', 'OrDefault'), 'quantileBFloat16OrDefault': ('quantileBFloat16', 'OrDefault'), 'quantilesGKOrDefault': ('quantilesGK', 'OrDefault'), 'uniqCombinedOrDefault': ('uniqCombined', 'OrDefault'), 'quantilesBFloat16WeightedOrDefault': ('quantilesBFloat16Weighted', 'OrDefault'), 'uniqThetaOrDefault': ('uniqTheta', 'OrDefault'), 'groupArraySampleOrDefault': ('groupArraySample', 'OrDefault'), 'quantilesInterpolatedWeightedOrDefault': ('quantilesInterpolatedWeighted', 'OrDefault'), 'quantileExactWeightedOrDefault': ('quantileExactWeighted', 'OrDefault'), 'boundingRatioOrDefault': ('boundingRatio', 'OrDefault'), 'quantilesExactOrDefault': ('quantilesExact', 'OrDefault'), 'groupArrayMovingAvgOrDefault': ('groupArrayMovingAvg', 'OrDefault'), 'groupArrayLastOrDefault': ('groupArrayLast', 'OrDefault'), 'groupArrayMovingSumOrDefault': ('groupArrayMovingSum', 'OrDefault'), 'quantilesTimingOrDefault': ('quantilesTiming', 'OrDefault'), 'quantileExactOrDefault': ('quantileExact', 'OrDefault'), 'quantileTimingWeightedOrDefault': ('quantileTimingWeighted', 'OrDefault'), 'skewPopOrDefault': ('skewPop', 'OrDefault'), 'sumKahanOrDefault': ('sumKahan', 'OrDefault'), 'quantileInterpolatedWeightedOrDefault': ('quantileInterpolatedWeighted', 'OrDefault'), 'rankCorrOrDefault': ('rankCorr', 'OrDefault'), 'kolmogorovSmirnovTestOrDefault': ('kolmogorovSmirnovTest', 'OrDefault'), 'topKOrDefault': ('topK', 'OrDefault'), 'quantilesTDigestWeightedOrDefault': ('quantilesTDigestWeighted', 'OrDefault'), 'quantileOrDefault': ('quantile', 'OrDefault'), 'quantileExactLowOrDefault': ('quantileExactLow', 'OrDefault'), 'groupBitXorOrDefault': ('groupBitXor', 'OrDefault'), 'uniqCombined64OrDefault': ('uniqCombined64', 'OrDefault'), 'topKWeightedOrDefault': ('topKWeighted', 'OrDefault'), 'groupBitOrOrDefault': ('groupBitOr', 'OrDefault'), 'quantilesTDigestOrDefault': ('quantilesTDigest', 'OrDefault'), 'deltaSumOrDefault': ('deltaSum', 'OrDefault'), 'quantilesOrDefault': ('quantiles', 'OrDefault'), 'corrOrDefault': ('corr', 'OrDefault'), 'mannWhitneyUTestOrDefault': ('mannWhitneyUTest', 'OrDefault'), 'maxOrDefault': ('max', 'OrDefault'), 'sumWithOverflowOrDefault': ('sumWithOverflow', 'OrDefault'), 'anyHeavyOrDefault': ('anyHeavy', 'OrDefault'), 'windowFunnelOrDefault': ('windowFunnel', 'OrDefault'), 'contingencyOrNull': ('contingency', 'OrNull'), 'deltaSumTimestampOrNull': ('deltaSumTimestamp', 'OrNull'), 'stochasticLogisticRegressionOrNull': ('stochasticLogisticRegression', 'OrNull'), 'last_valueOrNull': ('last_value', 'OrNull'), 'argMaxOrNull': ('argMax', 'OrNull'), 'quantilesExactWeightedOrNull': ('quantilesExactWeighted', 'OrNull'), 'uniqOrNull': ('uniq', 'OrNull'), 'sumOrNull': ('sum', 'OrNull'), 'quantileTDigestWeightedOrNull': ('quantileTDigestWeighted', 'OrNull'), 'groupBitmapXorOrNull': ('groupBitmapXor', 'OrNull'), 'cramersVBiasCorrectedOrNull': ('cramersVBiasCorrected', 'OrNull'), 'largestTriangleThreeBucketsOrNull': ('largestTriangleThreeBuckets', 'OrNull'), 'varPopOrNull': ('varPop', 'OrNull'), 'kurtSampOrNull': ('kurtSamp', 'OrNull'), 'stddevPopOrNull': ('stddevPop', 'OrNull'), 'varSampOrNull': ('varSamp', 'OrNull'), 'groupArrayOrNull': ('groupArray', 'OrNull'), 'studentTTestOrNull': ('studentTTest', 'OrNull'), 'sequenceCountOrNull': ('sequenceCount', 'OrNull'), 'intervalLengthSumOrNull': ('intervalLengthSum', 'OrNull'), 'maxIntersectionsOrNull': ('maxIntersections', 'OrNull'), 'meanZTestOrNull': ('meanZTest', 'OrNull'), 'sequenceMatchOrNull': ('sequenceMatch', 'OrNull'), 'retentionOrNull': ('retention', 'OrNull'), 'sequenceNextNodeOrNull': ('sequenceNextNode', 'OrNull'), 'skewSampOrNull': ('skewSamp', 'OrNull'), 'quantilesExactHighOrNull': ('quantilesExactHigh', 'OrNull'), 'uniqExactOrNull': ('uniqExact', 'OrNull'), 'kurtPopOrNull': ('kurtPop', 'OrNull'), 'sumCountOrNull': ('sumCount', 'OrNull'), 'entropyOrNull': ('entropy', 'OrNull'), 'quantilesDeterministicOrNull': ('quantilesDeterministic', 'OrNull'), 'minMapOrNull': ('minMap', 'OrNull'), 'stochasticLinearRegressionOrNull': ('stochasticLinearRegression', 'OrNull'), 'theilsUOrNull': ('theilsU', 'OrNull'), 'groupBitmapOrOrNull': ('groupBitmapOr', 'OrNull'), 'quantilesBFloat16OrNull': ('quantilesBFloat16', 'OrNull'), 'histogramOrNull': ('histogram', 'OrNull'), 'groupBitAndOrNull': ('groupBitAnd', 'OrNull'), 'quantileGKOrNull': ('quantileGK', 'OrNull'), 'quantileDeterministicOrNull': ('quantileDeterministic', 'OrNull'), 'categoricalInformationValueOrNull': ('categoricalInformationValue', 'OrNull'), 'avgOrNull': ('avg', 'OrNull'), 'groupUniqArrayOrNull': ('groupUniqArray', 'OrNull'), 'maxIntersectionsPositionOrNull': ('maxIntersectionsPosition', 'OrNull'), 'exponentialTimeDecayedAvgOrNull': ('exponentialTimeDecayedAvg', 'OrNull'), 'simpleLinearRegressionOrNull': ('simpleLinearRegression', 'OrNull'), 'quantileTimingOrNull': ('quantileTiming', 'OrNull'), 'sparkBarOrNull': ('sparkBar', 'OrNull'), 'anyLastOrNull': ('anyLast', 'OrNull'), 'stddevSampOrNull': ('stddevSamp', 'OrNull'), 'quantilesTimingWeightedOrNull': ('quantilesTimingWeighted', 'OrNull'), 'cramersVOrNull': ('cramersV', 'OrNull'), 'argMinOrNull': ('argMin', 'OrNull'), 'medianOrNull': ('median', 'OrNull'), 'anyOrNull': ('any', 'OrNull'), 'covarSampOrNull': ('covarSamp', 'OrNull'), 'quantileExactHighOrNull': ('quantileExactHigh', 'OrNull'), 'minOrNull': ('min', 'OrNull'), 'sumMapOrNull': ('sumMap', 'OrNull'), 'quantileBFloat16WeightedOrNull': ('quantileBFloat16Weighted', 'OrNull'), 'maxMapOrNull': ('maxMap', 'OrNull'), 'quantilesExactLowOrNull': ('quantilesExactLow', 'OrNull'), 'groupArrayInsertAtOrNull': ('groupArrayInsertAt', 'OrNull'), 'uniqUpToOrNull': ('uniqUpTo', 'OrNull'), 'exponentialMovingAverageOrNull': ('exponentialMovingAverage', 'OrNull'), 'countOrNull': ('count', 'OrNull'), 'groupBitmapOrNull': ('groupBitmap', 'OrNull'), 'uniqHLL12OrNull': ('uniqHLL12', 'OrNull'), 'covarPopOrNull': ('covarPop', 'OrNull'), 'welchTTestOrNull': ('welchTTest', 'OrNull'), 'quantileTDigestOrNull': ('quantileTDigest', 'OrNull'), 'avgWeightedOrNull': ('avgWeighted', 'OrNull'), 'first_valueOrNull': ('first_value', 'OrNull'), 'groupBitmapAndOrNull': ('groupBitmapAnd', 'OrNull'), 'quantileBFloat16OrNull': ('quantileBFloat16', 'OrNull'), 'quantilesGKOrNull': ('quantilesGK', 'OrNull'), 'uniqCombinedOrNull': ('uniqCombined', 'OrNull'), 'quantilesBFloat16WeightedOrNull': ('quantilesBFloat16Weighted', 'OrNull'), 'uniqThetaOrNull': ('uniqTheta', 'OrNull'), 'groupArraySampleOrNull': ('groupArraySample', 'OrNull'), 'quantilesInterpolatedWeightedOrNull': ('quantilesInterpolatedWeighted', 'OrNull'), 'quantileExactWeightedOrNull': ('quantileExactWeighted', 'OrNull'), 'boundingRatioOrNull': ('boundingRatio', 'OrNull'), 'quantilesExactOrNull': ('quantilesExact', 'OrNull'), 'groupArrayMovingAvgOrNull': ('groupArrayMovingAvg', 'OrNull'), 'groupArrayLastOrNull': ('groupArrayLast', 'OrNull'), 'groupArrayMovingSumOrNull': ('groupArrayMovingSum', 'OrNull'), 'quantilesTimingOrNull': ('quantilesTiming', 'OrNull'), 'quantileExactOrNull': ('quantileExact', 'OrNull'), 'quantileTimingWeightedOrNull': ('quantileTimingWeighted', 'OrNull'), 'skewPopOrNull': ('skewPop', 'OrNull'), 'sumKahanOrNull': ('sumKahan', 'OrNull'), 'quantileInterpolatedWeightedOrNull': ('quantileInterpolatedWeighted', 'OrNull'), 'rankCorrOrNull': ('rankCorr', 'OrNull'), 'kolmogorovSmirnovTestOrNull': ('kolmogorovSmirnovTest', 'OrNull'), 'topKOrNull': ('topK', 'OrNull'), 'quantilesTDigestWeightedOrNull': ('quantilesTDigestWeighted', 'OrNull'), 'quantileOrNull': ('quantile', 'OrNull'), 'quantileExactLowOrNull': ('quantileExactLow', 'OrNull'), 'groupBitXorOrNull': ('groupBitXor', 'OrNull'), 'uniqCombined64OrNull': ('uniqCombined64', 'OrNull'), 'topKWeightedOrNull': ('topKWeighted', 'OrNull'), 'groupBitOrOrNull': ('groupBitOr', 'OrNull'), 'quantilesTDigestOrNull': ('quantilesTDigest', 'OrNull'), 'deltaSumOrNull': ('deltaSum', 'OrNull'), 'quantilesOrNull': ('quantiles', 'OrNull'), 'corrOrNull': ('corr', 'OrNull'), 'mannWhitneyUTestOrNull': ('mannWhitneyUTest', 'OrNull'), 'maxOrNull': ('max', 'OrNull'), 'sumWithOverflowOrNull': ('sumWithOverflow', 'OrNull'), 'anyHeavyOrNull': ('anyHeavy', 'OrNull'), 'windowFunnelOrNull': ('windowFunnel', 'OrNull'), 'contingencyResample': ('contingency', 'Resample'), 'deltaSumTimestampResample': ('deltaSumTimestamp', 'Resample'), 'stochasticLogisticRegressionResample': ('stochasticLogisticRegression', 'Resample'), 'last_valueResample': ('last_value', 'Resample'), 'argMaxResample': ('argMax', 'Resample'), 'quantilesExactWeightedResample': ('quantilesExactWeighted', 'Resample'), 'uniqResample': ('uniq', 'Resample'), 'sumResample': ('sum', 'Resample'), 'quantileTDigestWeightedResample': ('quantileTDigestWeighted', 'Resample'), 'groupBitmapXorResample': ('groupBitmapXor', 'Resample'), 'cramersVBiasCorrectedResample': ('cramersVBiasCorrected', 'Resample'), 'largestTriangleThreeBucketsResample': ('largestTriangleThreeBuckets', 'Resample'), 'varPopResample': ('varPop', 'Resample'), 'kurtSampResample': ('kurtSamp', 'Resample'), 'stddevPopResample': ('stddevPop', 'Resample'), 'varSampResample': ('varSamp', 'Resample'), 'groupArrayResample': ('groupArray', 'Resample'), 'studentTTestResample': ('studentTTest', 'Resample'), 'sequenceCountResample': ('sequenceCount', 'Resample'), 'intervalLengthSumResample': ('intervalLengthSum', 'Resample'), 'maxIntersectionsResample': ('maxIntersections', 'Resample'), 'meanZTestResample': ('meanZTest', 'Resample'), 'sequenceMatchResample': ('sequenceMatch', 'Resample'), 'retentionResample': ('retention', 'Resample'), 'sequenceNextNodeResample': ('sequenceNextNode', 'Resample'), 'skewSampResample': ('skewSamp', 'Resample'), 'quantilesExactHighResample': ('quantilesExactHigh', 'Resample'), 'uniqExactResample': ('uniqExact', 'Resample'), 'kurtPopResample': ('kurtPop', 'Resample'), 'sumCountResample': ('sumCount', 'Resample'), 'entropyResample': ('entropy', 'Resample'), 'quantilesDeterministicResample': ('quantilesDeterministic', 'Resample'), 'minMapResample': ('minMap', 'Resample'), 'stochasticLinearRegressionResample': ('stochasticLinearRegression', 'Resample'), 'theilsUResample': ('theilsU', 'Resample'), 'groupBitmapOrResample': ('groupBitmapOr', 'Resample'), 'quantilesBFloat16Resample': ('quantilesBFloat16', 'Resample'), 'histogramResample': ('histogram', 'Resample'), 'groupBitAndResample': ('groupBitAnd', 'Resample'), 'quantileGKResample': ('quantileGK', 'Resample'), 'quantileDeterministicResample': ('quantileDeterministic', 'Resample'), 'categoricalInformationValueResample': ('categoricalInformationValue', 'Resample'), 'avgResample': ('avg', 'Resample'), 'groupUniqArrayResample': ('groupUniqArray', 'Resample'), 'maxIntersectionsPositionResample': ('maxIntersectionsPosition', 'Resample'), 'exponentialTimeDecayedAvgResample': ('exponentialTimeDecayedAvg', 'Resample'), 'simpleLinearRegressionResample': ('simpleLinearRegression', 'Resample'), 'quantileTimingResample': ('quantileTiming', 'Resample'), 'sparkBarResample': ('sparkBar', 'Resample'), 'anyLastResample': ('anyLast', 'Resample'), 'stddevSampResample': ('stddevSamp', 'Resample'), 'quantilesTimingWeightedResample': ('quantilesTimingWeighted', 'Resample'), 'cramersVResample': ('cramersV', 'Resample'), 'argMinResample': ('argMin', 'Resample'), 'medianResample': ('median', 'Resample'), 'anyResample': ('any', 'Resample'), 'covarSampResample': ('covarSamp', 'Resample'), 'quantileExactHighResample': ('quantileExactHigh', 'Resample'), 'minResample': ('min', 'Resample'), 'sumMapResample': ('sumMap', 'Resample'), 'quantileBFloat16WeightedResample': ('quantileBFloat16Weighted', 'Resample'), 'maxMapResample': ('maxMap', 'Resample'), 'quantilesExactLowResample': ('quantilesExactLow', 'Resample'), 'groupArrayInsertAtResample': ('groupArrayInsertAt', 'Resample'), 'uniqUpToResample': ('uniqUpTo', 'Resample'), 'exponentialMovingAverageResample': ('exponentialMovingAverage', 'Resample'), 'countResample': ('count', 'Resample'), 'groupBitmapResample': ('groupBitmap', 'Resample'), 'uniqHLL12Resample': ('uniqHLL12', 'Resample'), 'covarPopResample': ('covarPop', 'Resample'), 'welchTTestResample': ('welchTTest', 'Resample'), 'quantileTDigestResample': ('quantileTDigest', 'Resample'), 'avgWeightedResample': ('avgWeighted', 'Resample'), 'first_valueResample': ('first_value', 'Resample'), 'groupBitmapAndResample': ('groupBitmapAnd', 'Resample'), 'quantileBFloat16Resample': ('quantileBFloat16', 'Resample'), 'quantilesGKResample': ('quantilesGK', 'Resample'), 'uniqCombinedResample': ('uniqCombined', 'Resample'), 'quantilesBFloat16WeightedResample': ('quantilesBFloat16Weighted', 'Resample'), 'uniqThetaResample': ('uniqTheta', 'Resample'), 'groupArraySampleResample': ('groupArraySample', 'Resample'), 'quantilesInterpolatedWeightedResample': ('quantilesInterpolatedWeighted', 'Resample'), 'quantileExactWeightedResample': ('quantileExactWeighted', 'Resample'), 'boundingRatioResample': ('boundingRatio', 'Resample'), 'quantilesExactResample': ('quantilesExact', 'Resample'), 'groupArrayMovingAvgResample': ('groupArrayMovingAvg', 'Resample'), 'groupArrayLastResample': ('groupArrayLast', 'Resample'), 'groupArrayMovingSumResample': ('groupArrayMovingSum', 'Resample'), 'quantilesTimingResample': ('quantilesTiming', 'Resample'), 'quantileExactResample': ('quantileExact', 'Resample'), 'quantileTimingWeightedResample': ('quantileTimingWeighted', 'Resample'), 'skewPopResample': ('skewPop', 'Resample'), 'sumKahanResample': ('sumKahan', 'Resample'), 'quantileInterpolatedWeightedResample': ('quantileInterpolatedWeighted', 'Resample'), 'rankCorrResample': ('rankCorr', 'Resample'), 'kolmogorovSmirnovTestResample': ('kolmogorovSmirnovTest', 'Resample'), 'topKResample': ('topK', 'Resample'), 'quantilesTDigestWeightedResample': ('quantilesTDigestWeighted', 'Resample'), 'quantileResample': ('quantile', 'Resample'), 'quantileExactLowResample': ('quantileExactLow', 'Resample'), 'groupBitXorResample': ('groupBitXor', 'Resample'), 'uniqCombined64Resample': ('uniqCombined64', 'Resample'), 'topKWeightedResample': ('topKWeighted', 'Resample'), 'groupBitOrResample': ('groupBitOr', 'Resample'), 'quantilesTDigestResample': ('quantilesTDigest', 'Resample'), 'deltaSumResample': ('deltaSum', 'Resample'), 'quantilesResample': ('quantiles', 'Resample'), 'corrResample': ('corr', 'Resample'), 'mannWhitneyUTestResample': ('mannWhitneyUTest', 'Resample'), 'maxResample': ('max', 'Resample'), 'sumWithOverflowResample': ('sumWithOverflow', 'Resample'), 'anyHeavyResample': ('anyHeavy', 'Resample'), 'windowFunnelResample': ('windowFunnel', 'Resample'), 'contingencyArgMin': ('contingency', 'ArgMin'), 'deltaSumTimestampArgMin': ('deltaSumTimestamp', 'ArgMin'), 'stochasticLogisticRegressionArgMin': ('stochasticLogisticRegression', 'ArgMin'), 'last_valueArgMin': ('last_value', 'ArgMin'), 'argMaxArgMin': ('argMax', 'ArgMin'), 'quantilesExactWeightedArgMin': ('quantilesExactWeighted', 'ArgMin'), 'uniqArgMin': ('uniq', 'ArgMin'), 'sumArgMin': ('sum', 'ArgMin'), 'quantileTDigestWeightedArgMin': ('quantileTDigestWeighted', 'ArgMin'), 'groupBitmapXorArgMin': ('groupBitmapXor', 'ArgMin'), 'cramersVBiasCorrectedArgMin': ('cramersVBiasCorrected', 'ArgMin'), 'largestTriangleThreeBucketsArgMin': ('largestTriangleThreeBuckets', 'ArgMin'), 'varPopArgMin': ('varPop', 'ArgMin'), 'kurtSampArgMin': ('kurtSamp', 'ArgMin'), 'stddevPopArgMin': ('stddevPop', 'ArgMin'), 'varSampArgMin': ('varSamp', 'ArgMin'), 'groupArrayArgMin': ('groupArray', 'ArgMin'), 'studentTTestArgMin': ('studentTTest', 'ArgMin'), 'sequenceCountArgMin': ('sequenceCount', 'ArgMin'), 'intervalLengthSumArgMin': ('intervalLengthSum', 'ArgMin'), 'maxIntersectionsArgMin': ('maxIntersections', 'ArgMin'), 'meanZTestArgMin': ('meanZTest', 'ArgMin'), 'sequenceMatchArgMin': ('sequenceMatch', 'ArgMin'), 'retentionArgMin': ('retention', 'ArgMin'), 'sequenceNextNodeArgMin': ('sequenceNextNode', 'ArgMin'), 'skewSampArgMin': ('skewSamp', 'ArgMin'), 'quantilesExactHighArgMin': ('quantilesExactHigh', 'ArgMin'), 'uniqExactArgMin': ('uniqExact', 'ArgMin'), 'kurtPopArgMin': ('kurtPop', 'ArgMin'), 'sumCountArgMin': ('sumCount', 'ArgMin'), 'entropyArgMin': ('entropy', 'ArgMin'), 'quantilesDeterministicArgMin': ('quantilesDeterministic', 'ArgMin'), 'minMapArgMin': ('minMap', 'ArgMin'), 'stochasticLinearRegressionArgMin': ('stochasticLinearRegression', 'ArgMin'), 'theilsUArgMin': ('theilsU', 'ArgMin'), 'groupBitmapOrArgMin': ('groupBitmapOr', 'ArgMin'), 'quantilesBFloat16ArgMin': ('quantilesBFloat16', 'ArgMin'), 'histogramArgMin': ('histogram', 'ArgMin'), 'groupBitAndArgMin': ('groupBitAnd', 'ArgMin'), 'quantileGKArgMin': ('quantileGK', 'ArgMin'), 'quantileDeterministicArgMin': ('quantileDeterministic', 'ArgMin'), 'categoricalInformationValueArgMin': ('categoricalInformationValue', 'ArgMin'), 'avgArgMin': ('avg', 'ArgMin'), 'groupUniqArrayArgMin': ('groupUniqArray', 'ArgMin'), 'maxIntersectionsPositionArgMin': ('maxIntersectionsPosition', 'ArgMin'), 'exponentialTimeDecayedAvgArgMin': ('exponentialTimeDecayedAvg', 'ArgMin'), 'simpleLinearRegressionArgMin': ('simpleLinearRegression', 'ArgMin'), 'quantileTimingArgMin': ('quantileTiming', 'ArgMin'), 'sparkBarArgMin': ('sparkBar', 'ArgMin'), 'anyLastArgMin': ('anyLast', 'ArgMin'), 'stddevSampArgMin': ('stddevSamp', 'ArgMin'), 'quantilesTimingWeightedArgMin': ('quantilesTimingWeighted', 'ArgMin'), 'cramersVArgMin': ('cramersV', 'ArgMin'), 'argMinArgMin': ('argMin', 'ArgMin'), 'medianArgMin': ('median', 'ArgMin'), 'anyArgMin': ('any', 'ArgMin'), 'covarSampArgMin': ('covarSamp', 'ArgMin'), 'quantileExactHighArgMin': ('quantileExactHigh', 'ArgMin'), 'minArgMin': ('min', 'ArgMin'), 'sumMapArgMin': ('sumMap', 'ArgMin'), 'quantileBFloat16WeightedArgMin': ('quantileBFloat16Weighted', 'ArgMin'), 'maxMapArgMin': ('maxMap', 'ArgMin'), 'quantilesExactLowArgMin': ('quantilesExactLow', 'ArgMin'), 'groupArrayInsertAtArgMin': ('groupArrayInsertAt', 'ArgMin'), 'uniqUpToArgMin': ('uniqUpTo', 'ArgMin'), 'exponentialMovingAverageArgMin': ('exponentialMovingAverage', 'ArgMin'), 'countArgMin': ('count', 'ArgMin'), 'groupBitmapArgMin': ('groupBitmap', 'ArgMin'), 'uniqHLL12ArgMin': ('uniqHLL12', 'ArgMin'), 'covarPopArgMin': ('covarPop', 'ArgMin'), 'welchTTestArgMin': ('welchTTest', 'ArgMin'), 'quantileTDigestArgMin': ('quantileTDigest', 'ArgMin'), 'avgWeightedArgMin': ('avgWeighted', 'ArgMin'), 'first_valueArgMin': ('first_value', 'ArgMin'), 'groupBitmapAndArgMin': ('groupBitmapAnd', 'ArgMin'), 'quantileBFloat16ArgMin': ('quantileBFloat16', 'ArgMin'), 'quantilesGKArgMin': ('quantilesGK', 'ArgMin'), 'uniqCombinedArgMin': ('uniqCombined', 'ArgMin'), 'quantilesBFloat16WeightedArgMin': ('quantilesBFloat16Weighted', 'ArgMin'), 'uniqThetaArgMin': ('uniqTheta', 'ArgMin'), 'groupArraySampleArgMin': ('groupArraySample', 'ArgMin'), 'quantilesInterpolatedWeightedArgMin': ('quantilesInterpolatedWeighted', 'ArgMin'), 'quantileExactWeightedArgMin': ('quantileExactWeighted', 'ArgMin'), 'boundingRatioArgMin': ('boundingRatio', 'ArgMin'), 'quantilesExactArgMin': ('quantilesExact', 'ArgMin'), 'groupArrayMovingAvgArgMin': ('groupArrayMovingAvg', 'ArgMin'), 'groupArrayLastArgMin': ('groupArrayLast', 'ArgMin'), 'groupArrayMovingSumArgMin': ('groupArrayMovingSum', 'ArgMin'), 'quantilesTimingArgMin': ('quantilesTiming', 'ArgMin'), 'quantileExactArgMin': ('quantileExact', 'ArgMin'), 'quantileTimingWeightedArgMin': ('quantileTimingWeighted', 'ArgMin'), 'skewPopArgMin': ('skewPop', 'ArgMin'), 'sumKahanArgMin': ('sumKahan', 'ArgMin'), 'quantileInterpolatedWeightedArgMin': ('quantileInterpolatedWeighted', 'ArgMin'), 'rankCorrArgMin': ('rankCorr', 'ArgMin'), 'kolmogorovSmirnovTestArgMin': ('kolmogorovSmirnovTest', 'ArgMin'), 'topKArgMin': ('topK', 'ArgMin'), 'quantilesTDigestWeightedArgMin': ('quantilesTDigestWeighted', 'ArgMin'), 'quantileArgMin': ('quantile', 'ArgMin'), 'quantileExactLowArgMin': ('quantileExactLow', 'ArgMin'), 'groupBitXorArgMin': ('groupBitXor', 'ArgMin'), 'uniqCombined64ArgMin': ('uniqCombined64', 'ArgMin'), 'topKWeightedArgMin': ('topKWeighted', 'ArgMin'), 'groupBitOrArgMin': ('groupBitOr', 'ArgMin'), 'quantilesTDigestArgMin': ('quantilesTDigest', 'ArgMin'), 'deltaSumArgMin': ('deltaSum', 'ArgMin'), 'quantilesArgMin': ('quantiles', 'ArgMin'), 'corrArgMin': ('corr', 'ArgMin'), 'mannWhitneyUTestArgMin': ('mannWhitneyUTest', 'ArgMin'), 'maxArgMin': ('max', 'ArgMin'), 'sumWithOverflowArgMin': ('sumWithOverflow', 'ArgMin'), 'anyHeavyArgMin': ('anyHeavy', 'ArgMin'), 'windowFunnelArgMin': ('windowFunnel', 'ArgMin'), 'contingencyArgMax': ('contingency', 'ArgMax'), 'deltaSumTimestampArgMax': ('deltaSumTimestamp', 'ArgMax'), 'stochasticLogisticRegressionArgMax': ('stochasticLogisticRegression', 'ArgMax'), 'last_valueArgMax': ('last_value', 'ArgMax'), 'argMaxArgMax': ('argMax', 'ArgMax'), 'quantilesExactWeightedArgMax': ('quantilesExactWeighted', 'ArgMax'), 'uniqArgMax': ('uniq', 'ArgMax'), 'sumArgMax': ('sum', 'ArgMax'), 'quantileTDigestWeightedArgMax': ('quantileTDigestWeighted', 'ArgMax'), 'groupBitmapXorArgMax': ('groupBitmapXor', 'ArgMax'), 'cramersVBiasCorrectedArgMax': ('cramersVBiasCorrected', 'ArgMax'), 'largestTriangleThreeBucketsArgMax': ('largestTriangleThreeBuckets', 'ArgMax'), 'varPopArgMax': ('varPop', 'ArgMax'), 'kurtSampArgMax': ('kurtSamp', 'ArgMax'), 'stddevPopArgMax': ('stddevPop', 'ArgMax'), 'varSampArgMax': ('varSamp', 'ArgMax'), 'groupArrayArgMax': ('groupArray', 'ArgMax'), 'studentTTestArgMax': ('studentTTest', 'ArgMax'), 'sequenceCountArgMax': ('sequenceCount', 'ArgMax'), 'intervalLengthSumArgMax': ('intervalLengthSum', 'ArgMax'), 'maxIntersectionsArgMax': ('maxIntersections', 'ArgMax'), 'meanZTestArgMax': ('meanZTest', 'ArgMax'), 'sequenceMatchArgMax': ('sequenceMatch', 'ArgMax'), 'retentionArgMax': ('retention', 'ArgMax'), 'sequenceNextNodeArgMax': ('sequenceNextNode', 'ArgMax'), 'skewSampArgMax': ('skewSamp', 'ArgMax'), 'quantilesExactHighArgMax': ('quantilesExactHigh', 'ArgMax'), 'uniqExactArgMax': ('uniqExact', 'ArgMax'), 'kurtPopArgMax': ('kurtPop', 'ArgMax'), 'sumCountArgMax': ('sumCount', 'ArgMax'), 'entropyArgMax': ('entropy', 'ArgMax'), 'quantilesDeterministicArgMax': ('quantilesDeterministic', 'ArgMax'), 'minMapArgMax': ('minMap', 'ArgMax'), 'stochasticLinearRegressionArgMax': ('stochasticLinearRegression', 'ArgMax'), 'theilsUArgMax': ('theilsU', 'ArgMax'), 'groupBitmapOrArgMax': ('groupBitmapOr', 'ArgMax'), 'quantilesBFloat16ArgMax': ('quantilesBFloat16', 'ArgMax'), 'histogramArgMax': ('histogram', 'ArgMax'), 'groupBitAndArgMax': ('groupBitAnd', 'ArgMax'), 'quantileGKArgMax': ('quantileGK', 'ArgMax'), 'quantileDeterministicArgMax': ('quantileDeterministic', 'ArgMax'), 'categoricalInformationValueArgMax': ('categoricalInformationValue', 'ArgMax'), 'avgArgMax': ('avg', 'ArgMax'), 'groupUniqArrayArgMax': ('groupUniqArray', 'ArgMax'), 'maxIntersectionsPositionArgMax': ('maxIntersectionsPosition', 'ArgMax'), 'exponentialTimeDecayedAvgArgMax': ('exponentialTimeDecayedAvg', 'ArgMax'), 'simpleLinearRegressionArgMax': ('simpleLinearRegression', 'ArgMax'), 'quantileTimingArgMax': ('quantileTiming', 'ArgMax'), 'sparkBarArgMax': ('sparkBar', 'ArgMax'), 'anyLastArgMax': ('anyLast', 'ArgMax'), 'stddevSampArgMax': ('stddevSamp', 'ArgMax'), 'quantilesTimingWeightedArgMax': ('quantilesTimingWeighted', 'ArgMax'), 'cramersVArgMax': ('cramersV', 'ArgMax'), 'argMinArgMax': ('argMin', 'ArgMax'), 'medianArgMax': ('median', 'ArgMax'), 'anyArgMax': ('any', 'ArgMax'), 'covarSampArgMax': ('covarSamp', 'ArgMax'), 'quantileExactHighArgMax': ('quantileExactHigh', 'ArgMax'), 'minArgMax': ('min', 'ArgMax'), 'sumMapArgMax': ('sumMap', 'ArgMax'), 'quantileBFloat16WeightedArgMax': ('quantileBFloat16Weighted', 'ArgMax'), 'maxMapArgMax': ('maxMap', 'ArgMax'), 'quantilesExactLowArgMax': ('quantilesExactLow', 'ArgMax'), 'groupArrayInsertAtArgMax': ('groupArrayInsertAt', 'ArgMax'), 'uniqUpToArgMax': ('uniqUpTo', 'ArgMax'), 'exponentialMovingAverageArgMax': ('exponentialMovingAverage', 'ArgMax'), 'countArgMax': ('count', 'ArgMax'), 'groupBitmapArgMax': ('groupBitmap', 'ArgMax'), 'uniqHLL12ArgMax': ('uniqHLL12', 'ArgMax'), 'covarPopArgMax': ('covarPop', 'ArgMax'), 'welchTTestArgMax': ('welchTTest', 'ArgMax'), 'quantileTDigestArgMax': ('quantileTDigest', 'ArgMax'), 'avgWeightedArgMax': ('avgWeighted', 'ArgMax'), 'first_valueArgMax': ('first_value', 'ArgMax'), 'groupBitmapAndArgMax': ('groupBitmapAnd', 'ArgMax'), 'quantileBFloat16ArgMax': ('quantileBFloat16', 'ArgMax'), 'quantilesGKArgMax': ('quantilesGK', 'ArgMax'), 'uniqCombinedArgMax': ('uniqCombined', 'ArgMax'), 'quantilesBFloat16WeightedArgMax': ('quantilesBFloat16Weighted', 'ArgMax'), 'uniqThetaArgMax': ('uniqTheta', 'ArgMax'), 'groupArraySampleArgMax': ('groupArraySample', 'ArgMax'), 'quantilesInterpolatedWeightedArgMax': ('quantilesInterpolatedWeighted', 'ArgMax'), 'quantileExactWeightedArgMax': ('quantileExactWeighted', 'ArgMax'), 'boundingRatioArgMax': ('boundingRatio', 'ArgMax'), 'quantilesExactArgMax': ('quantilesExact', 'ArgMax'), 'groupArrayMovingAvgArgMax': ('groupArrayMovingAvg', 'ArgMax'), 'groupArrayLastArgMax': ('groupArrayLast', 'ArgMax'), 'groupArrayMovingSumArgMax': ('groupArrayMovingSum', 'ArgMax'), 'quantilesTimingArgMax': ('quantilesTiming', 'ArgMax'), 'quantileExactArgMax': ('quantileExact', 'ArgMax'), 'quantileTimingWeightedArgMax': ('quantileTimingWeighted', 'ArgMax'), 'skewPopArgMax': ('skewPop', 'ArgMax'), 'sumKahanArgMax': ('sumKahan', 'ArgMax'), 'quantileInterpolatedWeightedArgMax': ('quantileInterpolatedWeighted', 'ArgMax'), 'rankCorrArgMax': ('rankCorr', 'ArgMax'), 'kolmogorovSmirnovTestArgMax': ('kolmogorovSmirnovTest', 'ArgMax'), 'topKArgMax': ('topK', 'ArgMax'), 'quantilesTDigestWeightedArgMax': ('quantilesTDigestWeighted', 'ArgMax'), 'quantileArgMax': ('quantile', 'ArgMax'), 'quantileExactLowArgMax': ('quantileExactLow', 'ArgMax'), 'groupBitXorArgMax': ('groupBitXor', 'ArgMax'), 'uniqCombined64ArgMax': ('uniqCombined64', 'ArgMax'), 'topKWeightedArgMax': ('topKWeighted', 'ArgMax'), 'groupBitOrArgMax': ('groupBitOr', 'ArgMax'), 'quantilesTDigestArgMax': ('quantilesTDigest', 'ArgMax'), 'deltaSumArgMax': ('deltaSum', 'ArgMax'), 'quantilesArgMax': ('quantiles', 'ArgMax'), 'corrArgMax': ('corr', 'ArgMax'), 'mannWhitneyUTestArgMax': ('mannWhitneyUTest', 'ArgMax'), 'maxArgMax': ('max', 'ArgMax'), 'sumWithOverflowArgMax': ('sumWithOverflow', 'ArgMax'), 'anyHeavyArgMax': ('anyHeavy', 'ArgMax'), 'windowFunnelArgMax': ('windowFunnel', 'ArgMax'), 'contingency': ('contingency', ''), 'deltaSumTimestamp': ('deltaSumTimestamp', ''), 'stochasticLogisticRegression': ('stochasticLogisticRegression', ''), 'last_value': ('last_value', ''), 'argMax': ('argMax', ''), 'quantilesExactWeighted': ('quantilesExactWeighted', ''), 'uniq': ('uniq', ''), 'sum': ('sum', ''), 'quantileTDigestWeighted': ('quantileTDigestWeighted', ''), 'groupBitmapXor': ('groupBitmapXor', ''), 'cramersVBiasCorrected': ('cramersVBiasCorrected', ''), 'largestTriangleThreeBuckets': ('largestTriangleThreeBuckets', ''), 'varPop': ('varPop', ''), 'kurtSamp': ('kurtSamp', ''), 'stddevPop': ('stddevPop', ''), 'varSamp': ('varSamp', ''), 'groupArray': ('groupArray', ''), 'studentTTest': ('studentTTest', ''), 'sequenceCount': ('sequenceCount', ''), 'intervalLengthSum': ('intervalLengthSum', ''), 'maxIntersections': ('maxIntersections', ''), 'meanZTest': ('meanZTest', ''), 'sequenceMatch': ('sequenceMatch', ''), 'retention': ('retention', ''), 'sequenceNextNode': ('sequenceNextNode', ''), 'skewSamp': ('skewSamp', ''), 'quantilesExactHigh': ('quantilesExactHigh', ''), 'uniqExact': ('uniqExact', ''), 'kurtPop': ('kurtPop', ''), 'sumCount': ('sumCount', ''), 'entropy': ('entropy', ''), 'quantilesDeterministic': ('quantilesDeterministic', ''), 'stochasticLinearRegression': ('stochasticLinearRegression', ''), 'theilsU': ('theilsU', ''), 'groupBitmapOr': ('groupBitmapOr', ''), 'quantilesBFloat16': ('quantilesBFloat16', ''), 'histogram': ('histogram', ''), 'groupBitAnd': ('groupBitAnd', ''), 'quantileGK': ('quantileGK', ''), 'quantileDeterministic': ('quantileDeterministic', ''), 'categoricalInformationValue': ('categoricalInformationValue', ''), 'avg': ('avg', ''), 'groupUniqArray': ('groupUniqArray', ''), 'maxIntersectionsPosition': ('maxIntersectionsPosition', ''), 'exponentialTimeDecayedAvg': ('exponentialTimeDecayedAvg', ''), 'simpleLinearRegression': ('simpleLinearRegression', ''), 'quantileTiming': ('quantileTiming', ''), 'sparkBar': ('sparkBar', ''), 'anyLast': ('anyLast', ''), 'stddevSamp': ('stddevSamp', ''), 'quantilesTimingWeighted': ('quantilesTimingWeighted', ''), 'cramersV': ('cramersV', ''), 'argMin': ('argMin', ''), 'median': ('median', ''), 'any': ('any', ''), 'covarSamp': ('covarSamp', ''), 'quantileExactHigh': ('quantileExactHigh', ''), 'min': ('min', ''), 'quantileBFloat16Weighted': ('quantileBFloat16Weighted', ''), 'quantilesExactLow': ('quantilesExactLow', ''), 'groupArrayInsertAt': ('groupArrayInsertAt', ''), 'uniqUpTo': ('uniqUpTo', ''), 'exponentialMovingAverage': ('exponentialMovingAverage', ''), 'count': ('count', ''), 'groupBitmap': ('groupBitmap', ''), 'uniqHLL12': ('uniqHLL12', ''), 'covarPop': ('covarPop', ''), 'welchTTest': ('welchTTest', ''), 'quantileTDigest': ('quantileTDigest', ''), 'avgWeighted': ('avgWeighted', ''), 'first_value': ('first_value', ''), 'groupBitmapAnd': ('groupBitmapAnd', ''), 'quantileBFloat16': ('quantileBFloat16', ''), 'quantilesGK': ('quantilesGK', ''), 'uniqCombined': ('uniqCombined', ''), 'quantilesBFloat16Weighted': ('quantilesBFloat16Weighted', ''), 'uniqTheta': ('uniqTheta', ''), 'groupArraySample': ('groupArraySample', ''), 'quantilesInterpolatedWeighted': ('quantilesInterpolatedWeighted', ''), 'quantileExactWeighted': ('quantileExactWeighted', ''), 'boundingRatio': ('boundingRatio', ''), 'quantilesExact': ('quantilesExact', ''), 'groupArrayMovingAvg': ('groupArrayMovingAvg', ''), 'groupArrayLast': ('groupArrayLast', ''), 'groupArrayMovingSum': ('groupArrayMovingSum', ''), 'quantilesTiming': ('quantilesTiming', ''), 'quantileExact': ('quantileExact', ''), 'quantileTimingWeighted': ('quantileTimingWeighted', ''), 'skewPop': ('skewPop', ''), 'sumKahan': ('sumKahan', ''), 'quantileInterpolatedWeighted': ('quantileInterpolatedWeighted', ''), 'rankCorr': ('rankCorr', ''), 'kolmogorovSmirnovTest': ('kolmogorovSmirnovTest', ''), 'topK': ('topK', ''), 'quantilesTDigestWeighted': ('quantilesTDigestWeighted', ''), 'quantile': ('quantile', ''), 'quantileExactLow': ('quantileExactLow', ''), 'groupBitXor': ('groupBitXor', ''), 'uniqCombined64': ('uniqCombined64', ''), 'topKWeighted': ('topKWeighted', ''), 'groupBitOr': ('groupBitOr', ''), 'quantilesTDigest': ('quantilesTDigest', ''), 'deltaSum': ('deltaSum', ''), 'quantiles': ('quantiles', ''), 'corr': ('corr', ''), 'mannWhitneyUTest': ('mannWhitneyUTest', ''), 'max': ('max', ''), 'sumWithOverflow': ('sumWithOverflow', ''), 'anyHeavy': ('anyHeavy', ''), 'windowFunnel': ('windowFunnel', '')}
FUNCTIONS_WITH_ALIASED_ARGS = {'STRUCT', 'TUPLE'}
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.STRAIGHT_JOIN: 'STRAIGHT_JOIN'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.INNER: 'INNER'>, <TokenType.ASOF: 'ASOF'>, <TokenType.CROSS: 'CROSS'>, <TokenType.OUTER: 'OUTER'>, <TokenType.ANY: 'ANY'>, <TokenType.SEMI: 'SEMI'>, <TokenType.ANTI: 'ANTI'>}
TABLE_ALIAS_TOKENS = {<TokenType.PROCEDURE: 'PROCEDURE'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.DATE32: 'DATE32'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.ORDINALITY: 'ORDINALITY'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.SET: 'SET'>, <TokenType.ROW: 'ROW'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.NAME: 'NAME'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.UNIQUE: 'UNIQUE'>, <TokenType.KILL: 'KILL'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.STREAMLIT: 'STREAMLIT'>, <TokenType.INET: 'INET'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.UINT: 'UINT'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.DESC: 'DESC'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.CACHE: 'CACHE'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.NULL: 'NULL'>, <TokenType.TOP: 'TOP'>, <TokenType.CASE: 'CASE'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.NESTED: 'NESTED'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.UUID: 'UUID'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.TRUE: 'TRUE'>, <TokenType.ROWS: 'ROWS'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.XML: 'XML'>, <TokenType.BIT: 'BIT'>, <TokenType.VAR: 'VAR'>, <TokenType.TIME: 'TIME'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.MERGE: 'MERGE'>, <TokenType.RANGE: 'RANGE'>, <TokenType.LOAD: 'LOAD'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.UNIQUEIDENTIFIER: 'UNIQUEIDENTIFIER'>, <TokenType.ALL: 'ALL'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.UINT128: 'UINT128'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.COPY: 'COPY'>, <TokenType.IPV6: 'IPV6'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.ASC: 'ASC'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.TAG: 'TAG'>, <TokenType.VIEW: 'VIEW'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.DIV: 'DIV'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.REFERENCES: 'REFERENCES'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.CUBE: 'CUBE'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.MAP: 'MAP'>, <TokenType.FILTER: 'FILTER'>, <TokenType.INT128: 'INT128'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.JSONB: 'JSONB'>, <TokenType.DELETE: 'DELETE'>, <TokenType.FIRST: 'FIRST'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.ENUM: 'ENUM'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.STORAGE_INTEGRATION: 'STORAGE_INTEGRATION'>, <TokenType.NEXT: 'NEXT'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.DATE: 'DATE'>, <TokenType.YEAR: 'YEAR'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.TABLE: 'TABLE'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.STRAIGHT_JOIN: 'STRAIGHT_JOIN'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.INT256: 'INT256'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.BINARY: 'BINARY'>, <TokenType.INDEX: 'INDEX'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.IS: 'IS'>, <TokenType.ROLLUP: 'ROLLUP'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.SHOW: 'SHOW'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.INT: 'INT'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.IPV4: 'IPV4'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.RENAME: 'RENAME'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.USE: 'USE'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.LIST: 'LIST'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.CHAR: 'CHAR'>, <TokenType.KEEP: 'KEEP'>, <TokenType.UINT256: 'UINT256'>, <TokenType.TEXT: 'TEXT'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.JSON: 'JSON'>, <TokenType.WAREHOUSE: 'WAREHOUSE'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.END: 'END'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.MODEL: 'MODEL'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.FALSE: 'FALSE'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.MONEY: 'MONEY'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.SUPER: 'SUPER'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.SOME: 'SOME'>}
ALIAS_TOKENS = {<TokenType.PROCEDURE: 'PROCEDURE'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.DATE32: 'DATE32'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.ORDINALITY: 'ORDINALITY'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.SET: 'SET'>, <TokenType.ROW: 'ROW'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.NAME: 'NAME'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.UNIQUE: 'UNIQUE'>, <TokenType.KILL: 'KILL'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.STREAMLIT: 'STREAMLIT'>, <TokenType.INET: 'INET'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.ASOF: 'ASOF'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.UINT: 'UINT'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.DESC: 'DESC'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.SEMI: 'SEMI'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.CACHE: 'CACHE'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.NULL: 'NULL'>, <TokenType.TOP: 'TOP'>, <TokenType.CASE: 'CASE'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.NESTED: 'NESTED'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.UUID: 'UUID'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.TRUE: 'TRUE'>, <TokenType.ROWS: 'ROWS'>, <TokenType.WINDOW: 'WINDOW'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.XML: 'XML'>, <TokenType.BIT: 'BIT'>, <TokenType.VAR: 'VAR'>, <TokenType.TIME: 'TIME'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.ANY: 'ANY'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.MERGE: 'MERGE'>, <TokenType.RANGE: 'RANGE'>, <TokenType.LOAD: 'LOAD'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.UNIQUEIDENTIFIER: 'UNIQUEIDENTIFIER'>, <TokenType.ALL: 'ALL'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.UINT128: 'UINT128'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.COPY: 'COPY'>, <TokenType.IPV6: 'IPV6'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.ASC: 'ASC'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.TAG: 'TAG'>, <TokenType.VIEW: 'VIEW'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.DIV: 'DIV'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.REFERENCES: 'REFERENCES'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.APPLY: 'APPLY'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.CUBE: 'CUBE'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.MAP: 'MAP'>, <TokenType.FILTER: 'FILTER'>, <TokenType.INT128: 'INT128'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.JSONB: 'JSONB'>, <TokenType.DELETE: 'DELETE'>, <TokenType.FIRST: 'FIRST'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.ENUM: 'ENUM'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.STORAGE_INTEGRATION: 'STORAGE_INTEGRATION'>, <TokenType.NEXT: 'NEXT'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.DATE: 'DATE'>, <TokenType.YEAR: 'YEAR'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.TABLE: 'TABLE'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.FINAL: 'FINAL'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.INT256: 'INT256'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.BINARY: 'BINARY'>, <TokenType.INDEX: 'INDEX'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.FULL: 'FULL'>, <TokenType.IS: 'IS'>, <TokenType.ROLLUP: 'ROLLUP'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.SHOW: 'SHOW'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.INT: 'INT'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.NATURAL: 'NATURAL'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.IPV4: 'IPV4'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.RENAME: 'RENAME'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.USE: 'USE'>, <TokenType.LEFT: 'LEFT'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.LIST: 'LIST'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.CHAR: 'CHAR'>, <TokenType.KEEP: 'KEEP'>, <TokenType.UINT256: 'UINT256'>, <TokenType.TEXT: 'TEXT'>, <TokenType.ANTI: 'ANTI'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.JSON: 'JSON'>, <TokenType.WAREHOUSE: 'WAREHOUSE'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.END: 'END'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.MODEL: 'MODEL'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.FALSE: 'FALSE'>, <TokenType.SETTINGS: 'SETTINGS'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.MONEY: 'MONEY'>, <TokenType.RIGHT: 'RIGHT'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.SUPER: 'SUPER'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.SOME: 'SOME'>}
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', 'UNIQUE', 'LIKE', 'FOREIGN KEY', 'PERIOD', 'EXCLUDE', 'PRIMARY KEY', 'INDEX'}
PLACEHOLDER_PARSERS = {<TokenType.PLACEHOLDER: 'PLACEHOLDER'>: <function Parser.<lambda>>, <TokenType.PARAMETER: 'PARAMETER'>: <function Parser.<lambda>>, <TokenType.COLON: 'COLON'>: <function Parser.<lambda>>, <TokenType.L_BRACE: 'L_BRACE'>: <function ClickHouse.Parser.<lambda>>}
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
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
IS_JSON_PREDICATE_KIND
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):
 751    class Generator(generator.Generator):
 752        QUERY_HINTS = False
 753        STRUCT_DELIMITER = ("(", ")")
 754        NVL2_SUPPORTED = False
 755        TABLESAMPLE_REQUIRES_PARENS = False
 756        TABLESAMPLE_SIZE_IS_ROWS = False
 757        TABLESAMPLE_KEYWORDS = "SAMPLE"
 758        LAST_DAY_SUPPORTS_DATE_PART = False
 759        CAN_IMPLEMENT_ARRAY_ANY = True
 760        SUPPORTS_TO_NUMBER = False
 761        JOIN_HINTS = False
 762        TABLE_HINTS = False
 763        EXPLICIT_SET_OP = True
 764        GROUPINGS_SEP = ""
 765        SET_OP_MODIFIERS = False
 766        SUPPORTS_TABLE_ALIAS_COLUMNS = False
 767        VALUES_AS_TABLE = False
 768
 769        STRING_TYPE_MAPPING = {
 770            exp.DataType.Type.CHAR: "String",
 771            exp.DataType.Type.LONGBLOB: "String",
 772            exp.DataType.Type.LONGTEXT: "String",
 773            exp.DataType.Type.MEDIUMBLOB: "String",
 774            exp.DataType.Type.MEDIUMTEXT: "String",
 775            exp.DataType.Type.TINYBLOB: "String",
 776            exp.DataType.Type.TINYTEXT: "String",
 777            exp.DataType.Type.TEXT: "String",
 778            exp.DataType.Type.VARBINARY: "String",
 779            exp.DataType.Type.VARCHAR: "String",
 780        }
 781
 782        SUPPORTED_JSON_PATH_PARTS = {
 783            exp.JSONPathKey,
 784            exp.JSONPathRoot,
 785            exp.JSONPathSubscript,
 786        }
 787
 788        TYPE_MAPPING = {
 789            **generator.Generator.TYPE_MAPPING,
 790            **STRING_TYPE_MAPPING,
 791            exp.DataType.Type.ARRAY: "Array",
 792            exp.DataType.Type.BIGINT: "Int64",
 793            exp.DataType.Type.DATE32: "Date32",
 794            exp.DataType.Type.DATETIME: "DateTime",
 795            exp.DataType.Type.DATETIME64: "DateTime64",
 796            exp.DataType.Type.TIMESTAMP: "DateTime",
 797            exp.DataType.Type.TIMESTAMPTZ: "DateTime",
 798            exp.DataType.Type.DOUBLE: "Float64",
 799            exp.DataType.Type.ENUM: "Enum",
 800            exp.DataType.Type.ENUM8: "Enum8",
 801            exp.DataType.Type.ENUM16: "Enum16",
 802            exp.DataType.Type.FIXEDSTRING: "FixedString",
 803            exp.DataType.Type.FLOAT: "Float32",
 804            exp.DataType.Type.INT: "Int32",
 805            exp.DataType.Type.MEDIUMINT: "Int32",
 806            exp.DataType.Type.INT128: "Int128",
 807            exp.DataType.Type.INT256: "Int256",
 808            exp.DataType.Type.LOWCARDINALITY: "LowCardinality",
 809            exp.DataType.Type.MAP: "Map",
 810            exp.DataType.Type.NESTED: "Nested",
 811            exp.DataType.Type.NULLABLE: "Nullable",
 812            exp.DataType.Type.SMALLINT: "Int16",
 813            exp.DataType.Type.STRUCT: "Tuple",
 814            exp.DataType.Type.TINYINT: "Int8",
 815            exp.DataType.Type.UBIGINT: "UInt64",
 816            exp.DataType.Type.UINT: "UInt32",
 817            exp.DataType.Type.UINT128: "UInt128",
 818            exp.DataType.Type.UINT256: "UInt256",
 819            exp.DataType.Type.USMALLINT: "UInt16",
 820            exp.DataType.Type.UTINYINT: "UInt8",
 821            exp.DataType.Type.IPV4: "IPv4",
 822            exp.DataType.Type.IPV6: "IPv6",
 823            exp.DataType.Type.AGGREGATEFUNCTION: "AggregateFunction",
 824            exp.DataType.Type.SIMPLEAGGREGATEFUNCTION: "SimpleAggregateFunction",
 825        }
 826
 827        TRANSFORMS = {
 828            **generator.Generator.TRANSFORMS,
 829            exp.AnyValue: rename_func("any"),
 830            exp.ApproxDistinct: rename_func("uniq"),
 831            exp.ArrayFilter: lambda self, e: self.func("arrayFilter", e.expression, e.this),
 832            exp.ArraySize: rename_func("LENGTH"),
 833            exp.ArraySum: rename_func("arraySum"),
 834            exp.ArgMax: arg_max_or_min_no_count("argMax"),
 835            exp.ArgMin: arg_max_or_min_no_count("argMin"),
 836            exp.Array: inline_array_sql,
 837            exp.CastToStrType: rename_func("CAST"),
 838            exp.CountIf: rename_func("countIf"),
 839            exp.CompressColumnConstraint: lambda self,
 840            e: f"CODEC({self.expressions(e, key='this', flat=True)})",
 841            exp.ComputedColumnConstraint: lambda self,
 842            e: f"{'MATERIALIZED' if e.args.get('persisted') else 'ALIAS'} {self.sql(e, 'this')}",
 843            exp.CurrentDate: lambda self, e: self.func("CURRENT_DATE"),
 844            exp.DateAdd: _datetime_delta_sql("DATE_ADD"),
 845            exp.DateDiff: _datetime_delta_sql("DATE_DIFF"),
 846            exp.DateStrToDate: rename_func("toDate"),
 847            exp.DateSub: _datetime_delta_sql("DATE_SUB"),
 848            exp.Explode: rename_func("arrayJoin"),
 849            exp.Final: lambda self, e: f"{self.sql(e, 'this')} FINAL",
 850            exp.IsNan: rename_func("isNaN"),
 851            exp.JSONExtract: json_extract_segments("JSONExtractString", quoted_index=False),
 852            exp.JSONExtractScalar: json_extract_segments("JSONExtractString", quoted_index=False),
 853            exp.JSONPathKey: json_path_key_only_name,
 854            exp.JSONPathRoot: lambda *_: "",
 855            exp.Map: lambda self, e: _lower_func(var_map_sql(self, e)),
 856            exp.Nullif: rename_func("nullIf"),
 857            exp.PartitionedByProperty: lambda self, e: f"PARTITION BY {self.sql(e, 'this')}",
 858            exp.Pivot: no_pivot_sql,
 859            exp.Quantile: _quantile_sql,
 860            exp.RegexpLike: lambda self, e: self.func("match", e.this, e.expression),
 861            exp.Rand: rename_func("randCanonical"),
 862            exp.StartsWith: rename_func("startsWith"),
 863            exp.StrPosition: lambda self, e: self.func(
 864                "position", e.this, e.args.get("substr"), e.args.get("position")
 865            ),
 866            exp.TimeToStr: lambda self, e: self.func(
 867                "DATE_FORMAT", e.this, self.format_time(e), e.args.get("zone")
 868            ),
 869            exp.TimeStrToTime: _timestrtotime_sql,
 870            exp.TimestampAdd: _datetime_delta_sql("TIMESTAMP_ADD"),
 871            exp.TimestampSub: _datetime_delta_sql("TIMESTAMP_SUB"),
 872            exp.VarMap: lambda self, e: _lower_func(var_map_sql(self, e)),
 873            exp.Xor: lambda self, e: self.func("xor", e.this, e.expression, *e.expressions),
 874            exp.MD5Digest: rename_func("MD5"),
 875            exp.MD5: lambda self, e: self.func("LOWER", self.func("HEX", self.func("MD5", e.this))),
 876            exp.SHA: rename_func("SHA1"),
 877            exp.SHA2: sha256_sql,
 878            exp.UnixToTime: _unix_to_time_sql,
 879            exp.TimestampTrunc: timestamptrunc_sql(zone=True),
 880            exp.Trim: trim_sql,
 881            exp.Variance: rename_func("varSamp"),
 882            exp.SchemaCommentProperty: lambda self, e: self.naked_property(e),
 883            exp.Stddev: rename_func("stddevSamp"),
 884        }
 885
 886        PROPERTIES_LOCATION = {
 887            **generator.Generator.PROPERTIES_LOCATION,
 888            exp.VolatileProperty: exp.Properties.Location.UNSUPPORTED,
 889            exp.PartitionedByProperty: exp.Properties.Location.POST_SCHEMA,
 890            exp.OnCluster: exp.Properties.Location.POST_NAME,
 891        }
 892
 893        # There's no list in docs, but it can be found in Clickhouse code
 894        # see `ClickHouse/src/Parsers/ParserCreate*.cpp`
 895        ON_CLUSTER_TARGETS = {
 896            "SCHEMA",  # Transpiled CREATE SCHEMA may have OnCluster property set
 897            "DATABASE",
 898            "TABLE",
 899            "VIEW",
 900            "DICTIONARY",
 901            "INDEX",
 902            "FUNCTION",
 903            "NAMED COLLECTION",
 904        }
 905
 906        # https://clickhouse.com/docs/en/sql-reference/data-types/nullable
 907        NON_NULLABLE_TYPES = {
 908            exp.DataType.Type.ARRAY,
 909            exp.DataType.Type.MAP,
 910            exp.DataType.Type.NULLABLE,
 911            exp.DataType.Type.STRUCT,
 912        }
 913
 914        def strtodate_sql(self, expression: exp.StrToDate) -> str:
 915            strtodate_sql = self.function_fallback_sql(expression)
 916
 917            if not isinstance(expression.parent, exp.Cast):
 918                # StrToDate returns DATEs in other dialects (eg. postgres), so
 919                # this branch aims to improve the transpilation to clickhouse
 920                return f"CAST({strtodate_sql} AS DATE)"
 921
 922            return strtodate_sql
 923
 924        def cast_sql(self, expression: exp.Cast, safe_prefix: t.Optional[str] = None) -> str:
 925            this = expression.this
 926
 927            if isinstance(this, exp.StrToDate) and expression.to == exp.DataType.build("datetime"):
 928                return self.sql(this)
 929
 930            return super().cast_sql(expression, safe_prefix=safe_prefix)
 931
 932        def trycast_sql(self, expression: exp.TryCast) -> str:
 933            dtype = expression.to
 934            if not dtype.is_type(*self.NON_NULLABLE_TYPES, check_nullable=True):
 935                # Casting x into Nullable(T) appears to behave similarly to TRY_CAST(x AS T)
 936                dtype.set("nullable", True)
 937
 938            return super().cast_sql(expression)
 939
 940        def _jsonpathsubscript_sql(self, expression: exp.JSONPathSubscript) -> str:
 941            this = self.json_path_part(expression.this)
 942            return str(int(this) + 1) if is_int(this) else this
 943
 944        def likeproperty_sql(self, expression: exp.LikeProperty) -> str:
 945            return f"AS {self.sql(expression, 'this')}"
 946
 947        def _any_to_has(
 948            self,
 949            expression: exp.EQ | exp.NEQ,
 950            default: t.Callable[[t.Any], str],
 951            prefix: str = "",
 952        ) -> str:
 953            if isinstance(expression.left, exp.Any):
 954                arr = expression.left
 955                this = expression.right
 956            elif isinstance(expression.right, exp.Any):
 957                arr = expression.right
 958                this = expression.left
 959            else:
 960                return default(expression)
 961
 962            return prefix + self.func("has", arr.this.unnest(), this)
 963
 964        def eq_sql(self, expression: exp.EQ) -> str:
 965            return self._any_to_has(expression, super().eq_sql)
 966
 967        def neq_sql(self, expression: exp.NEQ) -> str:
 968            return self._any_to_has(expression, super().neq_sql, "NOT ")
 969
 970        def regexpilike_sql(self, expression: exp.RegexpILike) -> str:
 971            # Manually add a flag to make the search case-insensitive
 972            regex = self.func("CONCAT", "'(?i)'", expression.expression)
 973            return self.func("match", expression.this, regex)
 974
 975        def datatype_sql(self, expression: exp.DataType) -> str:
 976            # String is the standard ClickHouse type, every other variant is just an alias.
 977            # Additionally, any supplied length parameter will be ignored.
 978            #
 979            # https://clickhouse.com/docs/en/sql-reference/data-types/string
 980            if expression.this in self.STRING_TYPE_MAPPING:
 981                dtype = "String"
 982            else:
 983                dtype = super().datatype_sql(expression)
 984
 985            # This section changes the type to `Nullable(...)` if the following conditions hold:
 986            # - It's marked as nullable - this ensures we won't wrap ClickHouse types with `Nullable`
 987            #   and change their semantics
 988            # - It's not the key type of a `Map`. This is because ClickHouse enforces the following
 989            #   constraint: "Type of Map key must be a type, that can be represented by integer or
 990            #   String or FixedString (possibly LowCardinality) or UUID or IPv6"
 991            # - It's not a composite type, e.g. `Nullable(Array(...))` is not a valid type
 992            parent = expression.parent
 993            if (
 994                expression.args.get("nullable") is not False
 995                and not (
 996                    isinstance(parent, exp.DataType)
 997                    and parent.is_type(exp.DataType.Type.MAP, check_nullable=True)
 998                    and expression.index in (None, 0)
 999                )
1000                and not expression.is_type(*self.NON_NULLABLE_TYPES, check_nullable=True)
1001            ):
1002                dtype = f"Nullable({dtype})"
1003
1004            return dtype
1005
1006        def cte_sql(self, expression: exp.CTE) -> str:
1007            if expression.args.get("scalar"):
1008                this = self.sql(expression, "this")
1009                alias = self.sql(expression, "alias")
1010                return f"{this} AS {alias}"
1011
1012            return super().cte_sql(expression)
1013
1014        def after_limit_modifiers(self, expression: exp.Expression) -> t.List[str]:
1015            return super().after_limit_modifiers(expression) + [
1016                (
1017                    self.seg("SETTINGS ") + self.expressions(expression, key="settings", flat=True)
1018                    if expression.args.get("settings")
1019                    else ""
1020                ),
1021                (
1022                    self.seg("FORMAT ") + self.sql(expression, "format")
1023                    if expression.args.get("format")
1024                    else ""
1025                ),
1026            ]
1027
1028        def parameterizedagg_sql(self, expression: exp.ParameterizedAgg) -> str:
1029            params = self.expressions(expression, key="params", flat=True)
1030            return self.func(expression.name, *expression.expressions) + f"({params})"
1031
1032        def anonymousaggfunc_sql(self, expression: exp.AnonymousAggFunc) -> str:
1033            return self.func(expression.name, *expression.expressions)
1034
1035        def combinedaggfunc_sql(self, expression: exp.CombinedAggFunc) -> str:
1036            return self.anonymousaggfunc_sql(expression)
1037
1038        def combinedparameterizedagg_sql(self, expression: exp.CombinedParameterizedAgg) -> str:
1039            return self.parameterizedagg_sql(expression)
1040
1041        def placeholder_sql(self, expression: exp.Placeholder) -> str:
1042            return f"{{{expression.name}: {self.sql(expression, 'kind')}}}"
1043
1044        def oncluster_sql(self, expression: exp.OnCluster) -> str:
1045            return f"ON CLUSTER {self.sql(expression, 'this')}"
1046
1047        def createable_sql(self, expression: exp.Create, locations: t.DefaultDict) -> str:
1048            if expression.kind in self.ON_CLUSTER_TARGETS and locations.get(
1049                exp.Properties.Location.POST_NAME
1050            ):
1051                this_name = self.sql(
1052                    expression.this if isinstance(expression.this, exp.Schema) else expression,
1053                    "this",
1054                )
1055                this_properties = " ".join(
1056                    [self.sql(prop) for prop in locations[exp.Properties.Location.POST_NAME]]
1057                )
1058                this_schema = self.schema_columns_sql(expression.this)
1059                return f"{this_name}{self.sep()}{this_properties}{self.sep()}{this_schema}"
1060
1061            return super().createable_sql(expression, locations)
1062
1063        def create_sql(self, expression: exp.Create) -> str:
1064            # The comment property comes last in CTAS statements, i.e. after the query
1065            query = expression.expression
1066            if isinstance(query, exp.Query):
1067                comment_prop = expression.find(exp.SchemaCommentProperty)
1068                if comment_prop:
1069                    comment_prop.pop()
1070                    query.replace(exp.paren(query))
1071            else:
1072                comment_prop = None
1073
1074            create_sql = super().create_sql(expression)
1075
1076            comment_sql = self.sql(comment_prop)
1077            comment_sql = f" {comment_sql}" if comment_sql else ""
1078
1079            return f"{create_sql}{comment_sql}"
1080
1081        def prewhere_sql(self, expression: exp.PreWhere) -> str:
1082            this = self.indent(self.sql(expression, "this"))
1083            return f"{self.seg('PREWHERE')}{self.sep()}{this}"
1084
1085        def indexcolumnconstraint_sql(self, expression: exp.IndexColumnConstraint) -> str:
1086            this = self.sql(expression, "this")
1087            this = f" {this}" if this else ""
1088            expr = self.sql(expression, "expression")
1089            expr = f" {expr}" if expr else ""
1090            index_type = self.sql(expression, "index_type")
1091            index_type = f" TYPE {index_type}" if index_type else ""
1092            granularity = self.sql(expression, "granularity")
1093            granularity = f" GRANULARITY {granularity}" if granularity else ""
1094
1095            return f"INDEX{this}{expr}{index_type}{granularity}"
1096
1097        def partition_sql(self, expression: exp.Partition) -> str:
1098            return f"PARTITION {self.expressions(expression, flat=True)}"
1099
1100        def partitionid_sql(self, expression: exp.PartitionId) -> str:
1101            return f"ID {self.sql(expression.this)}"
1102
1103        def replacepartition_sql(self, expression: exp.ReplacePartition) -> str:
1104            return (
1105                f"REPLACE {self.sql(expression.expression)} FROM {self.sql(expression, 'source')}"
1106            )
1107
1108        def projectiondef_sql(self, expression: exp.ProjectionDef) -> str:
1109            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.DATETIME: 'DATETIME'>: 'DateTime', <Type.DATETIME64: 'DATETIME64'>: 'DateTime64', <Type.TIMESTAMP: 'TIMESTAMP'>: 'DateTime', <Type.TIMESTAMPTZ: 'TIMESTAMPTZ'>: 'DateTime', <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.Operator'>: <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.TimeStrToTime'>: <function _timestrtotime_sql>, <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.Trim'>: <function trim_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 = {'DICTIONARY', 'DATABASE', 'NAMED COLLECTION', 'FUNCTION', 'SCHEMA', 'VIEW', 'INDEX', 'TABLE'}
NON_NULLABLE_TYPES = {<Type.STRUCT: 'STRUCT'>, <Type.ARRAY: 'ARRAY'>, <Type.NULLABLE: 'NULLABLE'>, <Type.MAP: 'MAP'>}
def strtodate_sql(self, expression: sqlglot.expressions.StrToDate) -> str:
914        def strtodate_sql(self, expression: exp.StrToDate) -> str:
915            strtodate_sql = self.function_fallback_sql(expression)
916
917            if not isinstance(expression.parent, exp.Cast):
918                # StrToDate returns DATEs in other dialects (eg. postgres), so
919                # this branch aims to improve the transpilation to clickhouse
920                return f"CAST({strtodate_sql} AS DATE)"
921
922            return strtodate_sql
def cast_sql( self, expression: sqlglot.expressions.Cast, safe_prefix: Optional[str] = None) -> str:
924        def cast_sql(self, expression: exp.Cast, safe_prefix: t.Optional[str] = None) -> str:
925            this = expression.this
926
927            if isinstance(this, exp.StrToDate) and expression.to == exp.DataType.build("datetime"):
928                return self.sql(this)
929
930            return super().cast_sql(expression, safe_prefix=safe_prefix)
def trycast_sql(self, expression: sqlglot.expressions.TryCast) -> str:
932        def trycast_sql(self, expression: exp.TryCast) -> str:
933            dtype = expression.to
934            if not dtype.is_type(*self.NON_NULLABLE_TYPES, check_nullable=True):
935                # Casting x into Nullable(T) appears to behave similarly to TRY_CAST(x AS T)
936                dtype.set("nullable", True)
937
938            return super().cast_sql(expression)
def likeproperty_sql(self, expression: sqlglot.expressions.LikeProperty) -> str:
944        def likeproperty_sql(self, expression: exp.LikeProperty) -> str:
945            return f"AS {self.sql(expression, 'this')}"
def eq_sql(self, expression: sqlglot.expressions.EQ) -> str:
964        def eq_sql(self, expression: exp.EQ) -> str:
965            return self._any_to_has(expression, super().eq_sql)
def neq_sql(self, expression: sqlglot.expressions.NEQ) -> str:
967        def neq_sql(self, expression: exp.NEQ) -> str:
968            return self._any_to_has(expression, super().neq_sql, "NOT ")
def regexpilike_sql(self, expression: sqlglot.expressions.RegexpILike) -> str:
970        def regexpilike_sql(self, expression: exp.RegexpILike) -> str:
971            # Manually add a flag to make the search case-insensitive
972            regex = self.func("CONCAT", "'(?i)'", expression.expression)
973            return self.func("match", expression.this, regex)
def datatype_sql(self, expression: sqlglot.expressions.DataType) -> str:
 975        def datatype_sql(self, expression: exp.DataType) -> str:
 976            # String is the standard ClickHouse type, every other variant is just an alias.
 977            # Additionally, any supplied length parameter will be ignored.
 978            #
 979            # https://clickhouse.com/docs/en/sql-reference/data-types/string
 980            if expression.this in self.STRING_TYPE_MAPPING:
 981                dtype = "String"
 982            else:
 983                dtype = super().datatype_sql(expression)
 984
 985            # This section changes the type to `Nullable(...)` if the following conditions hold:
 986            # - It's marked as nullable - this ensures we won't wrap ClickHouse types with `Nullable`
 987            #   and change their semantics
 988            # - It's not the key type of a `Map`. This is because ClickHouse enforces the following
 989            #   constraint: "Type of Map key must be a type, that can be represented by integer or
 990            #   String or FixedString (possibly LowCardinality) or UUID or IPv6"
 991            # - It's not a composite type, e.g. `Nullable(Array(...))` is not a valid type
 992            parent = expression.parent
 993            if (
 994                expression.args.get("nullable") is not False
 995                and not (
 996                    isinstance(parent, exp.DataType)
 997                    and parent.is_type(exp.DataType.Type.MAP, check_nullable=True)
 998                    and expression.index in (None, 0)
 999                )
1000                and not expression.is_type(*self.NON_NULLABLE_TYPES, check_nullable=True)
1001            ):
1002                dtype = f"Nullable({dtype})"
1003
1004            return dtype
def cte_sql(self, expression: sqlglot.expressions.CTE) -> str:
1006        def cte_sql(self, expression: exp.CTE) -> str:
1007            if expression.args.get("scalar"):
1008                this = self.sql(expression, "this")
1009                alias = self.sql(expression, "alias")
1010                return f"{this} AS {alias}"
1011
1012            return super().cte_sql(expression)
def after_limit_modifiers(self, expression: sqlglot.expressions.Expression) -> List[str]:
1014        def after_limit_modifiers(self, expression: exp.Expression) -> t.List[str]:
1015            return super().after_limit_modifiers(expression) + [
1016                (
1017                    self.seg("SETTINGS ") + self.expressions(expression, key="settings", flat=True)
1018                    if expression.args.get("settings")
1019                    else ""
1020                ),
1021                (
1022                    self.seg("FORMAT ") + self.sql(expression, "format")
1023                    if expression.args.get("format")
1024                    else ""
1025                ),
1026            ]
def parameterizedagg_sql(self, expression: sqlglot.expressions.ParameterizedAgg) -> str:
1028        def parameterizedagg_sql(self, expression: exp.ParameterizedAgg) -> str:
1029            params = self.expressions(expression, key="params", flat=True)
1030            return self.func(expression.name, *expression.expressions) + f"({params})"
def anonymousaggfunc_sql(self, expression: sqlglot.expressions.AnonymousAggFunc) -> str:
1032        def anonymousaggfunc_sql(self, expression: exp.AnonymousAggFunc) -> str:
1033            return self.func(expression.name, *expression.expressions)
def combinedaggfunc_sql(self, expression: sqlglot.expressions.CombinedAggFunc) -> str:
1035        def combinedaggfunc_sql(self, expression: exp.CombinedAggFunc) -> str:
1036            return self.anonymousaggfunc_sql(expression)
def combinedparameterizedagg_sql(self, expression: sqlglot.expressions.CombinedParameterizedAgg) -> str:
1038        def combinedparameterizedagg_sql(self, expression: exp.CombinedParameterizedAgg) -> str:
1039            return self.parameterizedagg_sql(expression)
def placeholder_sql(self, expression: sqlglot.expressions.Placeholder) -> str:
1041        def placeholder_sql(self, expression: exp.Placeholder) -> str:
1042            return f"{{{expression.name}: {self.sql(expression, 'kind')}}}"
def oncluster_sql(self, expression: sqlglot.expressions.OnCluster) -> str:
1044        def oncluster_sql(self, expression: exp.OnCluster) -> str:
1045            return f"ON CLUSTER {self.sql(expression, 'this')}"
def createable_sql( self, expression: sqlglot.expressions.Create, locations: DefaultDict) -> str:
1047        def createable_sql(self, expression: exp.Create, locations: t.DefaultDict) -> str:
1048            if expression.kind in self.ON_CLUSTER_TARGETS and locations.get(
1049                exp.Properties.Location.POST_NAME
1050            ):
1051                this_name = self.sql(
1052                    expression.this if isinstance(expression.this, exp.Schema) else expression,
1053                    "this",
1054                )
1055                this_properties = " ".join(
1056                    [self.sql(prop) for prop in locations[exp.Properties.Location.POST_NAME]]
1057                )
1058                this_schema = self.schema_columns_sql(expression.this)
1059                return f"{this_name}{self.sep()}{this_properties}{self.sep()}{this_schema}"
1060
1061            return super().createable_sql(expression, locations)
def create_sql(self, expression: sqlglot.expressions.Create) -> str:
1063        def create_sql(self, expression: exp.Create) -> str:
1064            # The comment property comes last in CTAS statements, i.e. after the query
1065            query = expression.expression
1066            if isinstance(query, exp.Query):
1067                comment_prop = expression.find(exp.SchemaCommentProperty)
1068                if comment_prop:
1069                    comment_prop.pop()
1070                    query.replace(exp.paren(query))
1071            else:
1072                comment_prop = None
1073
1074            create_sql = super().create_sql(expression)
1075
1076            comment_sql = self.sql(comment_prop)
1077            comment_sql = f" {comment_sql}" if comment_sql else ""
1078
1079            return f"{create_sql}{comment_sql}"
def prewhere_sql(self, expression: sqlglot.expressions.PreWhere) -> str:
1081        def prewhere_sql(self, expression: exp.PreWhere) -> str:
1082            this = self.indent(self.sql(expression, "this"))
1083            return f"{self.seg('PREWHERE')}{self.sep()}{this}"
def indexcolumnconstraint_sql(self, expression: sqlglot.expressions.IndexColumnConstraint) -> str:
1085        def indexcolumnconstraint_sql(self, expression: exp.IndexColumnConstraint) -> str:
1086            this = self.sql(expression, "this")
1087            this = f" {this}" if this else ""
1088            expr = self.sql(expression, "expression")
1089            expr = f" {expr}" if expr else ""
1090            index_type = self.sql(expression, "index_type")
1091            index_type = f" TYPE {index_type}" if index_type else ""
1092            granularity = self.sql(expression, "granularity")
1093            granularity = f" GRANULARITY {granularity}" if granularity else ""
1094
1095            return f"INDEX{this}{expr}{index_type}{granularity}"
def partition_sql(self, expression: sqlglot.expressions.Partition) -> str:
1097        def partition_sql(self, expression: exp.Partition) -> str:
1098            return f"PARTITION {self.expressions(expression, flat=True)}"
def partitionid_sql(self, expression: sqlglot.expressions.PartitionId) -> str:
1100        def partitionid_sql(self, expression: exp.PartitionId) -> str:
1101            return f"ID {self.sql(expression.this)}"
def replacepartition_sql(self, expression: sqlglot.expressions.ReplacePartition) -> str:
1103        def replacepartition_sql(self, expression: exp.ReplacePartition) -> str:
1104            return (
1105                f"REPLACE {self.sql(expression.expression)} FROM {self.sql(expression, 'source')}"
1106            )
def projectiondef_sql(self, expression: sqlglot.expressions.ProjectionDef) -> str:
1108        def projectiondef_sql(self, expression: exp.ProjectionDef) -> str:
1109            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
SUPPORTS_NULLABLE_TYPES
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
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
groupingsets_sql
rollup_sql
cube_sql
group_sql
having_sql
connect_sql
prior_sql
join_sql
lambda_sql
lateral_op
lateral_sql
limit_sql
offset_sql
setitem_sql
set_sql
pragma_sql
lock_sql
literal_sql
escape_str
loaddata_sql
null_sql
boolean_sql
order_sql
withfill_sql
cluster_sql
distribute_sql
sort_sql
ordered_sql
matchrecognizemeasure_sql
matchrecognize_sql
query_modifiers
options_modifier
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
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
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
json_sql
jsonvalue_sql