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

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>>, 'MOD': <function build_mod>, 'RPAD': <function Parser.<lambda>>, 'RIGHTPAD': <function Parser.<lambda>>, 'SCOPE_RESOLUTION': <function Parser.<lambda>>, 'TO_HEX': <function build_hex>, 'ANY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.AnyValue'>>, 'ARRAYSUM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySum'>>, 'DATEADD': <function build_date_delta.<locals>._builder>, 'DATE_FORMAT': <function _build_date_format>, 'DATESUB': <function build_date_delta.<locals>._builder>, 'FORMATDATETIME': <function _build_date_format>, 'JSONEXTRACTSTRING': <function build_json_extract_path.<locals>._builder>, 'MATCH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpLike'>>, 'RANDCANONICAL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Rand'>>, 'TUPLE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Struct'>>, 'TIMESTAMPSUB': <function build_date_delta.<locals>._builder>, 'TIMESTAMPADD': <function build_date_delta.<locals>._builder>, 'UNIQ': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxDistinct'>>, 'SHA256': <function ClickHouse.Parser.<lambda>>, 'SHA512': <function ClickHouse.Parser.<lambda>>}
AGG_FUNCTIONS = {'avg', 'sumKahan', 'studentTTest', 'sequenceNextNode', 'skewSamp', 'histogram', 'sumWithOverflow', 'groupArray', 'quantilesGK', 'quantileExactLow', 'kolmogorovSmirnovTest', 'groupBitmap', 'quantilesExactHigh', 'anyLast', 'groupArrayLast', 'quantilesTiming', 'quantileTimingWeighted', 'last_value', 'groupBitmapAnd', 'argMax', 'quantileDeterministic', 'groupBitXor', 'largestTriangleThreeBuckets', 'groupUniqArray', 'deltaSumTimestamp', 'varPop', 'uniqHLL12', 'categoricalInformationValue', 'sparkBar', 'quantileExactHigh', 'sequenceCount', 'quantiles', 'uniqCombined', 'avgWeighted', 'covarSamp', 'uniq', 'quantilesTimingWeighted', 'stddevSamp', 'uniqUpTo', 'quantilesInterpolatedWeighted', 'groupBitmapXor', 'first_value', 'quantileTiming', 'minMap', 'anyHeavy', 'quantilesExactWeighted', 'varSamp', 'simpleLinearRegression', 'cramersVBiasCorrected', 'mannWhitneyUTest', 'quantileExactWeighted', 'topKWeighted', 'max', 'cramersV', 'quantilesBFloat16', 'uniqTheta', 'kurtPop', 'stddevPop', 'sumMap', 'stochasticLogisticRegression', 'quantileBFloat16', 'maxMap', 'groupBitOr', 'boundingRatio', 'uniqCombined64', 'maxIntersections', 'maxIntersectionsPosition', 'contingency', 'intervalLengthSum', 'groupArraySample', 'theilsU', 'quantilesTDigestWeighted', 'exponentialMovingAverage', 'topK', 'meanZTest', 'sum', 'covarPop', 'any', 'deltaSum', 'quantileTDigest', 'stochasticLinearRegression', 'sequenceMatch', 'corr', 'retention', 'quantileTDigestWeighted', 'quantilesBFloat16Weighted', 'windowFunnel', 'groupArrayInsertAt', 'groupArrayMovingAvg', 'exponentialTimeDecayedAvg', 'skewPop', 'sumCount', 'quantileInterpolatedWeighted', 'median', 'quantilesDeterministic', 'entropy', 'quantile', 'quantileGK', 'quantileBFloat16Weighted', 'uniqExact', 'quantilesExactLow', 'quantilesTDigest', 'min', 'quantileExact', 'rankCorr', 'groupArrayMovingSum', 'quantilesExact', 'groupBitmapOr', 'kurtSamp', 'welchTTest', 'groupBitAnd', 'argMin', 'count'}
AGG_FUNCTIONS_SUFFIXES = ['If', 'Array', 'ArrayIf', 'Map', 'SimpleState', 'State', 'Merge', 'MergeState', 'ForEach', 'Distinct', 'OrDefault', 'OrNull', 'Resample', 'ArgMin', 'ArgMax']
FUNC_TOKENS = {<TokenType.INTERVAL: 'INTERVAL'>, <TokenType.UINT128: 'UINT128'>, <TokenType.NESTED: 'NESTED'>, <TokenType.SOME: 'SOME'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.NAME: 'NAME'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.INET: 'INET'>, <TokenType.FIRST: 'FIRST'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.FORMAT: 'FORMAT'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.RLIKE: 'RLIKE'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.YEAR: 'YEAR'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.ANY: 'ANY'>, <TokenType.ALL: 'ALL'>, <TokenType.TABLE: 'TABLE'>, <TokenType.RANGE: 'RANGE'>, <TokenType.LIKE: 'LIKE'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.IPV6: 'IPV6'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.UINT: 'UINT'>, <TokenType.UNIQUEIDENTIFIER: 'UNIQUEIDENTIFIER'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.RIGHT: 'RIGHT'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.BIT: 'BIT'>, <TokenType.TIME: 'TIME'>, <TokenType.CHAR: 'CHAR'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.WINDOW: 'WINDOW'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.INT256: 'INT256'>, <TokenType.INSERT: 'INSERT'>, <TokenType.MERGE: 'MERGE'>, <TokenType.ILIKE: 'ILIKE'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.JSONB: 'JSONB'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.DATE: 'DATE'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.ENUM: 'ENUM'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.VAR: 'VAR'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.XML: 'XML'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.TEXT: 'TEXT'>, <TokenType.DATE32: 'DATE32'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.ROW: 'ROW'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.MAP: 'MAP'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.LEFT: 'LEFT'>, <TokenType.UINT256: 'UINT256'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.BINARY: 'BINARY'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.INDEX: 'INDEX'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.INT: 'INT'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.FILTER: 'FILTER'>, <TokenType.SET: 'SET'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.UUID: 'UUID'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.JSON: 'JSON'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.MONEY: 'MONEY'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.GLOB: 'GLOB'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.PRIMARY_KEY: 'PRIMARY_KEY'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.SUPER: 'SUPER'>, <TokenType.IPV4: 'IPV4'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.NULL: 'NULL'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.LIST: 'LIST'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.XOR: 'XOR'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.INT128: 'INT128'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>}
RESERVED_TOKENS = {<TokenType.BACKSLASH: 'BACKSLASH'>, <TokenType.LT: 'LT'>, <TokenType.L_PAREN: 'L_PAREN'>, <TokenType.CARET: 'CARET'>, <TokenType.SLASH: 'SLASH'>, <TokenType.COLON: 'COLON'>, <TokenType.MOD: 'MOD'>, <TokenType.L_BRACKET: 'L_BRACKET'>, <TokenType.R_BRACE: 'R_BRACE'>, <TokenType.L_BRACE: 'L_BRACE'>, <TokenType.PLACEHOLDER: 'PLACEHOLDER'>, <TokenType.NOT: 'NOT'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.TILDA: 'TILDA'>, <TokenType.PARAMETER: 'PARAMETER'>, <TokenType.DOT: 'DOT'>, <TokenType.GT: 'GT'>, <TokenType.R_BRACKET: 'R_BRACKET'>, <TokenType.PIPE: 'PIPE'>, <TokenType.AMP: 'AMP'>, <TokenType.DASH: 'DASH'>, <TokenType.PLUS: 'PLUS'>, <TokenType.SEMICOLON: 'SEMICOLON'>, <TokenType.R_PAREN: 'R_PAREN'>, <TokenType.HASH: 'HASH'>, <TokenType.EQ: 'EQ'>, <TokenType.COMMA: 'COMMA'>, <TokenType.STAR: 'STAR'>}
ID_VAR_TOKENS = {<TokenType.ROLLUP: 'ROLLUP'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.UINT128: 'UINT128'>, <TokenType.UNIQUE: 'UNIQUE'>, <TokenType.NESTED: 'NESTED'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.SOME: 'SOME'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.PROCEDURE: 'PROCEDURE'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.STORAGE_INTEGRATION: 'STORAGE_INTEGRATION'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.RENAME: 'RENAME'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.NAME: 'NAME'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.IS: 'IS'>, <TokenType.INET: 'INET'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.FIRST: 'FIRST'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.FORMAT: 'FORMAT'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.NATURAL: 'NATURAL'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.CASE: 'CASE'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.ROWS: 'ROWS'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.YEAR: 'YEAR'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.ANY: 'ANY'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.ALL: 'ALL'>, <TokenType.TABLE: 'TABLE'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.RANGE: 'RANGE'>, <TokenType.LIKE: 'LIKE'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.IPV6: 'IPV6'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.SHOW: 'SHOW'>, <TokenType.SETTINGS: 'SETTINGS'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.UINT: 'UINT'>, <TokenType.UNIQUEIDENTIFIER: 'UNIQUEIDENTIFIER'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.RIGHT: 'RIGHT'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.BIT: 'BIT'>, <TokenType.TIME: 'TIME'>, <TokenType.CUBE: 'CUBE'>, <TokenType.CHAR: 'CHAR'>, <TokenType.KILL: 'KILL'>, <TokenType.END: 'END'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.WINDOW: 'WINDOW'>, <TokenType.ASC: 'ASC'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.INT256: 'INT256'>, <TokenType.MERGE: 'MERGE'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.JSONB: 'JSONB'>, <TokenType.ANTI: 'ANTI'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.MODEL: 'MODEL'>, <TokenType.DATE: 'DATE'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.ENUM: 'ENUM'>, <TokenType.CACHE: 'CACHE'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.APPLY: 'APPLY'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.COPY: 'COPY'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.VAR: 'VAR'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.XML: 'XML'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.TEXT: 'TEXT'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.DATE32: 'DATE32'>, <TokenType.LOAD: 'LOAD'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.DELETE: 'DELETE'>, <TokenType.ROW: 'ROW'>, <TokenType.WAREHOUSE: 'WAREHOUSE'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.MAP: 'MAP'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.SEMI: 'SEMI'>, <TokenType.TAG: 'TAG'>, <TokenType.LEFT: 'LEFT'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.UINT256: 'UINT256'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.STRAIGHT_JOIN: 'STRAIGHT_JOIN'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.BINARY: 'BINARY'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.ASOF: 'ASOF'>, <TokenType.INDEX: 'INDEX'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.INT: 'INT'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.FILTER: 'FILTER'>, <TokenType.SET: 'SET'>, <TokenType.TRUE: 'TRUE'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.UUID: 'UUID'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.JSON: 'JSON'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.MONEY: 'MONEY'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.FULL: 'FULL'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.DESC: 'DESC'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.USE: 'USE'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.FINAL: 'FINAL'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.SUPER: 'SUPER'>, <TokenType.REFERENCES: 'REFERENCES'>, <TokenType.IPV4: 'IPV4'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.NEXT: 'NEXT'>, <TokenType.KEEP: 'KEEP'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.VIEW: 'VIEW'>, <TokenType.NULL: 'NULL'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.LIST: 'LIST'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.DIV: 'DIV'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.FALSE: 'FALSE'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.INT128: 'INT128'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.STREAMLIT: 'STREAMLIT'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.TOP: 'TOP'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.ORDINALITY: 'ORDINALITY'>}
AGG_FUNC_MAPPING = {'avgIf': ('avg', 'If'), 'sumKahanIf': ('sumKahan', 'If'), 'studentTTestIf': ('studentTTest', 'If'), 'sequenceNextNodeIf': ('sequenceNextNode', 'If'), 'skewSampIf': ('skewSamp', 'If'), 'histogramIf': ('histogram', 'If'), 'sumWithOverflowIf': ('sumWithOverflow', 'If'), 'groupArrayIf': ('groupArray', 'If'), 'quantilesGKIf': ('quantilesGK', 'If'), 'quantileExactLowIf': ('quantileExactLow', 'If'), 'kolmogorovSmirnovTestIf': ('kolmogorovSmirnovTest', 'If'), 'groupBitmapIf': ('groupBitmap', 'If'), 'quantilesExactHighIf': ('quantilesExactHigh', 'If'), 'anyLastIf': ('anyLast', 'If'), 'groupArrayLastIf': ('groupArrayLast', 'If'), 'quantilesTimingIf': ('quantilesTiming', 'If'), 'quantileTimingWeightedIf': ('quantileTimingWeighted', 'If'), 'last_valueIf': ('last_value', 'If'), 'groupBitmapAndIf': ('groupBitmapAnd', 'If'), 'argMaxIf': ('argMax', 'If'), 'quantileDeterministicIf': ('quantileDeterministic', 'If'), 'groupBitXorIf': ('groupBitXor', 'If'), 'largestTriangleThreeBucketsIf': ('largestTriangleThreeBuckets', 'If'), 'groupUniqArrayIf': ('groupUniqArray', 'If'), 'deltaSumTimestampIf': ('deltaSumTimestamp', 'If'), 'varPopIf': ('varPop', 'If'), 'uniqHLL12If': ('uniqHLL12', 'If'), 'categoricalInformationValueIf': ('categoricalInformationValue', 'If'), 'sparkBarIf': ('sparkBar', 'If'), 'quantileExactHighIf': ('quantileExactHigh', 'If'), 'sequenceCountIf': ('sequenceCount', 'If'), 'quantilesIf': ('quantiles', 'If'), 'uniqCombinedIf': ('uniqCombined', 'If'), 'avgWeightedIf': ('avgWeighted', 'If'), 'covarSampIf': ('covarSamp', 'If'), 'uniqIf': ('uniq', 'If'), 'quantilesTimingWeightedIf': ('quantilesTimingWeighted', 'If'), 'stddevSampIf': ('stddevSamp', 'If'), 'uniqUpToIf': ('uniqUpTo', 'If'), 'quantilesInterpolatedWeightedIf': ('quantilesInterpolatedWeighted', 'If'), 'groupBitmapXorIf': ('groupBitmapXor', 'If'), 'first_valueIf': ('first_value', 'If'), 'quantileTimingIf': ('quantileTiming', 'If'), 'minMapIf': ('minMap', 'If'), 'anyHeavyIf': ('anyHeavy', 'If'), 'quantilesExactWeightedIf': ('quantilesExactWeighted', 'If'), 'varSampIf': ('varSamp', 'If'), 'simpleLinearRegressionIf': ('simpleLinearRegression', 'If'), 'cramersVBiasCorrectedIf': ('cramersVBiasCorrected', 'If'), 'mannWhitneyUTestIf': ('mannWhitneyUTest', 'If'), 'quantileExactWeightedIf': ('quantileExactWeighted', 'If'), 'topKWeightedIf': ('topKWeighted', 'If'), 'maxIf': ('max', 'If'), 'cramersVIf': ('cramersV', 'If'), 'quantilesBFloat16If': ('quantilesBFloat16', 'If'), 'uniqThetaIf': ('uniqTheta', 'If'), 'kurtPopIf': ('kurtPop', 'If'), 'stddevPopIf': ('stddevPop', 'If'), 'sumMapIf': ('sumMap', 'If'), 'stochasticLogisticRegressionIf': ('stochasticLogisticRegression', 'If'), 'quantileBFloat16If': ('quantileBFloat16', 'If'), 'maxMapIf': ('maxMap', 'If'), 'groupBitOrIf': ('groupBitOr', 'If'), 'boundingRatioIf': ('boundingRatio', 'If'), 'uniqCombined64If': ('uniqCombined64', 'If'), 'maxIntersectionsIf': ('maxIntersections', 'If'), 'maxIntersectionsPositionIf': ('maxIntersectionsPosition', 'If'), 'contingencyIf': ('contingency', 'If'), 'intervalLengthSumIf': ('intervalLengthSum', 'If'), 'groupArraySampleIf': ('groupArraySample', 'If'), 'theilsUIf': ('theilsU', 'If'), 'quantilesTDigestWeightedIf': ('quantilesTDigestWeighted', 'If'), 'exponentialMovingAverageIf': ('exponentialMovingAverage', 'If'), 'topKIf': ('topK', 'If'), 'meanZTestIf': ('meanZTest', 'If'), 'sumIf': ('sum', 'If'), 'covarPopIf': ('covarPop', 'If'), 'anyIf': ('any', 'If'), 'deltaSumIf': ('deltaSum', 'If'), 'quantileTDigestIf': ('quantileTDigest', 'If'), 'stochasticLinearRegressionIf': ('stochasticLinearRegression', 'If'), 'sequenceMatchIf': ('sequenceMatch', 'If'), 'corrIf': ('corr', 'If'), 'retentionIf': ('retention', 'If'), 'quantileTDigestWeightedIf': ('quantileTDigestWeighted', 'If'), 'quantilesBFloat16WeightedIf': ('quantilesBFloat16Weighted', 'If'), 'windowFunnelIf': ('windowFunnel', 'If'), 'groupArrayInsertAtIf': ('groupArrayInsertAt', 'If'), 'groupArrayMovingAvgIf': ('groupArrayMovingAvg', 'If'), 'exponentialTimeDecayedAvgIf': ('exponentialTimeDecayedAvg', 'If'), 'skewPopIf': ('skewPop', 'If'), 'sumCountIf': ('sumCount', 'If'), 'quantileInterpolatedWeightedIf': ('quantileInterpolatedWeighted', 'If'), 'medianIf': ('median', 'If'), 'quantilesDeterministicIf': ('quantilesDeterministic', 'If'), 'entropyIf': ('entropy', 'If'), 'quantileIf': ('quantile', 'If'), 'quantileGKIf': ('quantileGK', 'If'), 'quantileBFloat16WeightedIf': ('quantileBFloat16Weighted', 'If'), 'uniqExactIf': ('uniqExact', 'If'), 'quantilesExactLowIf': ('quantilesExactLow', 'If'), 'quantilesTDigestIf': ('quantilesTDigest', 'If'), 'minIf': ('min', 'If'), 'quantileExactIf': ('quantileExact', 'If'), 'rankCorrIf': ('rankCorr', 'If'), 'groupArrayMovingSumIf': ('groupArrayMovingSum', 'If'), 'quantilesExactIf': ('quantilesExact', 'If'), 'groupBitmapOrIf': ('groupBitmapOr', 'If'), 'kurtSampIf': ('kurtSamp', 'If'), 'welchTTestIf': ('welchTTest', 'If'), 'groupBitAndIf': ('groupBitAnd', 'If'), 'argMinIf': ('argMin', 'If'), 'countIf': ('count', 'If'), 'avgArray': ('avg', 'Array'), 'sumKahanArray': ('sumKahan', 'Array'), 'studentTTestArray': ('studentTTest', 'Array'), 'sequenceNextNodeArray': ('sequenceNextNode', 'Array'), 'skewSampArray': ('skewSamp', 'Array'), 'histogramArray': ('histogram', 'Array'), 'sumWithOverflowArray': ('sumWithOverflow', 'Array'), 'groupArrayArray': ('groupArray', 'Array'), 'quantilesGKArray': ('quantilesGK', 'Array'), 'quantileExactLowArray': ('quantileExactLow', 'Array'), 'kolmogorovSmirnovTestArray': ('kolmogorovSmirnovTest', 'Array'), 'groupBitmapArray': ('groupBitmap', 'Array'), 'quantilesExactHighArray': ('quantilesExactHigh', 'Array'), 'anyLastArray': ('anyLast', 'Array'), 'groupArrayLastArray': ('groupArrayLast', 'Array'), 'quantilesTimingArray': ('quantilesTiming', 'Array'), 'quantileTimingWeightedArray': ('quantileTimingWeighted', 'Array'), 'last_valueArray': ('last_value', 'Array'), 'groupBitmapAndArray': ('groupBitmapAnd', 'Array'), 'argMaxArray': ('argMax', 'Array'), 'quantileDeterministicArray': ('quantileDeterministic', 'Array'), 'groupBitXorArray': ('groupBitXor', 'Array'), 'largestTriangleThreeBucketsArray': ('largestTriangleThreeBuckets', 'Array'), 'groupUniqArrayArray': ('groupUniqArray', 'Array'), 'deltaSumTimestampArray': ('deltaSumTimestamp', 'Array'), 'varPopArray': ('varPop', 'Array'), 'uniqHLL12Array': ('uniqHLL12', 'Array'), 'categoricalInformationValueArray': ('categoricalInformationValue', 'Array'), 'sparkBarArray': ('sparkBar', 'Array'), 'quantileExactHighArray': ('quantileExactHigh', 'Array'), 'sequenceCountArray': ('sequenceCount', 'Array'), 'quantilesArray': ('quantiles', 'Array'), 'uniqCombinedArray': ('uniqCombined', 'Array'), 'avgWeightedArray': ('avgWeighted', 'Array'), 'covarSampArray': ('covarSamp', 'Array'), 'uniqArray': ('uniq', 'Array'), 'quantilesTimingWeightedArray': ('quantilesTimingWeighted', 'Array'), 'stddevSampArray': ('stddevSamp', 'Array'), 'uniqUpToArray': ('uniqUpTo', 'Array'), 'quantilesInterpolatedWeightedArray': ('quantilesInterpolatedWeighted', 'Array'), 'groupBitmapXorArray': ('groupBitmapXor', 'Array'), 'first_valueArray': ('first_value', 'Array'), 'quantileTimingArray': ('quantileTiming', 'Array'), 'minMapArray': ('minMap', 'Array'), 'anyHeavyArray': ('anyHeavy', 'Array'), 'quantilesExactWeightedArray': ('quantilesExactWeighted', 'Array'), 'varSampArray': ('varSamp', 'Array'), 'simpleLinearRegressionArray': ('simpleLinearRegression', 'Array'), 'cramersVBiasCorrectedArray': ('cramersVBiasCorrected', 'Array'), 'mannWhitneyUTestArray': ('mannWhitneyUTest', 'Array'), 'quantileExactWeightedArray': ('quantileExactWeighted', 'Array'), 'topKWeightedArray': ('topKWeighted', 'Array'), 'maxArray': ('max', 'Array'), 'cramersVArray': ('cramersV', 'Array'), 'quantilesBFloat16Array': ('quantilesBFloat16', 'Array'), 'uniqThetaArray': ('uniqTheta', 'Array'), 'kurtPopArray': ('kurtPop', 'Array'), 'stddevPopArray': ('stddevPop', 'Array'), 'sumMapArray': ('sumMap', 'Array'), 'stochasticLogisticRegressionArray': ('stochasticLogisticRegression', 'Array'), 'quantileBFloat16Array': ('quantileBFloat16', 'Array'), 'maxMapArray': ('maxMap', 'Array'), 'groupBitOrArray': ('groupBitOr', 'Array'), 'boundingRatioArray': ('boundingRatio', 'Array'), 'uniqCombined64Array': ('uniqCombined64', 'Array'), 'maxIntersectionsArray': ('maxIntersections', 'Array'), 'maxIntersectionsPositionArray': ('maxIntersectionsPosition', 'Array'), 'contingencyArray': ('contingency', 'Array'), 'intervalLengthSumArray': ('intervalLengthSum', 'Array'), 'groupArraySampleArray': ('groupArraySample', 'Array'), 'theilsUArray': ('theilsU', 'Array'), 'quantilesTDigestWeightedArray': ('quantilesTDigestWeighted', 'Array'), 'exponentialMovingAverageArray': ('exponentialMovingAverage', 'Array'), 'topKArray': ('topK', 'Array'), 'meanZTestArray': ('meanZTest', 'Array'), 'sumArray': ('sum', 'Array'), 'covarPopArray': ('covarPop', 'Array'), 'anyArray': ('any', 'Array'), 'deltaSumArray': ('deltaSum', 'Array'), 'quantileTDigestArray': ('quantileTDigest', 'Array'), 'stochasticLinearRegressionArray': ('stochasticLinearRegression', 'Array'), 'sequenceMatchArray': ('sequenceMatch', 'Array'), 'corrArray': ('corr', 'Array'), 'retentionArray': ('retention', 'Array'), 'quantileTDigestWeightedArray': ('quantileTDigestWeighted', 'Array'), 'quantilesBFloat16WeightedArray': ('quantilesBFloat16Weighted', 'Array'), 'windowFunnelArray': ('windowFunnel', 'Array'), 'groupArrayInsertAtArray': ('groupArrayInsertAt', 'Array'), 'groupArrayMovingAvgArray': ('groupArrayMovingAvg', 'Array'), 'exponentialTimeDecayedAvgArray': ('exponentialTimeDecayedAvg', 'Array'), 'skewPopArray': ('skewPop', 'Array'), 'sumCountArray': ('sumCount', 'Array'), 'quantileInterpolatedWeightedArray': ('quantileInterpolatedWeighted', 'Array'), 'medianArray': ('median', 'Array'), 'quantilesDeterministicArray': ('quantilesDeterministic', 'Array'), 'entropyArray': ('entropy', 'Array'), 'quantileArray': ('quantile', 'Array'), 'quantileGKArray': ('quantileGK', 'Array'), 'quantileBFloat16WeightedArray': ('quantileBFloat16Weighted', 'Array'), 'uniqExactArray': ('uniqExact', 'Array'), 'quantilesExactLowArray': ('quantilesExactLow', 'Array'), 'quantilesTDigestArray': ('quantilesTDigest', 'Array'), 'minArray': ('min', 'Array'), 'quantileExactArray': ('quantileExact', 'Array'), 'rankCorrArray': ('rankCorr', 'Array'), 'groupArrayMovingSumArray': ('groupArrayMovingSum', 'Array'), 'quantilesExactArray': ('quantilesExact', 'Array'), 'groupBitmapOrArray': ('groupBitmapOr', 'Array'), 'kurtSampArray': ('kurtSamp', 'Array'), 'welchTTestArray': ('welchTTest', 'Array'), 'groupBitAndArray': ('groupBitAnd', 'Array'), 'argMinArray': ('argMin', 'Array'), 'countArray': ('count', 'Array'), 'avgArrayIf': ('avg', 'ArrayIf'), 'sumKahanArrayIf': ('sumKahan', 'ArrayIf'), 'studentTTestArrayIf': ('studentTTest', 'ArrayIf'), 'sequenceNextNodeArrayIf': ('sequenceNextNode', 'ArrayIf'), 'skewSampArrayIf': ('skewSamp', 'ArrayIf'), 'histogramArrayIf': ('histogram', 'ArrayIf'), 'sumWithOverflowArrayIf': ('sumWithOverflow', 'ArrayIf'), 'groupArrayArrayIf': ('groupArray', 'ArrayIf'), 'quantilesGKArrayIf': ('quantilesGK', 'ArrayIf'), 'quantileExactLowArrayIf': ('quantileExactLow', 'ArrayIf'), 'kolmogorovSmirnovTestArrayIf': ('kolmogorovSmirnovTest', 'ArrayIf'), 'groupBitmapArrayIf': ('groupBitmap', 'ArrayIf'), 'quantilesExactHighArrayIf': ('quantilesExactHigh', 'ArrayIf'), 'anyLastArrayIf': ('anyLast', 'ArrayIf'), 'groupArrayLastArrayIf': ('groupArrayLast', 'ArrayIf'), 'quantilesTimingArrayIf': ('quantilesTiming', 'ArrayIf'), 'quantileTimingWeightedArrayIf': ('quantileTimingWeighted', 'ArrayIf'), 'last_valueArrayIf': ('last_value', 'ArrayIf'), 'groupBitmapAndArrayIf': ('groupBitmapAnd', 'ArrayIf'), 'argMaxArrayIf': ('argMax', 'ArrayIf'), 'quantileDeterministicArrayIf': ('quantileDeterministic', 'ArrayIf'), 'groupBitXorArrayIf': ('groupBitXor', 'ArrayIf'), 'largestTriangleThreeBucketsArrayIf': ('largestTriangleThreeBuckets', 'ArrayIf'), 'groupUniqArrayArrayIf': ('groupUniqArray', 'ArrayIf'), 'deltaSumTimestampArrayIf': ('deltaSumTimestamp', 'ArrayIf'), 'varPopArrayIf': ('varPop', 'ArrayIf'), 'uniqHLL12ArrayIf': ('uniqHLL12', 'ArrayIf'), 'categoricalInformationValueArrayIf': ('categoricalInformationValue', 'ArrayIf'), 'sparkBarArrayIf': ('sparkBar', 'ArrayIf'), 'quantileExactHighArrayIf': ('quantileExactHigh', 'ArrayIf'), 'sequenceCountArrayIf': ('sequenceCount', 'ArrayIf'), 'quantilesArrayIf': ('quantiles', 'ArrayIf'), 'uniqCombinedArrayIf': ('uniqCombined', 'ArrayIf'), 'avgWeightedArrayIf': ('avgWeighted', 'ArrayIf'), 'covarSampArrayIf': ('covarSamp', 'ArrayIf'), 'uniqArrayIf': ('uniq', 'ArrayIf'), 'quantilesTimingWeightedArrayIf': ('quantilesTimingWeighted', 'ArrayIf'), 'stddevSampArrayIf': ('stddevSamp', 'ArrayIf'), 'uniqUpToArrayIf': ('uniqUpTo', 'ArrayIf'), 'quantilesInterpolatedWeightedArrayIf': ('quantilesInterpolatedWeighted', 'ArrayIf'), 'groupBitmapXorArrayIf': ('groupBitmapXor', 'ArrayIf'), 'first_valueArrayIf': ('first_value', 'ArrayIf'), 'quantileTimingArrayIf': ('quantileTiming', 'ArrayIf'), 'minMapArrayIf': ('minMap', 'ArrayIf'), 'anyHeavyArrayIf': ('anyHeavy', 'ArrayIf'), 'quantilesExactWeightedArrayIf': ('quantilesExactWeighted', 'ArrayIf'), 'varSampArrayIf': ('varSamp', 'ArrayIf'), 'simpleLinearRegressionArrayIf': ('simpleLinearRegression', 'ArrayIf'), 'cramersVBiasCorrectedArrayIf': ('cramersVBiasCorrected', 'ArrayIf'), 'mannWhitneyUTestArrayIf': ('mannWhitneyUTest', 'ArrayIf'), 'quantileExactWeightedArrayIf': ('quantileExactWeighted', 'ArrayIf'), 'topKWeightedArrayIf': ('topKWeighted', 'ArrayIf'), 'maxArrayIf': ('max', 'ArrayIf'), 'cramersVArrayIf': ('cramersV', 'ArrayIf'), 'quantilesBFloat16ArrayIf': ('quantilesBFloat16', 'ArrayIf'), 'uniqThetaArrayIf': ('uniqTheta', 'ArrayIf'), 'kurtPopArrayIf': ('kurtPop', 'ArrayIf'), 'stddevPopArrayIf': ('stddevPop', 'ArrayIf'), 'sumMapArrayIf': ('sumMap', 'ArrayIf'), 'stochasticLogisticRegressionArrayIf': ('stochasticLogisticRegression', 'ArrayIf'), 'quantileBFloat16ArrayIf': ('quantileBFloat16', 'ArrayIf'), 'maxMapArrayIf': ('maxMap', 'ArrayIf'), 'groupBitOrArrayIf': ('groupBitOr', 'ArrayIf'), 'boundingRatioArrayIf': ('boundingRatio', 'ArrayIf'), 'uniqCombined64ArrayIf': ('uniqCombined64', 'ArrayIf'), 'maxIntersectionsArrayIf': ('maxIntersections', 'ArrayIf'), 'maxIntersectionsPositionArrayIf': ('maxIntersectionsPosition', 'ArrayIf'), 'contingencyArrayIf': ('contingency', 'ArrayIf'), 'intervalLengthSumArrayIf': ('intervalLengthSum', 'ArrayIf'), 'groupArraySampleArrayIf': ('groupArraySample', 'ArrayIf'), 'theilsUArrayIf': ('theilsU', 'ArrayIf'), 'quantilesTDigestWeightedArrayIf': ('quantilesTDigestWeighted', 'ArrayIf'), 'exponentialMovingAverageArrayIf': ('exponentialMovingAverage', 'ArrayIf'), 'topKArrayIf': ('topK', 'ArrayIf'), 'meanZTestArrayIf': ('meanZTest', 'ArrayIf'), 'sumArrayIf': ('sum', 'ArrayIf'), 'covarPopArrayIf': ('covarPop', 'ArrayIf'), 'anyArrayIf': ('any', 'ArrayIf'), 'deltaSumArrayIf': ('deltaSum', 'ArrayIf'), 'quantileTDigestArrayIf': ('quantileTDigest', 'ArrayIf'), 'stochasticLinearRegressionArrayIf': ('stochasticLinearRegression', 'ArrayIf'), 'sequenceMatchArrayIf': ('sequenceMatch', 'ArrayIf'), 'corrArrayIf': ('corr', 'ArrayIf'), 'retentionArrayIf': ('retention', 'ArrayIf'), 'quantileTDigestWeightedArrayIf': ('quantileTDigestWeighted', 'ArrayIf'), 'quantilesBFloat16WeightedArrayIf': ('quantilesBFloat16Weighted', 'ArrayIf'), 'windowFunnelArrayIf': ('windowFunnel', 'ArrayIf'), 'groupArrayInsertAtArrayIf': ('groupArrayInsertAt', 'ArrayIf'), 'groupArrayMovingAvgArrayIf': ('groupArrayMovingAvg', 'ArrayIf'), 'exponentialTimeDecayedAvgArrayIf': ('exponentialTimeDecayedAvg', 'ArrayIf'), 'skewPopArrayIf': ('skewPop', 'ArrayIf'), 'sumCountArrayIf': ('sumCount', 'ArrayIf'), 'quantileInterpolatedWeightedArrayIf': ('quantileInterpolatedWeighted', 'ArrayIf'), 'medianArrayIf': ('median', 'ArrayIf'), 'quantilesDeterministicArrayIf': ('quantilesDeterministic', 'ArrayIf'), 'entropyArrayIf': ('entropy', 'ArrayIf'), 'quantileArrayIf': ('quantile', 'ArrayIf'), 'quantileGKArrayIf': ('quantileGK', 'ArrayIf'), 'quantileBFloat16WeightedArrayIf': ('quantileBFloat16Weighted', 'ArrayIf'), 'uniqExactArrayIf': ('uniqExact', 'ArrayIf'), 'quantilesExactLowArrayIf': ('quantilesExactLow', 'ArrayIf'), 'quantilesTDigestArrayIf': ('quantilesTDigest', 'ArrayIf'), 'minArrayIf': ('min', 'ArrayIf'), 'quantileExactArrayIf': ('quantileExact', 'ArrayIf'), 'rankCorrArrayIf': ('rankCorr', 'ArrayIf'), 'groupArrayMovingSumArrayIf': ('groupArrayMovingSum', 'ArrayIf'), 'quantilesExactArrayIf': ('quantilesExact', 'ArrayIf'), 'groupBitmapOrArrayIf': ('groupBitmapOr', 'ArrayIf'), 'kurtSampArrayIf': ('kurtSamp', 'ArrayIf'), 'welchTTestArrayIf': ('welchTTest', 'ArrayIf'), 'groupBitAndArrayIf': ('groupBitAnd', 'ArrayIf'), 'argMinArrayIf': ('argMin', 'ArrayIf'), 'countArrayIf': ('count', 'ArrayIf'), 'avgMap': ('avg', 'Map'), 'sumKahanMap': ('sumKahan', 'Map'), 'studentTTestMap': ('studentTTest', 'Map'), 'sequenceNextNodeMap': ('sequenceNextNode', 'Map'), 'skewSampMap': ('skewSamp', 'Map'), 'histogramMap': ('histogram', 'Map'), 'sumWithOverflowMap': ('sumWithOverflow', 'Map'), 'groupArrayMap': ('groupArray', 'Map'), 'quantilesGKMap': ('quantilesGK', 'Map'), 'quantileExactLowMap': ('quantileExactLow', 'Map'), 'kolmogorovSmirnovTestMap': ('kolmogorovSmirnovTest', 'Map'), 'groupBitmapMap': ('groupBitmap', 'Map'), 'quantilesExactHighMap': ('quantilesExactHigh', 'Map'), 'anyLastMap': ('anyLast', 'Map'), 'groupArrayLastMap': ('groupArrayLast', 'Map'), 'quantilesTimingMap': ('quantilesTiming', 'Map'), 'quantileTimingWeightedMap': ('quantileTimingWeighted', 'Map'), 'last_valueMap': ('last_value', 'Map'), 'groupBitmapAndMap': ('groupBitmapAnd', 'Map'), 'argMaxMap': ('argMax', 'Map'), 'quantileDeterministicMap': ('quantileDeterministic', 'Map'), 'groupBitXorMap': ('groupBitXor', 'Map'), 'largestTriangleThreeBucketsMap': ('largestTriangleThreeBuckets', 'Map'), 'groupUniqArrayMap': ('groupUniqArray', 'Map'), 'deltaSumTimestampMap': ('deltaSumTimestamp', 'Map'), 'varPopMap': ('varPop', 'Map'), 'uniqHLL12Map': ('uniqHLL12', 'Map'), 'categoricalInformationValueMap': ('categoricalInformationValue', 'Map'), 'sparkBarMap': ('sparkBar', 'Map'), 'quantileExactHighMap': ('quantileExactHigh', 'Map'), 'sequenceCountMap': ('sequenceCount', 'Map'), 'quantilesMap': ('quantiles', 'Map'), 'uniqCombinedMap': ('uniqCombined', 'Map'), 'avgWeightedMap': ('avgWeighted', 'Map'), 'covarSampMap': ('covarSamp', 'Map'), 'uniqMap': ('uniq', 'Map'), 'quantilesTimingWeightedMap': ('quantilesTimingWeighted', 'Map'), 'stddevSampMap': ('stddevSamp', 'Map'), 'uniqUpToMap': ('uniqUpTo', 'Map'), 'quantilesInterpolatedWeightedMap': ('quantilesInterpolatedWeighted', 'Map'), 'groupBitmapXorMap': ('groupBitmapXor', 'Map'), 'first_valueMap': ('first_value', 'Map'), 'quantileTimingMap': ('quantileTiming', 'Map'), 'minMapMap': ('minMap', 'Map'), 'anyHeavyMap': ('anyHeavy', 'Map'), 'quantilesExactWeightedMap': ('quantilesExactWeighted', 'Map'), 'varSampMap': ('varSamp', 'Map'), 'simpleLinearRegressionMap': ('simpleLinearRegression', 'Map'), 'cramersVBiasCorrectedMap': ('cramersVBiasCorrected', 'Map'), 'mannWhitneyUTestMap': ('mannWhitneyUTest', 'Map'), 'quantileExactWeightedMap': ('quantileExactWeighted', 'Map'), 'topKWeightedMap': ('topKWeighted', 'Map'), 'maxMap': ('maxMap', ''), 'cramersVMap': ('cramersV', 'Map'), 'quantilesBFloat16Map': ('quantilesBFloat16', 'Map'), 'uniqThetaMap': ('uniqTheta', 'Map'), 'kurtPopMap': ('kurtPop', 'Map'), 'stddevPopMap': ('stddevPop', 'Map'), 'sumMapMap': ('sumMap', 'Map'), 'stochasticLogisticRegressionMap': ('stochasticLogisticRegression', 'Map'), 'quantileBFloat16Map': ('quantileBFloat16', 'Map'), 'maxMapMap': ('maxMap', 'Map'), 'groupBitOrMap': ('groupBitOr', 'Map'), 'boundingRatioMap': ('boundingRatio', 'Map'), 'uniqCombined64Map': ('uniqCombined64', 'Map'), 'maxIntersectionsMap': ('maxIntersections', 'Map'), 'maxIntersectionsPositionMap': ('maxIntersectionsPosition', 'Map'), 'contingencyMap': ('contingency', 'Map'), 'intervalLengthSumMap': ('intervalLengthSum', 'Map'), 'groupArraySampleMap': ('groupArraySample', 'Map'), 'theilsUMap': ('theilsU', 'Map'), 'quantilesTDigestWeightedMap': ('quantilesTDigestWeighted', 'Map'), 'exponentialMovingAverageMap': ('exponentialMovingAverage', 'Map'), 'topKMap': ('topK', 'Map'), 'meanZTestMap': ('meanZTest', 'Map'), 'sumMap': ('sumMap', ''), 'covarPopMap': ('covarPop', 'Map'), 'anyMap': ('any', 'Map'), 'deltaSumMap': ('deltaSum', 'Map'), 'quantileTDigestMap': ('quantileTDigest', 'Map'), 'stochasticLinearRegressionMap': ('stochasticLinearRegression', 'Map'), 'sequenceMatchMap': ('sequenceMatch', 'Map'), 'corrMap': ('corr', 'Map'), 'retentionMap': ('retention', 'Map'), 'quantileTDigestWeightedMap': ('quantileTDigestWeighted', 'Map'), 'quantilesBFloat16WeightedMap': ('quantilesBFloat16Weighted', 'Map'), 'windowFunnelMap': ('windowFunnel', 'Map'), 'groupArrayInsertAtMap': ('groupArrayInsertAt', 'Map'), 'groupArrayMovingAvgMap': ('groupArrayMovingAvg', 'Map'), 'exponentialTimeDecayedAvgMap': ('exponentialTimeDecayedAvg', 'Map'), 'skewPopMap': ('skewPop', 'Map'), 'sumCountMap': ('sumCount', 'Map'), 'quantileInterpolatedWeightedMap': ('quantileInterpolatedWeighted', 'Map'), 'medianMap': ('median', 'Map'), 'quantilesDeterministicMap': ('quantilesDeterministic', 'Map'), 'entropyMap': ('entropy', 'Map'), 'quantileMap': ('quantile', 'Map'), 'quantileGKMap': ('quantileGK', 'Map'), 'quantileBFloat16WeightedMap': ('quantileBFloat16Weighted', 'Map'), 'uniqExactMap': ('uniqExact', 'Map'), 'quantilesExactLowMap': ('quantilesExactLow', 'Map'), 'quantilesTDigestMap': ('quantilesTDigest', 'Map'), 'minMap': ('minMap', ''), 'quantileExactMap': ('quantileExact', 'Map'), 'rankCorrMap': ('rankCorr', 'Map'), 'groupArrayMovingSumMap': ('groupArrayMovingSum', 'Map'), 'quantilesExactMap': ('quantilesExact', 'Map'), 'groupBitmapOrMap': ('groupBitmapOr', 'Map'), 'kurtSampMap': ('kurtSamp', 'Map'), 'welchTTestMap': ('welchTTest', 'Map'), 'groupBitAndMap': ('groupBitAnd', 'Map'), 'argMinMap': ('argMin', 'Map'), 'countMap': ('count', 'Map'), 'avgSimpleState': ('avg', 'SimpleState'), 'sumKahanSimpleState': ('sumKahan', 'SimpleState'), 'studentTTestSimpleState': ('studentTTest', 'SimpleState'), 'sequenceNextNodeSimpleState': ('sequenceNextNode', 'SimpleState'), 'skewSampSimpleState': ('skewSamp', 'SimpleState'), 'histogramSimpleState': ('histogram', 'SimpleState'), 'sumWithOverflowSimpleState': ('sumWithOverflow', 'SimpleState'), 'groupArraySimpleState': ('groupArray', 'SimpleState'), 'quantilesGKSimpleState': ('quantilesGK', 'SimpleState'), 'quantileExactLowSimpleState': ('quantileExactLow', 'SimpleState'), 'kolmogorovSmirnovTestSimpleState': ('kolmogorovSmirnovTest', 'SimpleState'), 'groupBitmapSimpleState': ('groupBitmap', 'SimpleState'), 'quantilesExactHighSimpleState': ('quantilesExactHigh', 'SimpleState'), 'anyLastSimpleState': ('anyLast', 'SimpleState'), 'groupArrayLastSimpleState': ('groupArrayLast', 'SimpleState'), 'quantilesTimingSimpleState': ('quantilesTiming', 'SimpleState'), 'quantileTimingWeightedSimpleState': ('quantileTimingWeighted', 'SimpleState'), 'last_valueSimpleState': ('last_value', 'SimpleState'), 'groupBitmapAndSimpleState': ('groupBitmapAnd', 'SimpleState'), 'argMaxSimpleState': ('argMax', 'SimpleState'), 'quantileDeterministicSimpleState': ('quantileDeterministic', 'SimpleState'), 'groupBitXorSimpleState': ('groupBitXor', 'SimpleState'), 'largestTriangleThreeBucketsSimpleState': ('largestTriangleThreeBuckets', 'SimpleState'), 'groupUniqArraySimpleState': ('groupUniqArray', 'SimpleState'), 'deltaSumTimestampSimpleState': ('deltaSumTimestamp', 'SimpleState'), 'varPopSimpleState': ('varPop', 'SimpleState'), 'uniqHLL12SimpleState': ('uniqHLL12', 'SimpleState'), 'categoricalInformationValueSimpleState': ('categoricalInformationValue', 'SimpleState'), 'sparkBarSimpleState': ('sparkBar', 'SimpleState'), 'quantileExactHighSimpleState': ('quantileExactHigh', 'SimpleState'), 'sequenceCountSimpleState': ('sequenceCount', 'SimpleState'), 'quantilesSimpleState': ('quantiles', 'SimpleState'), 'uniqCombinedSimpleState': ('uniqCombined', 'SimpleState'), 'avgWeightedSimpleState': ('avgWeighted', 'SimpleState'), 'covarSampSimpleState': ('covarSamp', 'SimpleState'), 'uniqSimpleState': ('uniq', 'SimpleState'), 'quantilesTimingWeightedSimpleState': ('quantilesTimingWeighted', 'SimpleState'), 'stddevSampSimpleState': ('stddevSamp', 'SimpleState'), 'uniqUpToSimpleState': ('uniqUpTo', 'SimpleState'), 'quantilesInterpolatedWeightedSimpleState': ('quantilesInterpolatedWeighted', 'SimpleState'), 'groupBitmapXorSimpleState': ('groupBitmapXor', 'SimpleState'), 'first_valueSimpleState': ('first_value', 'SimpleState'), 'quantileTimingSimpleState': ('quantileTiming', 'SimpleState'), 'minMapSimpleState': ('minMap', 'SimpleState'), 'anyHeavySimpleState': ('anyHeavy', 'SimpleState'), 'quantilesExactWeightedSimpleState': ('quantilesExactWeighted', 'SimpleState'), 'varSampSimpleState': ('varSamp', 'SimpleState'), 'simpleLinearRegressionSimpleState': ('simpleLinearRegression', 'SimpleState'), 'cramersVBiasCorrectedSimpleState': ('cramersVBiasCorrected', 'SimpleState'), 'mannWhitneyUTestSimpleState': ('mannWhitneyUTest', 'SimpleState'), 'quantileExactWeightedSimpleState': ('quantileExactWeighted', 'SimpleState'), 'topKWeightedSimpleState': ('topKWeighted', 'SimpleState'), 'maxSimpleState': ('max', 'SimpleState'), 'cramersVSimpleState': ('cramersV', 'SimpleState'), 'quantilesBFloat16SimpleState': ('quantilesBFloat16', 'SimpleState'), 'uniqThetaSimpleState': ('uniqTheta', 'SimpleState'), 'kurtPopSimpleState': ('kurtPop', 'SimpleState'), 'stddevPopSimpleState': ('stddevPop', 'SimpleState'), 'sumMapSimpleState': ('sumMap', 'SimpleState'), 'stochasticLogisticRegressionSimpleState': ('stochasticLogisticRegression', 'SimpleState'), 'quantileBFloat16SimpleState': ('quantileBFloat16', 'SimpleState'), 'maxMapSimpleState': ('maxMap', 'SimpleState'), 'groupBitOrSimpleState': ('groupBitOr', 'SimpleState'), 'boundingRatioSimpleState': ('boundingRatio', 'SimpleState'), 'uniqCombined64SimpleState': ('uniqCombined64', 'SimpleState'), 'maxIntersectionsSimpleState': ('maxIntersections', 'SimpleState'), 'maxIntersectionsPositionSimpleState': ('maxIntersectionsPosition', 'SimpleState'), 'contingencySimpleState': ('contingency', 'SimpleState'), 'intervalLengthSumSimpleState': ('intervalLengthSum', 'SimpleState'), 'groupArraySampleSimpleState': ('groupArraySample', 'SimpleState'), 'theilsUSimpleState': ('theilsU', 'SimpleState'), 'quantilesTDigestWeightedSimpleState': ('quantilesTDigestWeighted', 'SimpleState'), 'exponentialMovingAverageSimpleState': ('exponentialMovingAverage', 'SimpleState'), 'topKSimpleState': ('topK', 'SimpleState'), 'meanZTestSimpleState': ('meanZTest', 'SimpleState'), 'sumSimpleState': ('sum', 'SimpleState'), 'covarPopSimpleState': ('covarPop', 'SimpleState'), 'anySimpleState': ('any', 'SimpleState'), 'deltaSumSimpleState': ('deltaSum', 'SimpleState'), 'quantileTDigestSimpleState': ('quantileTDigest', 'SimpleState'), 'stochasticLinearRegressionSimpleState': ('stochasticLinearRegression', 'SimpleState'), 'sequenceMatchSimpleState': ('sequenceMatch', 'SimpleState'), 'corrSimpleState': ('corr', 'SimpleState'), 'retentionSimpleState': ('retention', 'SimpleState'), 'quantileTDigestWeightedSimpleState': ('quantileTDigestWeighted', 'SimpleState'), 'quantilesBFloat16WeightedSimpleState': ('quantilesBFloat16Weighted', 'SimpleState'), 'windowFunnelSimpleState': ('windowFunnel', 'SimpleState'), 'groupArrayInsertAtSimpleState': ('groupArrayInsertAt', 'SimpleState'), 'groupArrayMovingAvgSimpleState': ('groupArrayMovingAvg', 'SimpleState'), 'exponentialTimeDecayedAvgSimpleState': ('exponentialTimeDecayedAvg', 'SimpleState'), 'skewPopSimpleState': ('skewPop', 'SimpleState'), 'sumCountSimpleState': ('sumCount', 'SimpleState'), 'quantileInterpolatedWeightedSimpleState': ('quantileInterpolatedWeighted', 'SimpleState'), 'medianSimpleState': ('median', 'SimpleState'), 'quantilesDeterministicSimpleState': ('quantilesDeterministic', 'SimpleState'), 'entropySimpleState': ('entropy', 'SimpleState'), 'quantileSimpleState': ('quantile', 'SimpleState'), 'quantileGKSimpleState': ('quantileGK', 'SimpleState'), 'quantileBFloat16WeightedSimpleState': ('quantileBFloat16Weighted', 'SimpleState'), 'uniqExactSimpleState': ('uniqExact', 'SimpleState'), 'quantilesExactLowSimpleState': ('quantilesExactLow', 'SimpleState'), 'quantilesTDigestSimpleState': ('quantilesTDigest', 'SimpleState'), 'minSimpleState': ('min', 'SimpleState'), 'quantileExactSimpleState': ('quantileExact', 'SimpleState'), 'rankCorrSimpleState': ('rankCorr', 'SimpleState'), 'groupArrayMovingSumSimpleState': ('groupArrayMovingSum', 'SimpleState'), 'quantilesExactSimpleState': ('quantilesExact', 'SimpleState'), 'groupBitmapOrSimpleState': ('groupBitmapOr', 'SimpleState'), 'kurtSampSimpleState': ('kurtSamp', 'SimpleState'), 'welchTTestSimpleState': ('welchTTest', 'SimpleState'), 'groupBitAndSimpleState': ('groupBitAnd', 'SimpleState'), 'argMinSimpleState': ('argMin', 'SimpleState'), 'countSimpleState': ('count', 'SimpleState'), 'avgState': ('avg', 'State'), 'sumKahanState': ('sumKahan', 'State'), 'studentTTestState': ('studentTTest', 'State'), 'sequenceNextNodeState': ('sequenceNextNode', 'State'), 'skewSampState': ('skewSamp', 'State'), 'histogramState': ('histogram', 'State'), 'sumWithOverflowState': ('sumWithOverflow', 'State'), 'groupArrayState': ('groupArray', 'State'), 'quantilesGKState': ('quantilesGK', 'State'), 'quantileExactLowState': ('quantileExactLow', 'State'), 'kolmogorovSmirnovTestState': ('kolmogorovSmirnovTest', 'State'), 'groupBitmapState': ('groupBitmap', 'State'), 'quantilesExactHighState': ('quantilesExactHigh', 'State'), 'anyLastState': ('anyLast', 'State'), 'groupArrayLastState': ('groupArrayLast', 'State'), 'quantilesTimingState': ('quantilesTiming', 'State'), 'quantileTimingWeightedState': ('quantileTimingWeighted', 'State'), 'last_valueState': ('last_value', 'State'), 'groupBitmapAndState': ('groupBitmapAnd', 'State'), 'argMaxState': ('argMax', 'State'), 'quantileDeterministicState': ('quantileDeterministic', 'State'), 'groupBitXorState': ('groupBitXor', 'State'), 'largestTriangleThreeBucketsState': ('largestTriangleThreeBuckets', 'State'), 'groupUniqArrayState': ('groupUniqArray', 'State'), 'deltaSumTimestampState': ('deltaSumTimestamp', 'State'), 'varPopState': ('varPop', 'State'), 'uniqHLL12State': ('uniqHLL12', 'State'), 'categoricalInformationValueState': ('categoricalInformationValue', 'State'), 'sparkBarState': ('sparkBar', 'State'), 'quantileExactHighState': ('quantileExactHigh', 'State'), 'sequenceCountState': ('sequenceCount', 'State'), 'quantilesState': ('quantiles', 'State'), 'uniqCombinedState': ('uniqCombined', 'State'), 'avgWeightedState': ('avgWeighted', 'State'), 'covarSampState': ('covarSamp', 'State'), 'uniqState': ('uniq', 'State'), 'quantilesTimingWeightedState': ('quantilesTimingWeighted', 'State'), 'stddevSampState': ('stddevSamp', 'State'), 'uniqUpToState': ('uniqUpTo', 'State'), 'quantilesInterpolatedWeightedState': ('quantilesInterpolatedWeighted', 'State'), 'groupBitmapXorState': ('groupBitmapXor', 'State'), 'first_valueState': ('first_value', 'State'), 'quantileTimingState': ('quantileTiming', 'State'), 'minMapState': ('minMap', 'State'), 'anyHeavyState': ('anyHeavy', 'State'), 'quantilesExactWeightedState': ('quantilesExactWeighted', 'State'), 'varSampState': ('varSamp', 'State'), 'simpleLinearRegressionState': ('simpleLinearRegression', 'State'), 'cramersVBiasCorrectedState': ('cramersVBiasCorrected', 'State'), 'mannWhitneyUTestState': ('mannWhitneyUTest', 'State'), 'quantileExactWeightedState': ('quantileExactWeighted', 'State'), 'topKWeightedState': ('topKWeighted', 'State'), 'maxState': ('max', 'State'), 'cramersVState': ('cramersV', 'State'), 'quantilesBFloat16State': ('quantilesBFloat16', 'State'), 'uniqThetaState': ('uniqTheta', 'State'), 'kurtPopState': ('kurtPop', 'State'), 'stddevPopState': ('stddevPop', 'State'), 'sumMapState': ('sumMap', 'State'), 'stochasticLogisticRegressionState': ('stochasticLogisticRegression', 'State'), 'quantileBFloat16State': ('quantileBFloat16', 'State'), 'maxMapState': ('maxMap', 'State'), 'groupBitOrState': ('groupBitOr', 'State'), 'boundingRatioState': ('boundingRatio', 'State'), 'uniqCombined64State': ('uniqCombined64', 'State'), 'maxIntersectionsState': ('maxIntersections', 'State'), 'maxIntersectionsPositionState': ('maxIntersectionsPosition', 'State'), 'contingencyState': ('contingency', 'State'), 'intervalLengthSumState': ('intervalLengthSum', 'State'), 'groupArraySampleState': ('groupArraySample', 'State'), 'theilsUState': ('theilsU', 'State'), 'quantilesTDigestWeightedState': ('quantilesTDigestWeighted', 'State'), 'exponentialMovingAverageState': ('exponentialMovingAverage', 'State'), 'topKState': ('topK', 'State'), 'meanZTestState': ('meanZTest', 'State'), 'sumState': ('sum', 'State'), 'covarPopState': ('covarPop', 'State'), 'anyState': ('any', 'State'), 'deltaSumState': ('deltaSum', 'State'), 'quantileTDigestState': ('quantileTDigest', 'State'), 'stochasticLinearRegressionState': ('stochasticLinearRegression', 'State'), 'sequenceMatchState': ('sequenceMatch', 'State'), 'corrState': ('corr', 'State'), 'retentionState': ('retention', 'State'), 'quantileTDigestWeightedState': ('quantileTDigestWeighted', 'State'), 'quantilesBFloat16WeightedState': ('quantilesBFloat16Weighted', 'State'), 'windowFunnelState': ('windowFunnel', 'State'), 'groupArrayInsertAtState': ('groupArrayInsertAt', 'State'), 'groupArrayMovingAvgState': ('groupArrayMovingAvg', 'State'), 'exponentialTimeDecayedAvgState': ('exponentialTimeDecayedAvg', 'State'), 'skewPopState': ('skewPop', 'State'), 'sumCountState': ('sumCount', 'State'), 'quantileInterpolatedWeightedState': ('quantileInterpolatedWeighted', 'State'), 'medianState': ('median', 'State'), 'quantilesDeterministicState': ('quantilesDeterministic', 'State'), 'entropyState': ('entropy', 'State'), 'quantileState': ('quantile', 'State'), 'quantileGKState': ('quantileGK', 'State'), 'quantileBFloat16WeightedState': ('quantileBFloat16Weighted', 'State'), 'uniqExactState': ('uniqExact', 'State'), 'quantilesExactLowState': ('quantilesExactLow', 'State'), 'quantilesTDigestState': ('quantilesTDigest', 'State'), 'minState': ('min', 'State'), 'quantileExactState': ('quantileExact', 'State'), 'rankCorrState': ('rankCorr', 'State'), 'groupArrayMovingSumState': ('groupArrayMovingSum', 'State'), 'quantilesExactState': ('quantilesExact', 'State'), 'groupBitmapOrState': ('groupBitmapOr', 'State'), 'kurtSampState': ('kurtSamp', 'State'), 'welchTTestState': ('welchTTest', 'State'), 'groupBitAndState': ('groupBitAnd', 'State'), 'argMinState': ('argMin', 'State'), 'countState': ('count', 'State'), 'avgMerge': ('avg', 'Merge'), 'sumKahanMerge': ('sumKahan', 'Merge'), 'studentTTestMerge': ('studentTTest', 'Merge'), 'sequenceNextNodeMerge': ('sequenceNextNode', 'Merge'), 'skewSampMerge': ('skewSamp', 'Merge'), 'histogramMerge': ('histogram', 'Merge'), 'sumWithOverflowMerge': ('sumWithOverflow', 'Merge'), 'groupArrayMerge': ('groupArray', 'Merge'), 'quantilesGKMerge': ('quantilesGK', 'Merge'), 'quantileExactLowMerge': ('quantileExactLow', 'Merge'), 'kolmogorovSmirnovTestMerge': ('kolmogorovSmirnovTest', 'Merge'), 'groupBitmapMerge': ('groupBitmap', 'Merge'), 'quantilesExactHighMerge': ('quantilesExactHigh', 'Merge'), 'anyLastMerge': ('anyLast', 'Merge'), 'groupArrayLastMerge': ('groupArrayLast', 'Merge'), 'quantilesTimingMerge': ('quantilesTiming', 'Merge'), 'quantileTimingWeightedMerge': ('quantileTimingWeighted', 'Merge'), 'last_valueMerge': ('last_value', 'Merge'), 'groupBitmapAndMerge': ('groupBitmapAnd', 'Merge'), 'argMaxMerge': ('argMax', 'Merge'), 'quantileDeterministicMerge': ('quantileDeterministic', 'Merge'), 'groupBitXorMerge': ('groupBitXor', 'Merge'), 'largestTriangleThreeBucketsMerge': ('largestTriangleThreeBuckets', 'Merge'), 'groupUniqArrayMerge': ('groupUniqArray', 'Merge'), 'deltaSumTimestampMerge': ('deltaSumTimestamp', 'Merge'), 'varPopMerge': ('varPop', 'Merge'), 'uniqHLL12Merge': ('uniqHLL12', 'Merge'), 'categoricalInformationValueMerge': ('categoricalInformationValue', 'Merge'), 'sparkBarMerge': ('sparkBar', 'Merge'), 'quantileExactHighMerge': ('quantileExactHigh', 'Merge'), 'sequenceCountMerge': ('sequenceCount', 'Merge'), 'quantilesMerge': ('quantiles', 'Merge'), 'uniqCombinedMerge': ('uniqCombined', 'Merge'), 'avgWeightedMerge': ('avgWeighted', 'Merge'), 'covarSampMerge': ('covarSamp', 'Merge'), 'uniqMerge': ('uniq', 'Merge'), 'quantilesTimingWeightedMerge': ('quantilesTimingWeighted', 'Merge'), 'stddevSampMerge': ('stddevSamp', 'Merge'), 'uniqUpToMerge': ('uniqUpTo', 'Merge'), 'quantilesInterpolatedWeightedMerge': ('quantilesInterpolatedWeighted', 'Merge'), 'groupBitmapXorMerge': ('groupBitmapXor', 'Merge'), 'first_valueMerge': ('first_value', 'Merge'), 'quantileTimingMerge': ('quantileTiming', 'Merge'), 'minMapMerge': ('minMap', 'Merge'), 'anyHeavyMerge': ('anyHeavy', 'Merge'), 'quantilesExactWeightedMerge': ('quantilesExactWeighted', 'Merge'), 'varSampMerge': ('varSamp', 'Merge'), 'simpleLinearRegressionMerge': ('simpleLinearRegression', 'Merge'), 'cramersVBiasCorrectedMerge': ('cramersVBiasCorrected', 'Merge'), 'mannWhitneyUTestMerge': ('mannWhitneyUTest', 'Merge'), 'quantileExactWeightedMerge': ('quantileExactWeighted', 'Merge'), 'topKWeightedMerge': ('topKWeighted', 'Merge'), 'maxMerge': ('max', 'Merge'), 'cramersVMerge': ('cramersV', 'Merge'), 'quantilesBFloat16Merge': ('quantilesBFloat16', 'Merge'), 'uniqThetaMerge': ('uniqTheta', 'Merge'), 'kurtPopMerge': ('kurtPop', 'Merge'), 'stddevPopMerge': ('stddevPop', 'Merge'), 'sumMapMerge': ('sumMap', 'Merge'), 'stochasticLogisticRegressionMerge': ('stochasticLogisticRegression', 'Merge'), 'quantileBFloat16Merge': ('quantileBFloat16', 'Merge'), 'maxMapMerge': ('maxMap', 'Merge'), 'groupBitOrMerge': ('groupBitOr', 'Merge'), 'boundingRatioMerge': ('boundingRatio', 'Merge'), 'uniqCombined64Merge': ('uniqCombined64', 'Merge'), 'maxIntersectionsMerge': ('maxIntersections', 'Merge'), 'maxIntersectionsPositionMerge': ('maxIntersectionsPosition', 'Merge'), 'contingencyMerge': ('contingency', 'Merge'), 'intervalLengthSumMerge': ('intervalLengthSum', 'Merge'), 'groupArraySampleMerge': ('groupArraySample', 'Merge'), 'theilsUMerge': ('theilsU', 'Merge'), 'quantilesTDigestWeightedMerge': ('quantilesTDigestWeighted', 'Merge'), 'exponentialMovingAverageMerge': ('exponentialMovingAverage', 'Merge'), 'topKMerge': ('topK', 'Merge'), 'meanZTestMerge': ('meanZTest', 'Merge'), 'sumMerge': ('sum', 'Merge'), 'covarPopMerge': ('covarPop', 'Merge'), 'anyMerge': ('any', 'Merge'), 'deltaSumMerge': ('deltaSum', 'Merge'), 'quantileTDigestMerge': ('quantileTDigest', 'Merge'), 'stochasticLinearRegressionMerge': ('stochasticLinearRegression', 'Merge'), 'sequenceMatchMerge': ('sequenceMatch', 'Merge'), 'corrMerge': ('corr', 'Merge'), 'retentionMerge': ('retention', 'Merge'), 'quantileTDigestWeightedMerge': ('quantileTDigestWeighted', 'Merge'), 'quantilesBFloat16WeightedMerge': ('quantilesBFloat16Weighted', 'Merge'), 'windowFunnelMerge': ('windowFunnel', 'Merge'), 'groupArrayInsertAtMerge': ('groupArrayInsertAt', 'Merge'), 'groupArrayMovingAvgMerge': ('groupArrayMovingAvg', 'Merge'), 'exponentialTimeDecayedAvgMerge': ('exponentialTimeDecayedAvg', 'Merge'), 'skewPopMerge': ('skewPop', 'Merge'), 'sumCountMerge': ('sumCount', 'Merge'), 'quantileInterpolatedWeightedMerge': ('quantileInterpolatedWeighted', 'Merge'), 'medianMerge': ('median', 'Merge'), 'quantilesDeterministicMerge': ('quantilesDeterministic', 'Merge'), 'entropyMerge': ('entropy', 'Merge'), 'quantileMerge': ('quantile', 'Merge'), 'quantileGKMerge': ('quantileGK', 'Merge'), 'quantileBFloat16WeightedMerge': ('quantileBFloat16Weighted', 'Merge'), 'uniqExactMerge': ('uniqExact', 'Merge'), 'quantilesExactLowMerge': ('quantilesExactLow', 'Merge'), 'quantilesTDigestMerge': ('quantilesTDigest', 'Merge'), 'minMerge': ('min', 'Merge'), 'quantileExactMerge': ('quantileExact', 'Merge'), 'rankCorrMerge': ('rankCorr', 'Merge'), 'groupArrayMovingSumMerge': ('groupArrayMovingSum', 'Merge'), 'quantilesExactMerge': ('quantilesExact', 'Merge'), 'groupBitmapOrMerge': ('groupBitmapOr', 'Merge'), 'kurtSampMerge': ('kurtSamp', 'Merge'), 'welchTTestMerge': ('welchTTest', 'Merge'), 'groupBitAndMerge': ('groupBitAnd', 'Merge'), 'argMinMerge': ('argMin', 'Merge'), 'countMerge': ('count', 'Merge'), 'avgMergeState': ('avg', 'MergeState'), 'sumKahanMergeState': ('sumKahan', 'MergeState'), 'studentTTestMergeState': ('studentTTest', 'MergeState'), 'sequenceNextNodeMergeState': ('sequenceNextNode', 'MergeState'), 'skewSampMergeState': ('skewSamp', 'MergeState'), 'histogramMergeState': ('histogram', 'MergeState'), 'sumWithOverflowMergeState': ('sumWithOverflow', 'MergeState'), 'groupArrayMergeState': ('groupArray', 'MergeState'), 'quantilesGKMergeState': ('quantilesGK', 'MergeState'), 'quantileExactLowMergeState': ('quantileExactLow', 'MergeState'), 'kolmogorovSmirnovTestMergeState': ('kolmogorovSmirnovTest', 'MergeState'), 'groupBitmapMergeState': ('groupBitmap', 'MergeState'), 'quantilesExactHighMergeState': ('quantilesExactHigh', 'MergeState'), 'anyLastMergeState': ('anyLast', 'MergeState'), 'groupArrayLastMergeState': ('groupArrayLast', 'MergeState'), 'quantilesTimingMergeState': ('quantilesTiming', 'MergeState'), 'quantileTimingWeightedMergeState': ('quantileTimingWeighted', 'MergeState'), 'last_valueMergeState': ('last_value', 'MergeState'), 'groupBitmapAndMergeState': ('groupBitmapAnd', 'MergeState'), 'argMaxMergeState': ('argMax', 'MergeState'), 'quantileDeterministicMergeState': ('quantileDeterministic', 'MergeState'), 'groupBitXorMergeState': ('groupBitXor', 'MergeState'), 'largestTriangleThreeBucketsMergeState': ('largestTriangleThreeBuckets', 'MergeState'), 'groupUniqArrayMergeState': ('groupUniqArray', 'MergeState'), 'deltaSumTimestampMergeState': ('deltaSumTimestamp', 'MergeState'), 'varPopMergeState': ('varPop', 'MergeState'), 'uniqHLL12MergeState': ('uniqHLL12', 'MergeState'), 'categoricalInformationValueMergeState': ('categoricalInformationValue', 'MergeState'), 'sparkBarMergeState': ('sparkBar', 'MergeState'), 'quantileExactHighMergeState': ('quantileExactHigh', 'MergeState'), 'sequenceCountMergeState': ('sequenceCount', 'MergeState'), 'quantilesMergeState': ('quantiles', 'MergeState'), 'uniqCombinedMergeState': ('uniqCombined', 'MergeState'), 'avgWeightedMergeState': ('avgWeighted', 'MergeState'), 'covarSampMergeState': ('covarSamp', 'MergeState'), 'uniqMergeState': ('uniq', 'MergeState'), 'quantilesTimingWeightedMergeState': ('quantilesTimingWeighted', 'MergeState'), 'stddevSampMergeState': ('stddevSamp', 'MergeState'), 'uniqUpToMergeState': ('uniqUpTo', 'MergeState'), 'quantilesInterpolatedWeightedMergeState': ('quantilesInterpolatedWeighted', 'MergeState'), 'groupBitmapXorMergeState': ('groupBitmapXor', 'MergeState'), 'first_valueMergeState': ('first_value', 'MergeState'), 'quantileTimingMergeState': ('quantileTiming', 'MergeState'), 'minMapMergeState': ('minMap', 'MergeState'), 'anyHeavyMergeState': ('anyHeavy', 'MergeState'), 'quantilesExactWeightedMergeState': ('quantilesExactWeighted', 'MergeState'), 'varSampMergeState': ('varSamp', 'MergeState'), 'simpleLinearRegressionMergeState': ('simpleLinearRegression', 'MergeState'), 'cramersVBiasCorrectedMergeState': ('cramersVBiasCorrected', 'MergeState'), 'mannWhitneyUTestMergeState': ('mannWhitneyUTest', 'MergeState'), 'quantileExactWeightedMergeState': ('quantileExactWeighted', 'MergeState'), 'topKWeightedMergeState': ('topKWeighted', 'MergeState'), 'maxMergeState': ('max', 'MergeState'), 'cramersVMergeState': ('cramersV', 'MergeState'), 'quantilesBFloat16MergeState': ('quantilesBFloat16', 'MergeState'), 'uniqThetaMergeState': ('uniqTheta', 'MergeState'), 'kurtPopMergeState': ('kurtPop', 'MergeState'), 'stddevPopMergeState': ('stddevPop', 'MergeState'), 'sumMapMergeState': ('sumMap', 'MergeState'), 'stochasticLogisticRegressionMergeState': ('stochasticLogisticRegression', 'MergeState'), 'quantileBFloat16MergeState': ('quantileBFloat16', 'MergeState'), 'maxMapMergeState': ('maxMap', 'MergeState'), 'groupBitOrMergeState': ('groupBitOr', 'MergeState'), 'boundingRatioMergeState': ('boundingRatio', 'MergeState'), 'uniqCombined64MergeState': ('uniqCombined64', 'MergeState'), 'maxIntersectionsMergeState': ('maxIntersections', 'MergeState'), 'maxIntersectionsPositionMergeState': ('maxIntersectionsPosition', 'MergeState'), 'contingencyMergeState': ('contingency', 'MergeState'), 'intervalLengthSumMergeState': ('intervalLengthSum', 'MergeState'), 'groupArraySampleMergeState': ('groupArraySample', 'MergeState'), 'theilsUMergeState': ('theilsU', 'MergeState'), 'quantilesTDigestWeightedMergeState': ('quantilesTDigestWeighted', 'MergeState'), 'exponentialMovingAverageMergeState': ('exponentialMovingAverage', 'MergeState'), 'topKMergeState': ('topK', 'MergeState'), 'meanZTestMergeState': ('meanZTest', 'MergeState'), 'sumMergeState': ('sum', 'MergeState'), 'covarPopMergeState': ('covarPop', 'MergeState'), 'anyMergeState': ('any', 'MergeState'), 'deltaSumMergeState': ('deltaSum', 'MergeState'), 'quantileTDigestMergeState': ('quantileTDigest', 'MergeState'), 'stochasticLinearRegressionMergeState': ('stochasticLinearRegression', 'MergeState'), 'sequenceMatchMergeState': ('sequenceMatch', 'MergeState'), 'corrMergeState': ('corr', 'MergeState'), 'retentionMergeState': ('retention', 'MergeState'), 'quantileTDigestWeightedMergeState': ('quantileTDigestWeighted', 'MergeState'), 'quantilesBFloat16WeightedMergeState': ('quantilesBFloat16Weighted', 'MergeState'), 'windowFunnelMergeState': ('windowFunnel', 'MergeState'), 'groupArrayInsertAtMergeState': ('groupArrayInsertAt', 'MergeState'), 'groupArrayMovingAvgMergeState': ('groupArrayMovingAvg', 'MergeState'), 'exponentialTimeDecayedAvgMergeState': ('exponentialTimeDecayedAvg', 'MergeState'), 'skewPopMergeState': ('skewPop', 'MergeState'), 'sumCountMergeState': ('sumCount', 'MergeState'), 'quantileInterpolatedWeightedMergeState': ('quantileInterpolatedWeighted', 'MergeState'), 'medianMergeState': ('median', 'MergeState'), 'quantilesDeterministicMergeState': ('quantilesDeterministic', 'MergeState'), 'entropyMergeState': ('entropy', 'MergeState'), 'quantileMergeState': ('quantile', 'MergeState'), 'quantileGKMergeState': ('quantileGK', 'MergeState'), 'quantileBFloat16WeightedMergeState': ('quantileBFloat16Weighted', 'MergeState'), 'uniqExactMergeState': ('uniqExact', 'MergeState'), 'quantilesExactLowMergeState': ('quantilesExactLow', 'MergeState'), 'quantilesTDigestMergeState': ('quantilesTDigest', 'MergeState'), 'minMergeState': ('min', 'MergeState'), 'quantileExactMergeState': ('quantileExact', 'MergeState'), 'rankCorrMergeState': ('rankCorr', 'MergeState'), 'groupArrayMovingSumMergeState': ('groupArrayMovingSum', 'MergeState'), 'quantilesExactMergeState': ('quantilesExact', 'MergeState'), 'groupBitmapOrMergeState': ('groupBitmapOr', 'MergeState'), 'kurtSampMergeState': ('kurtSamp', 'MergeState'), 'welchTTestMergeState': ('welchTTest', 'MergeState'), 'groupBitAndMergeState': ('groupBitAnd', 'MergeState'), 'argMinMergeState': ('argMin', 'MergeState'), 'countMergeState': ('count', 'MergeState'), 'avgForEach': ('avg', 'ForEach'), 'sumKahanForEach': ('sumKahan', 'ForEach'), 'studentTTestForEach': ('studentTTest', 'ForEach'), 'sequenceNextNodeForEach': ('sequenceNextNode', 'ForEach'), 'skewSampForEach': ('skewSamp', 'ForEach'), 'histogramForEach': ('histogram', 'ForEach'), 'sumWithOverflowForEach': ('sumWithOverflow', 'ForEach'), 'groupArrayForEach': ('groupArray', 'ForEach'), 'quantilesGKForEach': ('quantilesGK', 'ForEach'), 'quantileExactLowForEach': ('quantileExactLow', 'ForEach'), 'kolmogorovSmirnovTestForEach': ('kolmogorovSmirnovTest', 'ForEach'), 'groupBitmapForEach': ('groupBitmap', 'ForEach'), 'quantilesExactHighForEach': ('quantilesExactHigh', 'ForEach'), 'anyLastForEach': ('anyLast', 'ForEach'), 'groupArrayLastForEach': ('groupArrayLast', 'ForEach'), 'quantilesTimingForEach': ('quantilesTiming', 'ForEach'), 'quantileTimingWeightedForEach': ('quantileTimingWeighted', 'ForEach'), 'last_valueForEach': ('last_value', 'ForEach'), 'groupBitmapAndForEach': ('groupBitmapAnd', 'ForEach'), 'argMaxForEach': ('argMax', 'ForEach'), 'quantileDeterministicForEach': ('quantileDeterministic', 'ForEach'), 'groupBitXorForEach': ('groupBitXor', 'ForEach'), 'largestTriangleThreeBucketsForEach': ('largestTriangleThreeBuckets', 'ForEach'), 'groupUniqArrayForEach': ('groupUniqArray', 'ForEach'), 'deltaSumTimestampForEach': ('deltaSumTimestamp', 'ForEach'), 'varPopForEach': ('varPop', 'ForEach'), 'uniqHLL12ForEach': ('uniqHLL12', 'ForEach'), 'categoricalInformationValueForEach': ('categoricalInformationValue', 'ForEach'), 'sparkBarForEach': ('sparkBar', 'ForEach'), 'quantileExactHighForEach': ('quantileExactHigh', 'ForEach'), 'sequenceCountForEach': ('sequenceCount', 'ForEach'), 'quantilesForEach': ('quantiles', 'ForEach'), 'uniqCombinedForEach': ('uniqCombined', 'ForEach'), 'avgWeightedForEach': ('avgWeighted', 'ForEach'), 'covarSampForEach': ('covarSamp', 'ForEach'), 'uniqForEach': ('uniq', 'ForEach'), 'quantilesTimingWeightedForEach': ('quantilesTimingWeighted', 'ForEach'), 'stddevSampForEach': ('stddevSamp', 'ForEach'), 'uniqUpToForEach': ('uniqUpTo', 'ForEach'), 'quantilesInterpolatedWeightedForEach': ('quantilesInterpolatedWeighted', 'ForEach'), 'groupBitmapXorForEach': ('groupBitmapXor', 'ForEach'), 'first_valueForEach': ('first_value', 'ForEach'), 'quantileTimingForEach': ('quantileTiming', 'ForEach'), 'minMapForEach': ('minMap', 'ForEach'), 'anyHeavyForEach': ('anyHeavy', 'ForEach'), 'quantilesExactWeightedForEach': ('quantilesExactWeighted', 'ForEach'), 'varSampForEach': ('varSamp', 'ForEach'), 'simpleLinearRegressionForEach': ('simpleLinearRegression', 'ForEach'), 'cramersVBiasCorrectedForEach': ('cramersVBiasCorrected', 'ForEach'), 'mannWhitneyUTestForEach': ('mannWhitneyUTest', 'ForEach'), 'quantileExactWeightedForEach': ('quantileExactWeighted', 'ForEach'), 'topKWeightedForEach': ('topKWeighted', 'ForEach'), 'maxForEach': ('max', 'ForEach'), 'cramersVForEach': ('cramersV', 'ForEach'), 'quantilesBFloat16ForEach': ('quantilesBFloat16', 'ForEach'), 'uniqThetaForEach': ('uniqTheta', 'ForEach'), 'kurtPopForEach': ('kurtPop', 'ForEach'), 'stddevPopForEach': ('stddevPop', 'ForEach'), 'sumMapForEach': ('sumMap', 'ForEach'), 'stochasticLogisticRegressionForEach': ('stochasticLogisticRegression', 'ForEach'), 'quantileBFloat16ForEach': ('quantileBFloat16', 'ForEach'), 'maxMapForEach': ('maxMap', 'ForEach'), 'groupBitOrForEach': ('groupBitOr', 'ForEach'), 'boundingRatioForEach': ('boundingRatio', 'ForEach'), 'uniqCombined64ForEach': ('uniqCombined64', 'ForEach'), 'maxIntersectionsForEach': ('maxIntersections', 'ForEach'), 'maxIntersectionsPositionForEach': ('maxIntersectionsPosition', 'ForEach'), 'contingencyForEach': ('contingency', 'ForEach'), 'intervalLengthSumForEach': ('intervalLengthSum', 'ForEach'), 'groupArraySampleForEach': ('groupArraySample', 'ForEach'), 'theilsUForEach': ('theilsU', 'ForEach'), 'quantilesTDigestWeightedForEach': ('quantilesTDigestWeighted', 'ForEach'), 'exponentialMovingAverageForEach': ('exponentialMovingAverage', 'ForEach'), 'topKForEach': ('topK', 'ForEach'), 'meanZTestForEach': ('meanZTest', 'ForEach'), 'sumForEach': ('sum', 'ForEach'), 'covarPopForEach': ('covarPop', 'ForEach'), 'anyForEach': ('any', 'ForEach'), 'deltaSumForEach': ('deltaSum', 'ForEach'), 'quantileTDigestForEach': ('quantileTDigest', 'ForEach'), 'stochasticLinearRegressionForEach': ('stochasticLinearRegression', 'ForEach'), 'sequenceMatchForEach': ('sequenceMatch', 'ForEach'), 'corrForEach': ('corr', 'ForEach'), 'retentionForEach': ('retention', 'ForEach'), 'quantileTDigestWeightedForEach': ('quantileTDigestWeighted', 'ForEach'), 'quantilesBFloat16WeightedForEach': ('quantilesBFloat16Weighted', 'ForEach'), 'windowFunnelForEach': ('windowFunnel', 'ForEach'), 'groupArrayInsertAtForEach': ('groupArrayInsertAt', 'ForEach'), 'groupArrayMovingAvgForEach': ('groupArrayMovingAvg', 'ForEach'), 'exponentialTimeDecayedAvgForEach': ('exponentialTimeDecayedAvg', 'ForEach'), 'skewPopForEach': ('skewPop', 'ForEach'), 'sumCountForEach': ('sumCount', 'ForEach'), 'quantileInterpolatedWeightedForEach': ('quantileInterpolatedWeighted', 'ForEach'), 'medianForEach': ('median', 'ForEach'), 'quantilesDeterministicForEach': ('quantilesDeterministic', 'ForEach'), 'entropyForEach': ('entropy', 'ForEach'), 'quantileForEach': ('quantile', 'ForEach'), 'quantileGKForEach': ('quantileGK', 'ForEach'), 'quantileBFloat16WeightedForEach': ('quantileBFloat16Weighted', 'ForEach'), 'uniqExactForEach': ('uniqExact', 'ForEach'), 'quantilesExactLowForEach': ('quantilesExactLow', 'ForEach'), 'quantilesTDigestForEach': ('quantilesTDigest', 'ForEach'), 'minForEach': ('min', 'ForEach'), 'quantileExactForEach': ('quantileExact', 'ForEach'), 'rankCorrForEach': ('rankCorr', 'ForEach'), 'groupArrayMovingSumForEach': ('groupArrayMovingSum', 'ForEach'), 'quantilesExactForEach': ('quantilesExact', 'ForEach'), 'groupBitmapOrForEach': ('groupBitmapOr', 'ForEach'), 'kurtSampForEach': ('kurtSamp', 'ForEach'), 'welchTTestForEach': ('welchTTest', 'ForEach'), 'groupBitAndForEach': ('groupBitAnd', 'ForEach'), 'argMinForEach': ('argMin', 'ForEach'), 'countForEach': ('count', 'ForEach'), 'avgDistinct': ('avg', 'Distinct'), 'sumKahanDistinct': ('sumKahan', 'Distinct'), 'studentTTestDistinct': ('studentTTest', 'Distinct'), 'sequenceNextNodeDistinct': ('sequenceNextNode', 'Distinct'), 'skewSampDistinct': ('skewSamp', 'Distinct'), 'histogramDistinct': ('histogram', 'Distinct'), 'sumWithOverflowDistinct': ('sumWithOverflow', 'Distinct'), 'groupArrayDistinct': ('groupArray', 'Distinct'), 'quantilesGKDistinct': ('quantilesGK', 'Distinct'), 'quantileExactLowDistinct': ('quantileExactLow', 'Distinct'), 'kolmogorovSmirnovTestDistinct': ('kolmogorovSmirnovTest', 'Distinct'), 'groupBitmapDistinct': ('groupBitmap', 'Distinct'), 'quantilesExactHighDistinct': ('quantilesExactHigh', 'Distinct'), 'anyLastDistinct': ('anyLast', 'Distinct'), 'groupArrayLastDistinct': ('groupArrayLast', 'Distinct'), 'quantilesTimingDistinct': ('quantilesTiming', 'Distinct'), 'quantileTimingWeightedDistinct': ('quantileTimingWeighted', 'Distinct'), 'last_valueDistinct': ('last_value', 'Distinct'), 'groupBitmapAndDistinct': ('groupBitmapAnd', 'Distinct'), 'argMaxDistinct': ('argMax', 'Distinct'), 'quantileDeterministicDistinct': ('quantileDeterministic', 'Distinct'), 'groupBitXorDistinct': ('groupBitXor', 'Distinct'), 'largestTriangleThreeBucketsDistinct': ('largestTriangleThreeBuckets', 'Distinct'), 'groupUniqArrayDistinct': ('groupUniqArray', 'Distinct'), 'deltaSumTimestampDistinct': ('deltaSumTimestamp', 'Distinct'), 'varPopDistinct': ('varPop', 'Distinct'), 'uniqHLL12Distinct': ('uniqHLL12', 'Distinct'), 'categoricalInformationValueDistinct': ('categoricalInformationValue', 'Distinct'), 'sparkBarDistinct': ('sparkBar', 'Distinct'), 'quantileExactHighDistinct': ('quantileExactHigh', 'Distinct'), 'sequenceCountDistinct': ('sequenceCount', 'Distinct'), 'quantilesDistinct': ('quantiles', 'Distinct'), 'uniqCombinedDistinct': ('uniqCombined', 'Distinct'), 'avgWeightedDistinct': ('avgWeighted', 'Distinct'), 'covarSampDistinct': ('covarSamp', 'Distinct'), 'uniqDistinct': ('uniq', 'Distinct'), 'quantilesTimingWeightedDistinct': ('quantilesTimingWeighted', 'Distinct'), 'stddevSampDistinct': ('stddevSamp', 'Distinct'), 'uniqUpToDistinct': ('uniqUpTo', 'Distinct'), 'quantilesInterpolatedWeightedDistinct': ('quantilesInterpolatedWeighted', 'Distinct'), 'groupBitmapXorDistinct': ('groupBitmapXor', 'Distinct'), 'first_valueDistinct': ('first_value', 'Distinct'), 'quantileTimingDistinct': ('quantileTiming', 'Distinct'), 'minMapDistinct': ('minMap', 'Distinct'), 'anyHeavyDistinct': ('anyHeavy', 'Distinct'), 'quantilesExactWeightedDistinct': ('quantilesExactWeighted', 'Distinct'), 'varSampDistinct': ('varSamp', 'Distinct'), 'simpleLinearRegressionDistinct': ('simpleLinearRegression', 'Distinct'), 'cramersVBiasCorrectedDistinct': ('cramersVBiasCorrected', 'Distinct'), 'mannWhitneyUTestDistinct': ('mannWhitneyUTest', 'Distinct'), 'quantileExactWeightedDistinct': ('quantileExactWeighted', 'Distinct'), 'topKWeightedDistinct': ('topKWeighted', 'Distinct'), 'maxDistinct': ('max', 'Distinct'), 'cramersVDistinct': ('cramersV', 'Distinct'), 'quantilesBFloat16Distinct': ('quantilesBFloat16', 'Distinct'), 'uniqThetaDistinct': ('uniqTheta', 'Distinct'), 'kurtPopDistinct': ('kurtPop', 'Distinct'), 'stddevPopDistinct': ('stddevPop', 'Distinct'), 'sumMapDistinct': ('sumMap', 'Distinct'), 'stochasticLogisticRegressionDistinct': ('stochasticLogisticRegression', 'Distinct'), 'quantileBFloat16Distinct': ('quantileBFloat16', 'Distinct'), 'maxMapDistinct': ('maxMap', 'Distinct'), 'groupBitOrDistinct': ('groupBitOr', 'Distinct'), 'boundingRatioDistinct': ('boundingRatio', 'Distinct'), 'uniqCombined64Distinct': ('uniqCombined64', 'Distinct'), 'maxIntersectionsDistinct': ('maxIntersections', 'Distinct'), 'maxIntersectionsPositionDistinct': ('maxIntersectionsPosition', 'Distinct'), 'contingencyDistinct': ('contingency', 'Distinct'), 'intervalLengthSumDistinct': ('intervalLengthSum', 'Distinct'), 'groupArraySampleDistinct': ('groupArraySample', 'Distinct'), 'theilsUDistinct': ('theilsU', 'Distinct'), 'quantilesTDigestWeightedDistinct': ('quantilesTDigestWeighted', 'Distinct'), 'exponentialMovingAverageDistinct': ('exponentialMovingAverage', 'Distinct'), 'topKDistinct': ('topK', 'Distinct'), 'meanZTestDistinct': ('meanZTest', 'Distinct'), 'sumDistinct': ('sum', 'Distinct'), 'covarPopDistinct': ('covarPop', 'Distinct'), 'anyDistinct': ('any', 'Distinct'), 'deltaSumDistinct': ('deltaSum', 'Distinct'), 'quantileTDigestDistinct': ('quantileTDigest', 'Distinct'), 'stochasticLinearRegressionDistinct': ('stochasticLinearRegression', 'Distinct'), 'sequenceMatchDistinct': ('sequenceMatch', 'Distinct'), 'corrDistinct': ('corr', 'Distinct'), 'retentionDistinct': ('retention', 'Distinct'), 'quantileTDigestWeightedDistinct': ('quantileTDigestWeighted', 'Distinct'), 'quantilesBFloat16WeightedDistinct': ('quantilesBFloat16Weighted', 'Distinct'), 'windowFunnelDistinct': ('windowFunnel', 'Distinct'), 'groupArrayInsertAtDistinct': ('groupArrayInsertAt', 'Distinct'), 'groupArrayMovingAvgDistinct': ('groupArrayMovingAvg', 'Distinct'), 'exponentialTimeDecayedAvgDistinct': ('exponentialTimeDecayedAvg', 'Distinct'), 'skewPopDistinct': ('skewPop', 'Distinct'), 'sumCountDistinct': ('sumCount', 'Distinct'), 'quantileInterpolatedWeightedDistinct': ('quantileInterpolatedWeighted', 'Distinct'), 'medianDistinct': ('median', 'Distinct'), 'quantilesDeterministicDistinct': ('quantilesDeterministic', 'Distinct'), 'entropyDistinct': ('entropy', 'Distinct'), 'quantileDistinct': ('quantile', 'Distinct'), 'quantileGKDistinct': ('quantileGK', 'Distinct'), 'quantileBFloat16WeightedDistinct': ('quantileBFloat16Weighted', 'Distinct'), 'uniqExactDistinct': ('uniqExact', 'Distinct'), 'quantilesExactLowDistinct': ('quantilesExactLow', 'Distinct'), 'quantilesTDigestDistinct': ('quantilesTDigest', 'Distinct'), 'minDistinct': ('min', 'Distinct'), 'quantileExactDistinct': ('quantileExact', 'Distinct'), 'rankCorrDistinct': ('rankCorr', 'Distinct'), 'groupArrayMovingSumDistinct': ('groupArrayMovingSum', 'Distinct'), 'quantilesExactDistinct': ('quantilesExact', 'Distinct'), 'groupBitmapOrDistinct': ('groupBitmapOr', 'Distinct'), 'kurtSampDistinct': ('kurtSamp', 'Distinct'), 'welchTTestDistinct': ('welchTTest', 'Distinct'), 'groupBitAndDistinct': ('groupBitAnd', 'Distinct'), 'argMinDistinct': ('argMin', 'Distinct'), 'countDistinct': ('count', 'Distinct'), 'avgOrDefault': ('avg', 'OrDefault'), 'sumKahanOrDefault': ('sumKahan', 'OrDefault'), 'studentTTestOrDefault': ('studentTTest', 'OrDefault'), 'sequenceNextNodeOrDefault': ('sequenceNextNode', 'OrDefault'), 'skewSampOrDefault': ('skewSamp', 'OrDefault'), 'histogramOrDefault': ('histogram', 'OrDefault'), 'sumWithOverflowOrDefault': ('sumWithOverflow', 'OrDefault'), 'groupArrayOrDefault': ('groupArray', 'OrDefault'), 'quantilesGKOrDefault': ('quantilesGK', 'OrDefault'), 'quantileExactLowOrDefault': ('quantileExactLow', 'OrDefault'), 'kolmogorovSmirnovTestOrDefault': ('kolmogorovSmirnovTest', 'OrDefault'), 'groupBitmapOrDefault': ('groupBitmap', 'OrDefault'), 'quantilesExactHighOrDefault': ('quantilesExactHigh', 'OrDefault'), 'anyLastOrDefault': ('anyLast', 'OrDefault'), 'groupArrayLastOrDefault': ('groupArrayLast', 'OrDefault'), 'quantilesTimingOrDefault': ('quantilesTiming', 'OrDefault'), 'quantileTimingWeightedOrDefault': ('quantileTimingWeighted', 'OrDefault'), 'last_valueOrDefault': ('last_value', 'OrDefault'), 'groupBitmapAndOrDefault': ('groupBitmapAnd', 'OrDefault'), 'argMaxOrDefault': ('argMax', 'OrDefault'), 'quantileDeterministicOrDefault': ('quantileDeterministic', 'OrDefault'), 'groupBitXorOrDefault': ('groupBitXor', 'OrDefault'), 'largestTriangleThreeBucketsOrDefault': ('largestTriangleThreeBuckets', 'OrDefault'), 'groupUniqArrayOrDefault': ('groupUniqArray', 'OrDefault'), 'deltaSumTimestampOrDefault': ('deltaSumTimestamp', 'OrDefault'), 'varPopOrDefault': ('varPop', 'OrDefault'), 'uniqHLL12OrDefault': ('uniqHLL12', 'OrDefault'), 'categoricalInformationValueOrDefault': ('categoricalInformationValue', 'OrDefault'), 'sparkBarOrDefault': ('sparkBar', 'OrDefault'), 'quantileExactHighOrDefault': ('quantileExactHigh', 'OrDefault'), 'sequenceCountOrDefault': ('sequenceCount', 'OrDefault'), 'quantilesOrDefault': ('quantiles', 'OrDefault'), 'uniqCombinedOrDefault': ('uniqCombined', 'OrDefault'), 'avgWeightedOrDefault': ('avgWeighted', 'OrDefault'), 'covarSampOrDefault': ('covarSamp', 'OrDefault'), 'uniqOrDefault': ('uniq', 'OrDefault'), 'quantilesTimingWeightedOrDefault': ('quantilesTimingWeighted', 'OrDefault'), 'stddevSampOrDefault': ('stddevSamp', 'OrDefault'), 'uniqUpToOrDefault': ('uniqUpTo', 'OrDefault'), 'quantilesInterpolatedWeightedOrDefault': ('quantilesInterpolatedWeighted', 'OrDefault'), 'groupBitmapXorOrDefault': ('groupBitmapXor', 'OrDefault'), 'first_valueOrDefault': ('first_value', 'OrDefault'), 'quantileTimingOrDefault': ('quantileTiming', 'OrDefault'), 'minMapOrDefault': ('minMap', 'OrDefault'), 'anyHeavyOrDefault': ('anyHeavy', 'OrDefault'), 'quantilesExactWeightedOrDefault': ('quantilesExactWeighted', 'OrDefault'), 'varSampOrDefault': ('varSamp', 'OrDefault'), 'simpleLinearRegressionOrDefault': ('simpleLinearRegression', 'OrDefault'), 'cramersVBiasCorrectedOrDefault': ('cramersVBiasCorrected', 'OrDefault'), 'mannWhitneyUTestOrDefault': ('mannWhitneyUTest', 'OrDefault'), 'quantileExactWeightedOrDefault': ('quantileExactWeighted', 'OrDefault'), 'topKWeightedOrDefault': ('topKWeighted', 'OrDefault'), 'maxOrDefault': ('max', 'OrDefault'), 'cramersVOrDefault': ('cramersV', 'OrDefault'), 'quantilesBFloat16OrDefault': ('quantilesBFloat16', 'OrDefault'), 'uniqThetaOrDefault': ('uniqTheta', 'OrDefault'), 'kurtPopOrDefault': ('kurtPop', 'OrDefault'), 'stddevPopOrDefault': ('stddevPop', 'OrDefault'), 'sumMapOrDefault': ('sumMap', 'OrDefault'), 'stochasticLogisticRegressionOrDefault': ('stochasticLogisticRegression', 'OrDefault'), 'quantileBFloat16OrDefault': ('quantileBFloat16', 'OrDefault'), 'maxMapOrDefault': ('maxMap', 'OrDefault'), 'groupBitOrOrDefault': ('groupBitOr', 'OrDefault'), 'boundingRatioOrDefault': ('boundingRatio', 'OrDefault'), 'uniqCombined64OrDefault': ('uniqCombined64', 'OrDefault'), 'maxIntersectionsOrDefault': ('maxIntersections', 'OrDefault'), 'maxIntersectionsPositionOrDefault': ('maxIntersectionsPosition', 'OrDefault'), 'contingencyOrDefault': ('contingency', 'OrDefault'), 'intervalLengthSumOrDefault': ('intervalLengthSum', 'OrDefault'), 'groupArraySampleOrDefault': ('groupArraySample', 'OrDefault'), 'theilsUOrDefault': ('theilsU', 'OrDefault'), 'quantilesTDigestWeightedOrDefault': ('quantilesTDigestWeighted', 'OrDefault'), 'exponentialMovingAverageOrDefault': ('exponentialMovingAverage', 'OrDefault'), 'topKOrDefault': ('topK', 'OrDefault'), 'meanZTestOrDefault': ('meanZTest', 'OrDefault'), 'sumOrDefault': ('sum', 'OrDefault'), 'covarPopOrDefault': ('covarPop', 'OrDefault'), 'anyOrDefault': ('any', 'OrDefault'), 'deltaSumOrDefault': ('deltaSum', 'OrDefault'), 'quantileTDigestOrDefault': ('quantileTDigest', 'OrDefault'), 'stochasticLinearRegressionOrDefault': ('stochasticLinearRegression', 'OrDefault'), 'sequenceMatchOrDefault': ('sequenceMatch', 'OrDefault'), 'corrOrDefault': ('corr', 'OrDefault'), 'retentionOrDefault': ('retention', 'OrDefault'), 'quantileTDigestWeightedOrDefault': ('quantileTDigestWeighted', 'OrDefault'), 'quantilesBFloat16WeightedOrDefault': ('quantilesBFloat16Weighted', 'OrDefault'), 'windowFunnelOrDefault': ('windowFunnel', 'OrDefault'), 'groupArrayInsertAtOrDefault': ('groupArrayInsertAt', 'OrDefault'), 'groupArrayMovingAvgOrDefault': ('groupArrayMovingAvg', 'OrDefault'), 'exponentialTimeDecayedAvgOrDefault': ('exponentialTimeDecayedAvg', 'OrDefault'), 'skewPopOrDefault': ('skewPop', 'OrDefault'), 'sumCountOrDefault': ('sumCount', 'OrDefault'), 'quantileInterpolatedWeightedOrDefault': ('quantileInterpolatedWeighted', 'OrDefault'), 'medianOrDefault': ('median', 'OrDefault'), 'quantilesDeterministicOrDefault': ('quantilesDeterministic', 'OrDefault'), 'entropyOrDefault': ('entropy', 'OrDefault'), 'quantileOrDefault': ('quantile', 'OrDefault'), 'quantileGKOrDefault': ('quantileGK', 'OrDefault'), 'quantileBFloat16WeightedOrDefault': ('quantileBFloat16Weighted', 'OrDefault'), 'uniqExactOrDefault': ('uniqExact', 'OrDefault'), 'quantilesExactLowOrDefault': ('quantilesExactLow', 'OrDefault'), 'quantilesTDigestOrDefault': ('quantilesTDigest', 'OrDefault'), 'minOrDefault': ('min', 'OrDefault'), 'quantileExactOrDefault': ('quantileExact', 'OrDefault'), 'rankCorrOrDefault': ('rankCorr', 'OrDefault'), 'groupArrayMovingSumOrDefault': ('groupArrayMovingSum', 'OrDefault'), 'quantilesExactOrDefault': ('quantilesExact', 'OrDefault'), 'groupBitmapOrOrDefault': ('groupBitmapOr', 'OrDefault'), 'kurtSampOrDefault': ('kurtSamp', 'OrDefault'), 'welchTTestOrDefault': ('welchTTest', 'OrDefault'), 'groupBitAndOrDefault': ('groupBitAnd', 'OrDefault'), 'argMinOrDefault': ('argMin', 'OrDefault'), 'countOrDefault': ('count', 'OrDefault'), 'avgOrNull': ('avg', 'OrNull'), 'sumKahanOrNull': ('sumKahan', 'OrNull'), 'studentTTestOrNull': ('studentTTest', 'OrNull'), 'sequenceNextNodeOrNull': ('sequenceNextNode', 'OrNull'), 'skewSampOrNull': ('skewSamp', 'OrNull'), 'histogramOrNull': ('histogram', 'OrNull'), 'sumWithOverflowOrNull': ('sumWithOverflow', 'OrNull'), 'groupArrayOrNull': ('groupArray', 'OrNull'), 'quantilesGKOrNull': ('quantilesGK', 'OrNull'), 'quantileExactLowOrNull': ('quantileExactLow', 'OrNull'), 'kolmogorovSmirnovTestOrNull': ('kolmogorovSmirnovTest', 'OrNull'), 'groupBitmapOrNull': ('groupBitmap', 'OrNull'), 'quantilesExactHighOrNull': ('quantilesExactHigh', 'OrNull'), 'anyLastOrNull': ('anyLast', 'OrNull'), 'groupArrayLastOrNull': ('groupArrayLast', 'OrNull'), 'quantilesTimingOrNull': ('quantilesTiming', 'OrNull'), 'quantileTimingWeightedOrNull': ('quantileTimingWeighted', 'OrNull'), 'last_valueOrNull': ('last_value', 'OrNull'), 'groupBitmapAndOrNull': ('groupBitmapAnd', 'OrNull'), 'argMaxOrNull': ('argMax', 'OrNull'), 'quantileDeterministicOrNull': ('quantileDeterministic', 'OrNull'), 'groupBitXorOrNull': ('groupBitXor', 'OrNull'), 'largestTriangleThreeBucketsOrNull': ('largestTriangleThreeBuckets', 'OrNull'), 'groupUniqArrayOrNull': ('groupUniqArray', 'OrNull'), 'deltaSumTimestampOrNull': ('deltaSumTimestamp', 'OrNull'), 'varPopOrNull': ('varPop', 'OrNull'), 'uniqHLL12OrNull': ('uniqHLL12', 'OrNull'), 'categoricalInformationValueOrNull': ('categoricalInformationValue', 'OrNull'), 'sparkBarOrNull': ('sparkBar', 'OrNull'), 'quantileExactHighOrNull': ('quantileExactHigh', 'OrNull'), 'sequenceCountOrNull': ('sequenceCount', 'OrNull'), 'quantilesOrNull': ('quantiles', 'OrNull'), 'uniqCombinedOrNull': ('uniqCombined', 'OrNull'), 'avgWeightedOrNull': ('avgWeighted', 'OrNull'), 'covarSampOrNull': ('covarSamp', 'OrNull'), 'uniqOrNull': ('uniq', 'OrNull'), 'quantilesTimingWeightedOrNull': ('quantilesTimingWeighted', 'OrNull'), 'stddevSampOrNull': ('stddevSamp', 'OrNull'), 'uniqUpToOrNull': ('uniqUpTo', 'OrNull'), 'quantilesInterpolatedWeightedOrNull': ('quantilesInterpolatedWeighted', 'OrNull'), 'groupBitmapXorOrNull': ('groupBitmapXor', 'OrNull'), 'first_valueOrNull': ('first_value', 'OrNull'), 'quantileTimingOrNull': ('quantileTiming', 'OrNull'), 'minMapOrNull': ('minMap', 'OrNull'), 'anyHeavyOrNull': ('anyHeavy', 'OrNull'), 'quantilesExactWeightedOrNull': ('quantilesExactWeighted', 'OrNull'), 'varSampOrNull': ('varSamp', 'OrNull'), 'simpleLinearRegressionOrNull': ('simpleLinearRegression', 'OrNull'), 'cramersVBiasCorrectedOrNull': ('cramersVBiasCorrected', 'OrNull'), 'mannWhitneyUTestOrNull': ('mannWhitneyUTest', 'OrNull'), 'quantileExactWeightedOrNull': ('quantileExactWeighted', 'OrNull'), 'topKWeightedOrNull': ('topKWeighted', 'OrNull'), 'maxOrNull': ('max', 'OrNull'), 'cramersVOrNull': ('cramersV', 'OrNull'), 'quantilesBFloat16OrNull': ('quantilesBFloat16', 'OrNull'), 'uniqThetaOrNull': ('uniqTheta', 'OrNull'), 'kurtPopOrNull': ('kurtPop', 'OrNull'), 'stddevPopOrNull': ('stddevPop', 'OrNull'), 'sumMapOrNull': ('sumMap', 'OrNull'), 'stochasticLogisticRegressionOrNull': ('stochasticLogisticRegression', 'OrNull'), 'quantileBFloat16OrNull': ('quantileBFloat16', 'OrNull'), 'maxMapOrNull': ('maxMap', 'OrNull'), 'groupBitOrOrNull': ('groupBitOr', 'OrNull'), 'boundingRatioOrNull': ('boundingRatio', 'OrNull'), 'uniqCombined64OrNull': ('uniqCombined64', 'OrNull'), 'maxIntersectionsOrNull': ('maxIntersections', 'OrNull'), 'maxIntersectionsPositionOrNull': ('maxIntersectionsPosition', 'OrNull'), 'contingencyOrNull': ('contingency', 'OrNull'), 'intervalLengthSumOrNull': ('intervalLengthSum', 'OrNull'), 'groupArraySampleOrNull': ('groupArraySample', 'OrNull'), 'theilsUOrNull': ('theilsU', 'OrNull'), 'quantilesTDigestWeightedOrNull': ('quantilesTDigestWeighted', 'OrNull'), 'exponentialMovingAverageOrNull': ('exponentialMovingAverage', 'OrNull'), 'topKOrNull': ('topK', 'OrNull'), 'meanZTestOrNull': ('meanZTest', 'OrNull'), 'sumOrNull': ('sum', 'OrNull'), 'covarPopOrNull': ('covarPop', 'OrNull'), 'anyOrNull': ('any', 'OrNull'), 'deltaSumOrNull': ('deltaSum', 'OrNull'), 'quantileTDigestOrNull': ('quantileTDigest', 'OrNull'), 'stochasticLinearRegressionOrNull': ('stochasticLinearRegression', 'OrNull'), 'sequenceMatchOrNull': ('sequenceMatch', 'OrNull'), 'corrOrNull': ('corr', 'OrNull'), 'retentionOrNull': ('retention', 'OrNull'), 'quantileTDigestWeightedOrNull': ('quantileTDigestWeighted', 'OrNull'), 'quantilesBFloat16WeightedOrNull': ('quantilesBFloat16Weighted', 'OrNull'), 'windowFunnelOrNull': ('windowFunnel', 'OrNull'), 'groupArrayInsertAtOrNull': ('groupArrayInsertAt', 'OrNull'), 'groupArrayMovingAvgOrNull': ('groupArrayMovingAvg', 'OrNull'), 'exponentialTimeDecayedAvgOrNull': ('exponentialTimeDecayedAvg', 'OrNull'), 'skewPopOrNull': ('skewPop', 'OrNull'), 'sumCountOrNull': ('sumCount', 'OrNull'), 'quantileInterpolatedWeightedOrNull': ('quantileInterpolatedWeighted', 'OrNull'), 'medianOrNull': ('median', 'OrNull'), 'quantilesDeterministicOrNull': ('quantilesDeterministic', 'OrNull'), 'entropyOrNull': ('entropy', 'OrNull'), 'quantileOrNull': ('quantile', 'OrNull'), 'quantileGKOrNull': ('quantileGK', 'OrNull'), 'quantileBFloat16WeightedOrNull': ('quantileBFloat16Weighted', 'OrNull'), 'uniqExactOrNull': ('uniqExact', 'OrNull'), 'quantilesExactLowOrNull': ('quantilesExactLow', 'OrNull'), 'quantilesTDigestOrNull': ('quantilesTDigest', 'OrNull'), 'minOrNull': ('min', 'OrNull'), 'quantileExactOrNull': ('quantileExact', 'OrNull'), 'rankCorrOrNull': ('rankCorr', 'OrNull'), 'groupArrayMovingSumOrNull': ('groupArrayMovingSum', 'OrNull'), 'quantilesExactOrNull': ('quantilesExact', 'OrNull'), 'groupBitmapOrOrNull': ('groupBitmapOr', 'OrNull'), 'kurtSampOrNull': ('kurtSamp', 'OrNull'), 'welchTTestOrNull': ('welchTTest', 'OrNull'), 'groupBitAndOrNull': ('groupBitAnd', 'OrNull'), 'argMinOrNull': ('argMin', 'OrNull'), 'countOrNull': ('count', 'OrNull'), 'avgResample': ('avg', 'Resample'), 'sumKahanResample': ('sumKahan', 'Resample'), 'studentTTestResample': ('studentTTest', 'Resample'), 'sequenceNextNodeResample': ('sequenceNextNode', 'Resample'), 'skewSampResample': ('skewSamp', 'Resample'), 'histogramResample': ('histogram', 'Resample'), 'sumWithOverflowResample': ('sumWithOverflow', 'Resample'), 'groupArrayResample': ('groupArray', 'Resample'), 'quantilesGKResample': ('quantilesGK', 'Resample'), 'quantileExactLowResample': ('quantileExactLow', 'Resample'), 'kolmogorovSmirnovTestResample': ('kolmogorovSmirnovTest', 'Resample'), 'groupBitmapResample': ('groupBitmap', 'Resample'), 'quantilesExactHighResample': ('quantilesExactHigh', 'Resample'), 'anyLastResample': ('anyLast', 'Resample'), 'groupArrayLastResample': ('groupArrayLast', 'Resample'), 'quantilesTimingResample': ('quantilesTiming', 'Resample'), 'quantileTimingWeightedResample': ('quantileTimingWeighted', 'Resample'), 'last_valueResample': ('last_value', 'Resample'), 'groupBitmapAndResample': ('groupBitmapAnd', 'Resample'), 'argMaxResample': ('argMax', 'Resample'), 'quantileDeterministicResample': ('quantileDeterministic', 'Resample'), 'groupBitXorResample': ('groupBitXor', 'Resample'), 'largestTriangleThreeBucketsResample': ('largestTriangleThreeBuckets', 'Resample'), 'groupUniqArrayResample': ('groupUniqArray', 'Resample'), 'deltaSumTimestampResample': ('deltaSumTimestamp', 'Resample'), 'varPopResample': ('varPop', 'Resample'), 'uniqHLL12Resample': ('uniqHLL12', 'Resample'), 'categoricalInformationValueResample': ('categoricalInformationValue', 'Resample'), 'sparkBarResample': ('sparkBar', 'Resample'), 'quantileExactHighResample': ('quantileExactHigh', 'Resample'), 'sequenceCountResample': ('sequenceCount', 'Resample'), 'quantilesResample': ('quantiles', 'Resample'), 'uniqCombinedResample': ('uniqCombined', 'Resample'), 'avgWeightedResample': ('avgWeighted', 'Resample'), 'covarSampResample': ('covarSamp', 'Resample'), 'uniqResample': ('uniq', 'Resample'), 'quantilesTimingWeightedResample': ('quantilesTimingWeighted', 'Resample'), 'stddevSampResample': ('stddevSamp', 'Resample'), 'uniqUpToResample': ('uniqUpTo', 'Resample'), 'quantilesInterpolatedWeightedResample': ('quantilesInterpolatedWeighted', 'Resample'), 'groupBitmapXorResample': ('groupBitmapXor', 'Resample'), 'first_valueResample': ('first_value', 'Resample'), 'quantileTimingResample': ('quantileTiming', 'Resample'), 'minMapResample': ('minMap', 'Resample'), 'anyHeavyResample': ('anyHeavy', 'Resample'), 'quantilesExactWeightedResample': ('quantilesExactWeighted', 'Resample'), 'varSampResample': ('varSamp', 'Resample'), 'simpleLinearRegressionResample': ('simpleLinearRegression', 'Resample'), 'cramersVBiasCorrectedResample': ('cramersVBiasCorrected', 'Resample'), 'mannWhitneyUTestResample': ('mannWhitneyUTest', 'Resample'), 'quantileExactWeightedResample': ('quantileExactWeighted', 'Resample'), 'topKWeightedResample': ('topKWeighted', 'Resample'), 'maxResample': ('max', 'Resample'), 'cramersVResample': ('cramersV', 'Resample'), 'quantilesBFloat16Resample': ('quantilesBFloat16', 'Resample'), 'uniqThetaResample': ('uniqTheta', 'Resample'), 'kurtPopResample': ('kurtPop', 'Resample'), 'stddevPopResample': ('stddevPop', 'Resample'), 'sumMapResample': ('sumMap', 'Resample'), 'stochasticLogisticRegressionResample': ('stochasticLogisticRegression', 'Resample'), 'quantileBFloat16Resample': ('quantileBFloat16', 'Resample'), 'maxMapResample': ('maxMap', 'Resample'), 'groupBitOrResample': ('groupBitOr', 'Resample'), 'boundingRatioResample': ('boundingRatio', 'Resample'), 'uniqCombined64Resample': ('uniqCombined64', 'Resample'), 'maxIntersectionsResample': ('maxIntersections', 'Resample'), 'maxIntersectionsPositionResample': ('maxIntersectionsPosition', 'Resample'), 'contingencyResample': ('contingency', 'Resample'), 'intervalLengthSumResample': ('intervalLengthSum', 'Resample'), 'groupArraySampleResample': ('groupArraySample', 'Resample'), 'theilsUResample': ('theilsU', 'Resample'), 'quantilesTDigestWeightedResample': ('quantilesTDigestWeighted', 'Resample'), 'exponentialMovingAverageResample': ('exponentialMovingAverage', 'Resample'), 'topKResample': ('topK', 'Resample'), 'meanZTestResample': ('meanZTest', 'Resample'), 'sumResample': ('sum', 'Resample'), 'covarPopResample': ('covarPop', 'Resample'), 'anyResample': ('any', 'Resample'), 'deltaSumResample': ('deltaSum', 'Resample'), 'quantileTDigestResample': ('quantileTDigest', 'Resample'), 'stochasticLinearRegressionResample': ('stochasticLinearRegression', 'Resample'), 'sequenceMatchResample': ('sequenceMatch', 'Resample'), 'corrResample': ('corr', 'Resample'), 'retentionResample': ('retention', 'Resample'), 'quantileTDigestWeightedResample': ('quantileTDigestWeighted', 'Resample'), 'quantilesBFloat16WeightedResample': ('quantilesBFloat16Weighted', 'Resample'), 'windowFunnelResample': ('windowFunnel', 'Resample'), 'groupArrayInsertAtResample': ('groupArrayInsertAt', 'Resample'), 'groupArrayMovingAvgResample': ('groupArrayMovingAvg', 'Resample'), 'exponentialTimeDecayedAvgResample': ('exponentialTimeDecayedAvg', 'Resample'), 'skewPopResample': ('skewPop', 'Resample'), 'sumCountResample': ('sumCount', 'Resample'), 'quantileInterpolatedWeightedResample': ('quantileInterpolatedWeighted', 'Resample'), 'medianResample': ('median', 'Resample'), 'quantilesDeterministicResample': ('quantilesDeterministic', 'Resample'), 'entropyResample': ('entropy', 'Resample'), 'quantileResample': ('quantile', 'Resample'), 'quantileGKResample': ('quantileGK', 'Resample'), 'quantileBFloat16WeightedResample': ('quantileBFloat16Weighted', 'Resample'), 'uniqExactResample': ('uniqExact', 'Resample'), 'quantilesExactLowResample': ('quantilesExactLow', 'Resample'), 'quantilesTDigestResample': ('quantilesTDigest', 'Resample'), 'minResample': ('min', 'Resample'), 'quantileExactResample': ('quantileExact', 'Resample'), 'rankCorrResample': ('rankCorr', 'Resample'), 'groupArrayMovingSumResample': ('groupArrayMovingSum', 'Resample'), 'quantilesExactResample': ('quantilesExact', 'Resample'), 'groupBitmapOrResample': ('groupBitmapOr', 'Resample'), 'kurtSampResample': ('kurtSamp', 'Resample'), 'welchTTestResample': ('welchTTest', 'Resample'), 'groupBitAndResample': ('groupBitAnd', 'Resample'), 'argMinResample': ('argMin', 'Resample'), 'countResample': ('count', 'Resample'), 'avgArgMin': ('avg', 'ArgMin'), 'sumKahanArgMin': ('sumKahan', 'ArgMin'), 'studentTTestArgMin': ('studentTTest', 'ArgMin'), 'sequenceNextNodeArgMin': ('sequenceNextNode', 'ArgMin'), 'skewSampArgMin': ('skewSamp', 'ArgMin'), 'histogramArgMin': ('histogram', 'ArgMin'), 'sumWithOverflowArgMin': ('sumWithOverflow', 'ArgMin'), 'groupArrayArgMin': ('groupArray', 'ArgMin'), 'quantilesGKArgMin': ('quantilesGK', 'ArgMin'), 'quantileExactLowArgMin': ('quantileExactLow', 'ArgMin'), 'kolmogorovSmirnovTestArgMin': ('kolmogorovSmirnovTest', 'ArgMin'), 'groupBitmapArgMin': ('groupBitmap', 'ArgMin'), 'quantilesExactHighArgMin': ('quantilesExactHigh', 'ArgMin'), 'anyLastArgMin': ('anyLast', 'ArgMin'), 'groupArrayLastArgMin': ('groupArrayLast', 'ArgMin'), 'quantilesTimingArgMin': ('quantilesTiming', 'ArgMin'), 'quantileTimingWeightedArgMin': ('quantileTimingWeighted', 'ArgMin'), 'last_valueArgMin': ('last_value', 'ArgMin'), 'groupBitmapAndArgMin': ('groupBitmapAnd', 'ArgMin'), 'argMaxArgMin': ('argMax', 'ArgMin'), 'quantileDeterministicArgMin': ('quantileDeterministic', 'ArgMin'), 'groupBitXorArgMin': ('groupBitXor', 'ArgMin'), 'largestTriangleThreeBucketsArgMin': ('largestTriangleThreeBuckets', 'ArgMin'), 'groupUniqArrayArgMin': ('groupUniqArray', 'ArgMin'), 'deltaSumTimestampArgMin': ('deltaSumTimestamp', 'ArgMin'), 'varPopArgMin': ('varPop', 'ArgMin'), 'uniqHLL12ArgMin': ('uniqHLL12', 'ArgMin'), 'categoricalInformationValueArgMin': ('categoricalInformationValue', 'ArgMin'), 'sparkBarArgMin': ('sparkBar', 'ArgMin'), 'quantileExactHighArgMin': ('quantileExactHigh', 'ArgMin'), 'sequenceCountArgMin': ('sequenceCount', 'ArgMin'), 'quantilesArgMin': ('quantiles', 'ArgMin'), 'uniqCombinedArgMin': ('uniqCombined', 'ArgMin'), 'avgWeightedArgMin': ('avgWeighted', 'ArgMin'), 'covarSampArgMin': ('covarSamp', 'ArgMin'), 'uniqArgMin': ('uniq', 'ArgMin'), 'quantilesTimingWeightedArgMin': ('quantilesTimingWeighted', 'ArgMin'), 'stddevSampArgMin': ('stddevSamp', 'ArgMin'), 'uniqUpToArgMin': ('uniqUpTo', 'ArgMin'), 'quantilesInterpolatedWeightedArgMin': ('quantilesInterpolatedWeighted', 'ArgMin'), 'groupBitmapXorArgMin': ('groupBitmapXor', 'ArgMin'), 'first_valueArgMin': ('first_value', 'ArgMin'), 'quantileTimingArgMin': ('quantileTiming', 'ArgMin'), 'minMapArgMin': ('minMap', 'ArgMin'), 'anyHeavyArgMin': ('anyHeavy', 'ArgMin'), 'quantilesExactWeightedArgMin': ('quantilesExactWeighted', 'ArgMin'), 'varSampArgMin': ('varSamp', 'ArgMin'), 'simpleLinearRegressionArgMin': ('simpleLinearRegression', 'ArgMin'), 'cramersVBiasCorrectedArgMin': ('cramersVBiasCorrected', 'ArgMin'), 'mannWhitneyUTestArgMin': ('mannWhitneyUTest', 'ArgMin'), 'quantileExactWeightedArgMin': ('quantileExactWeighted', 'ArgMin'), 'topKWeightedArgMin': ('topKWeighted', 'ArgMin'), 'maxArgMin': ('max', 'ArgMin'), 'cramersVArgMin': ('cramersV', 'ArgMin'), 'quantilesBFloat16ArgMin': ('quantilesBFloat16', 'ArgMin'), 'uniqThetaArgMin': ('uniqTheta', 'ArgMin'), 'kurtPopArgMin': ('kurtPop', 'ArgMin'), 'stddevPopArgMin': ('stddevPop', 'ArgMin'), 'sumMapArgMin': ('sumMap', 'ArgMin'), 'stochasticLogisticRegressionArgMin': ('stochasticLogisticRegression', 'ArgMin'), 'quantileBFloat16ArgMin': ('quantileBFloat16', 'ArgMin'), 'maxMapArgMin': ('maxMap', 'ArgMin'), 'groupBitOrArgMin': ('groupBitOr', 'ArgMin'), 'boundingRatioArgMin': ('boundingRatio', 'ArgMin'), 'uniqCombined64ArgMin': ('uniqCombined64', 'ArgMin'), 'maxIntersectionsArgMin': ('maxIntersections', 'ArgMin'), 'maxIntersectionsPositionArgMin': ('maxIntersectionsPosition', 'ArgMin'), 'contingencyArgMin': ('contingency', 'ArgMin'), 'intervalLengthSumArgMin': ('intervalLengthSum', 'ArgMin'), 'groupArraySampleArgMin': ('groupArraySample', 'ArgMin'), 'theilsUArgMin': ('theilsU', 'ArgMin'), 'quantilesTDigestWeightedArgMin': ('quantilesTDigestWeighted', 'ArgMin'), 'exponentialMovingAverageArgMin': ('exponentialMovingAverage', 'ArgMin'), 'topKArgMin': ('topK', 'ArgMin'), 'meanZTestArgMin': ('meanZTest', 'ArgMin'), 'sumArgMin': ('sum', 'ArgMin'), 'covarPopArgMin': ('covarPop', 'ArgMin'), 'anyArgMin': ('any', 'ArgMin'), 'deltaSumArgMin': ('deltaSum', 'ArgMin'), 'quantileTDigestArgMin': ('quantileTDigest', 'ArgMin'), 'stochasticLinearRegressionArgMin': ('stochasticLinearRegression', 'ArgMin'), 'sequenceMatchArgMin': ('sequenceMatch', 'ArgMin'), 'corrArgMin': ('corr', 'ArgMin'), 'retentionArgMin': ('retention', 'ArgMin'), 'quantileTDigestWeightedArgMin': ('quantileTDigestWeighted', 'ArgMin'), 'quantilesBFloat16WeightedArgMin': ('quantilesBFloat16Weighted', 'ArgMin'), 'windowFunnelArgMin': ('windowFunnel', 'ArgMin'), 'groupArrayInsertAtArgMin': ('groupArrayInsertAt', 'ArgMin'), 'groupArrayMovingAvgArgMin': ('groupArrayMovingAvg', 'ArgMin'), 'exponentialTimeDecayedAvgArgMin': ('exponentialTimeDecayedAvg', 'ArgMin'), 'skewPopArgMin': ('skewPop', 'ArgMin'), 'sumCountArgMin': ('sumCount', 'ArgMin'), 'quantileInterpolatedWeightedArgMin': ('quantileInterpolatedWeighted', 'ArgMin'), 'medianArgMin': ('median', 'ArgMin'), 'quantilesDeterministicArgMin': ('quantilesDeterministic', 'ArgMin'), 'entropyArgMin': ('entropy', 'ArgMin'), 'quantileArgMin': ('quantile', 'ArgMin'), 'quantileGKArgMin': ('quantileGK', 'ArgMin'), 'quantileBFloat16WeightedArgMin': ('quantileBFloat16Weighted', 'ArgMin'), 'uniqExactArgMin': ('uniqExact', 'ArgMin'), 'quantilesExactLowArgMin': ('quantilesExactLow', 'ArgMin'), 'quantilesTDigestArgMin': ('quantilesTDigest', 'ArgMin'), 'minArgMin': ('min', 'ArgMin'), 'quantileExactArgMin': ('quantileExact', 'ArgMin'), 'rankCorrArgMin': ('rankCorr', 'ArgMin'), 'groupArrayMovingSumArgMin': ('groupArrayMovingSum', 'ArgMin'), 'quantilesExactArgMin': ('quantilesExact', 'ArgMin'), 'groupBitmapOrArgMin': ('groupBitmapOr', 'ArgMin'), 'kurtSampArgMin': ('kurtSamp', 'ArgMin'), 'welchTTestArgMin': ('welchTTest', 'ArgMin'), 'groupBitAndArgMin': ('groupBitAnd', 'ArgMin'), 'argMinArgMin': ('argMin', 'ArgMin'), 'countArgMin': ('count', 'ArgMin'), 'avgArgMax': ('avg', 'ArgMax'), 'sumKahanArgMax': ('sumKahan', 'ArgMax'), 'studentTTestArgMax': ('studentTTest', 'ArgMax'), 'sequenceNextNodeArgMax': ('sequenceNextNode', 'ArgMax'), 'skewSampArgMax': ('skewSamp', 'ArgMax'), 'histogramArgMax': ('histogram', 'ArgMax'), 'sumWithOverflowArgMax': ('sumWithOverflow', 'ArgMax'), 'groupArrayArgMax': ('groupArray', 'ArgMax'), 'quantilesGKArgMax': ('quantilesGK', 'ArgMax'), 'quantileExactLowArgMax': ('quantileExactLow', 'ArgMax'), 'kolmogorovSmirnovTestArgMax': ('kolmogorovSmirnovTest', 'ArgMax'), 'groupBitmapArgMax': ('groupBitmap', 'ArgMax'), 'quantilesExactHighArgMax': ('quantilesExactHigh', 'ArgMax'), 'anyLastArgMax': ('anyLast', 'ArgMax'), 'groupArrayLastArgMax': ('groupArrayLast', 'ArgMax'), 'quantilesTimingArgMax': ('quantilesTiming', 'ArgMax'), 'quantileTimingWeightedArgMax': ('quantileTimingWeighted', 'ArgMax'), 'last_valueArgMax': ('last_value', 'ArgMax'), 'groupBitmapAndArgMax': ('groupBitmapAnd', 'ArgMax'), 'argMaxArgMax': ('argMax', 'ArgMax'), 'quantileDeterministicArgMax': ('quantileDeterministic', 'ArgMax'), 'groupBitXorArgMax': ('groupBitXor', 'ArgMax'), 'largestTriangleThreeBucketsArgMax': ('largestTriangleThreeBuckets', 'ArgMax'), 'groupUniqArrayArgMax': ('groupUniqArray', 'ArgMax'), 'deltaSumTimestampArgMax': ('deltaSumTimestamp', 'ArgMax'), 'varPopArgMax': ('varPop', 'ArgMax'), 'uniqHLL12ArgMax': ('uniqHLL12', 'ArgMax'), 'categoricalInformationValueArgMax': ('categoricalInformationValue', 'ArgMax'), 'sparkBarArgMax': ('sparkBar', 'ArgMax'), 'quantileExactHighArgMax': ('quantileExactHigh', 'ArgMax'), 'sequenceCountArgMax': ('sequenceCount', 'ArgMax'), 'quantilesArgMax': ('quantiles', 'ArgMax'), 'uniqCombinedArgMax': ('uniqCombined', 'ArgMax'), 'avgWeightedArgMax': ('avgWeighted', 'ArgMax'), 'covarSampArgMax': ('covarSamp', 'ArgMax'), 'uniqArgMax': ('uniq', 'ArgMax'), 'quantilesTimingWeightedArgMax': ('quantilesTimingWeighted', 'ArgMax'), 'stddevSampArgMax': ('stddevSamp', 'ArgMax'), 'uniqUpToArgMax': ('uniqUpTo', 'ArgMax'), 'quantilesInterpolatedWeightedArgMax': ('quantilesInterpolatedWeighted', 'ArgMax'), 'groupBitmapXorArgMax': ('groupBitmapXor', 'ArgMax'), 'first_valueArgMax': ('first_value', 'ArgMax'), 'quantileTimingArgMax': ('quantileTiming', 'ArgMax'), 'minMapArgMax': ('minMap', 'ArgMax'), 'anyHeavyArgMax': ('anyHeavy', 'ArgMax'), 'quantilesExactWeightedArgMax': ('quantilesExactWeighted', 'ArgMax'), 'varSampArgMax': ('varSamp', 'ArgMax'), 'simpleLinearRegressionArgMax': ('simpleLinearRegression', 'ArgMax'), 'cramersVBiasCorrectedArgMax': ('cramersVBiasCorrected', 'ArgMax'), 'mannWhitneyUTestArgMax': ('mannWhitneyUTest', 'ArgMax'), 'quantileExactWeightedArgMax': ('quantileExactWeighted', 'ArgMax'), 'topKWeightedArgMax': ('topKWeighted', 'ArgMax'), 'maxArgMax': ('max', 'ArgMax'), 'cramersVArgMax': ('cramersV', 'ArgMax'), 'quantilesBFloat16ArgMax': ('quantilesBFloat16', 'ArgMax'), 'uniqThetaArgMax': ('uniqTheta', 'ArgMax'), 'kurtPopArgMax': ('kurtPop', 'ArgMax'), 'stddevPopArgMax': ('stddevPop', 'ArgMax'), 'sumMapArgMax': ('sumMap', 'ArgMax'), 'stochasticLogisticRegressionArgMax': ('stochasticLogisticRegression', 'ArgMax'), 'quantileBFloat16ArgMax': ('quantileBFloat16', 'ArgMax'), 'maxMapArgMax': ('maxMap', 'ArgMax'), 'groupBitOrArgMax': ('groupBitOr', 'ArgMax'), 'boundingRatioArgMax': ('boundingRatio', 'ArgMax'), 'uniqCombined64ArgMax': ('uniqCombined64', 'ArgMax'), 'maxIntersectionsArgMax': ('maxIntersections', 'ArgMax'), 'maxIntersectionsPositionArgMax': ('maxIntersectionsPosition', 'ArgMax'), 'contingencyArgMax': ('contingency', 'ArgMax'), 'intervalLengthSumArgMax': ('intervalLengthSum', 'ArgMax'), 'groupArraySampleArgMax': ('groupArraySample', 'ArgMax'), 'theilsUArgMax': ('theilsU', 'ArgMax'), 'quantilesTDigestWeightedArgMax': ('quantilesTDigestWeighted', 'ArgMax'), 'exponentialMovingAverageArgMax': ('exponentialMovingAverage', 'ArgMax'), 'topKArgMax': ('topK', 'ArgMax'), 'meanZTestArgMax': ('meanZTest', 'ArgMax'), 'sumArgMax': ('sum', 'ArgMax'), 'covarPopArgMax': ('covarPop', 'ArgMax'), 'anyArgMax': ('any', 'ArgMax'), 'deltaSumArgMax': ('deltaSum', 'ArgMax'), 'quantileTDigestArgMax': ('quantileTDigest', 'ArgMax'), 'stochasticLinearRegressionArgMax': ('stochasticLinearRegression', 'ArgMax'), 'sequenceMatchArgMax': ('sequenceMatch', 'ArgMax'), 'corrArgMax': ('corr', 'ArgMax'), 'retentionArgMax': ('retention', 'ArgMax'), 'quantileTDigestWeightedArgMax': ('quantileTDigestWeighted', 'ArgMax'), 'quantilesBFloat16WeightedArgMax': ('quantilesBFloat16Weighted', 'ArgMax'), 'windowFunnelArgMax': ('windowFunnel', 'ArgMax'), 'groupArrayInsertAtArgMax': ('groupArrayInsertAt', 'ArgMax'), 'groupArrayMovingAvgArgMax': ('groupArrayMovingAvg', 'ArgMax'), 'exponentialTimeDecayedAvgArgMax': ('exponentialTimeDecayedAvg', 'ArgMax'), 'skewPopArgMax': ('skewPop', 'ArgMax'), 'sumCountArgMax': ('sumCount', 'ArgMax'), 'quantileInterpolatedWeightedArgMax': ('quantileInterpolatedWeighted', 'ArgMax'), 'medianArgMax': ('median', 'ArgMax'), 'quantilesDeterministicArgMax': ('quantilesDeterministic', 'ArgMax'), 'entropyArgMax': ('entropy', 'ArgMax'), 'quantileArgMax': ('quantile', 'ArgMax'), 'quantileGKArgMax': ('quantileGK', 'ArgMax'), 'quantileBFloat16WeightedArgMax': ('quantileBFloat16Weighted', 'ArgMax'), 'uniqExactArgMax': ('uniqExact', 'ArgMax'), 'quantilesExactLowArgMax': ('quantilesExactLow', 'ArgMax'), 'quantilesTDigestArgMax': ('quantilesTDigest', 'ArgMax'), 'minArgMax': ('min', 'ArgMax'), 'quantileExactArgMax': ('quantileExact', 'ArgMax'), 'rankCorrArgMax': ('rankCorr', 'ArgMax'), 'groupArrayMovingSumArgMax': ('groupArrayMovingSum', 'ArgMax'), 'quantilesExactArgMax': ('quantilesExact', 'ArgMax'), 'groupBitmapOrArgMax': ('groupBitmapOr', 'ArgMax'), 'kurtSampArgMax': ('kurtSamp', 'ArgMax'), 'welchTTestArgMax': ('welchTTest', 'ArgMax'), 'groupBitAndArgMax': ('groupBitAnd', 'ArgMax'), 'argMinArgMax': ('argMin', 'ArgMax'), 'countArgMax': ('count', 'ArgMax'), 'avg': ('avg', ''), 'sumKahan': ('sumKahan', ''), 'studentTTest': ('studentTTest', ''), 'sequenceNextNode': ('sequenceNextNode', ''), 'skewSamp': ('skewSamp', ''), 'histogram': ('histogram', ''), 'sumWithOverflow': ('sumWithOverflow', ''), 'groupArray': ('groupArray', ''), 'quantilesGK': ('quantilesGK', ''), 'quantileExactLow': ('quantileExactLow', ''), 'kolmogorovSmirnovTest': ('kolmogorovSmirnovTest', ''), 'groupBitmap': ('groupBitmap', ''), 'quantilesExactHigh': ('quantilesExactHigh', ''), 'anyLast': ('anyLast', ''), 'groupArrayLast': ('groupArrayLast', ''), 'quantilesTiming': ('quantilesTiming', ''), 'quantileTimingWeighted': ('quantileTimingWeighted', ''), 'last_value': ('last_value', ''), 'groupBitmapAnd': ('groupBitmapAnd', ''), 'argMax': ('argMax', ''), 'quantileDeterministic': ('quantileDeterministic', ''), 'groupBitXor': ('groupBitXor', ''), 'largestTriangleThreeBuckets': ('largestTriangleThreeBuckets', ''), 'groupUniqArray': ('groupUniqArray', ''), 'deltaSumTimestamp': ('deltaSumTimestamp', ''), 'varPop': ('varPop', ''), 'uniqHLL12': ('uniqHLL12', ''), 'categoricalInformationValue': ('categoricalInformationValue', ''), 'sparkBar': ('sparkBar', ''), 'quantileExactHigh': ('quantileExactHigh', ''), 'sequenceCount': ('sequenceCount', ''), 'quantiles': ('quantiles', ''), 'uniqCombined': ('uniqCombined', ''), 'avgWeighted': ('avgWeighted', ''), 'covarSamp': ('covarSamp', ''), 'uniq': ('uniq', ''), 'quantilesTimingWeighted': ('quantilesTimingWeighted', ''), 'stddevSamp': ('stddevSamp', ''), 'uniqUpTo': ('uniqUpTo', ''), 'quantilesInterpolatedWeighted': ('quantilesInterpolatedWeighted', ''), 'groupBitmapXor': ('groupBitmapXor', ''), 'first_value': ('first_value', ''), 'quantileTiming': ('quantileTiming', ''), 'anyHeavy': ('anyHeavy', ''), 'quantilesExactWeighted': ('quantilesExactWeighted', ''), 'varSamp': ('varSamp', ''), 'simpleLinearRegression': ('simpleLinearRegression', ''), 'cramersVBiasCorrected': ('cramersVBiasCorrected', ''), 'mannWhitneyUTest': ('mannWhitneyUTest', ''), 'quantileExactWeighted': ('quantileExactWeighted', ''), 'topKWeighted': ('topKWeighted', ''), 'max': ('max', ''), 'cramersV': ('cramersV', ''), 'quantilesBFloat16': ('quantilesBFloat16', ''), 'uniqTheta': ('uniqTheta', ''), 'kurtPop': ('kurtPop', ''), 'stddevPop': ('stddevPop', ''), 'stochasticLogisticRegression': ('stochasticLogisticRegression', ''), 'quantileBFloat16': ('quantileBFloat16', ''), 'groupBitOr': ('groupBitOr', ''), 'boundingRatio': ('boundingRatio', ''), 'uniqCombined64': ('uniqCombined64', ''), 'maxIntersections': ('maxIntersections', ''), 'maxIntersectionsPosition': ('maxIntersectionsPosition', ''), 'contingency': ('contingency', ''), 'intervalLengthSum': ('intervalLengthSum', ''), 'groupArraySample': ('groupArraySample', ''), 'theilsU': ('theilsU', ''), 'quantilesTDigestWeighted': ('quantilesTDigestWeighted', ''), 'exponentialMovingAverage': ('exponentialMovingAverage', ''), 'topK': ('topK', ''), 'meanZTest': ('meanZTest', ''), 'sum': ('sum', ''), 'covarPop': ('covarPop', ''), 'any': ('any', ''), 'deltaSum': ('deltaSum', ''), 'quantileTDigest': ('quantileTDigest', ''), 'stochasticLinearRegression': ('stochasticLinearRegression', ''), 'sequenceMatch': ('sequenceMatch', ''), 'corr': ('corr', ''), 'retention': ('retention', ''), 'quantileTDigestWeighted': ('quantileTDigestWeighted', ''), 'quantilesBFloat16Weighted': ('quantilesBFloat16Weighted', ''), 'windowFunnel': ('windowFunnel', ''), 'groupArrayInsertAt': ('groupArrayInsertAt', ''), 'groupArrayMovingAvg': ('groupArrayMovingAvg', ''), 'exponentialTimeDecayedAvg': ('exponentialTimeDecayedAvg', ''), 'skewPop': ('skewPop', ''), 'sumCount': ('sumCount', ''), 'quantileInterpolatedWeighted': ('quantileInterpolatedWeighted', ''), 'median': ('median', ''), 'quantilesDeterministic': ('quantilesDeterministic', ''), 'entropy': ('entropy', ''), 'quantile': ('quantile', ''), 'quantileGK': ('quantileGK', ''), 'quantileBFloat16Weighted': ('quantileBFloat16Weighted', ''), 'uniqExact': ('uniqExact', ''), 'quantilesExactLow': ('quantilesExactLow', ''), 'quantilesTDigest': ('quantilesTDigest', ''), 'min': ('min', ''), 'quantileExact': ('quantileExact', ''), 'rankCorr': ('rankCorr', ''), 'groupArrayMovingSum': ('groupArrayMovingSum', ''), 'quantilesExact': ('quantilesExact', ''), 'groupBitmapOr': ('groupBitmapOr', ''), 'kurtSamp': ('kurtSamp', ''), 'welchTTest': ('welchTTest', ''), 'groupBitAnd': ('groupBitAnd', ''), 'argMin': ('argMin', ''), 'count': ('count', '')}
FUNCTIONS_WITH_ALIASED_ARGS = {'TUPLE', 'STRUCT'}
FUNCTION_PARSERS = {'CAST': <function Parser.<lambda>>, 'CONVERT': <function Parser.<lambda>>, 'DECODE': <function Parser.<lambda>>, 'EXTRACT': <function Parser.<lambda>>, 'GAP_FILL': <function Parser.<lambda>>, 'JSON_OBJECT': <function Parser.<lambda>>, 'JSON_OBJECTAGG': <function Parser.<lambda>>, 'JSON_TABLE': <function Parser.<lambda>>, 'OPENJSON': <function Parser.<lambda>>, 'POSITION': <function Parser.<lambda>>, 'PREDICT': <function Parser.<lambda>>, 'SAFE_CAST': <function Parser.<lambda>>, 'STRING_AGG': <function Parser.<lambda>>, 'SUBSTRING': <function Parser.<lambda>>, 'TRIM': <function Parser.<lambda>>, 'TRY_CAST': <function Parser.<lambda>>, 'TRY_CONVERT': <function Parser.<lambda>>, 'ARRAYJOIN': <function ClickHouse.Parser.<lambda>>, 'QUANTILE': <function ClickHouse.Parser.<lambda>>}
NO_PAREN_FUNCTION_PARSERS = {'CASE': <function Parser.<lambda>>, 'CONNECT_BY_ROOT': <function Parser.<lambda>>, 'IF': <function Parser.<lambda>>, 'NEXT': <function Parser.<lambda>>}
RANGE_PARSERS = {<TokenType.BETWEEN: 'BETWEEN'>: <function Parser.<lambda>>, <TokenType.GLOB: 'GLOB'>: <function binary_range_parser.<locals>._parse_binary_range>, <TokenType.ILIKE: 'ILIKE'>: <function binary_range_parser.<locals>._parse_binary_range>, <TokenType.IN: 'IN'>: <function Parser.<lambda>>, <TokenType.IRLIKE: 'IRLIKE'>: <function binary_range_parser.<locals>._parse_binary_range>, <TokenType.IS: 'IS'>: <function Parser.<lambda>>, <TokenType.LIKE: 'LIKE'>: <function binary_range_parser.<locals>._parse_binary_range>, <TokenType.OVERLAPS: 'OVERLAPS'>: <function binary_range_parser.<locals>._parse_binary_range>, <TokenType.RLIKE: 'RLIKE'>: <function binary_range_parser.<locals>._parse_binary_range>, <TokenType.SIMILAR_TO: 'SIMILAR_TO'>: <function binary_range_parser.<locals>._parse_binary_range>, <TokenType.FOR: 'FOR'>: <function Parser.<lambda>>, <TokenType.GLOBAL: 'GLOBAL'>: <function ClickHouse.Parser.<lambda>>}
COLUMN_OPERATORS = {<TokenType.DOT: 'DOT'>: None, <TokenType.DCOLON: 'DCOLON'>: <function Parser.<lambda>>, <TokenType.ARROW: 'ARROW'>: <function Parser.<lambda>>, <TokenType.DARROW: 'DARROW'>: <function Parser.<lambda>>, <TokenType.HASH_ARROW: 'HASH_ARROW'>: <function Parser.<lambda>>, <TokenType.DHASH_ARROW: 'DHASH_ARROW'>: <function Parser.<lambda>>}
JOIN_KINDS = {<TokenType.ARRAY: 'ARRAY'>, <TokenType.SEMI: 'SEMI'>, <TokenType.CROSS: 'CROSS'>, <TokenType.INNER: 'INNER'>, <TokenType.STRAIGHT_JOIN: 'STRAIGHT_JOIN'>, <TokenType.ANTI: 'ANTI'>, <TokenType.ASOF: 'ASOF'>, <TokenType.OUTER: 'OUTER'>, <TokenType.ANY: 'ANY'>}
TABLE_ALIAS_TOKENS = {<TokenType.ROLLUP: 'ROLLUP'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.UINT128: 'UINT128'>, <TokenType.UNIQUE: 'UNIQUE'>, <TokenType.NESTED: 'NESTED'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.SOME: 'SOME'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.PROCEDURE: 'PROCEDURE'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.STORAGE_INTEGRATION: 'STORAGE_INTEGRATION'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.RENAME: 'RENAME'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.NAME: 'NAME'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.IS: 'IS'>, <TokenType.INET: 'INET'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.FIRST: 'FIRST'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.CASE: 'CASE'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.ROWS: 'ROWS'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.YEAR: 'YEAR'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.ALL: 'ALL'>, <TokenType.TABLE: 'TABLE'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.RANGE: 'RANGE'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.IPV6: 'IPV6'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.SHOW: 'SHOW'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.UINT: 'UINT'>, <TokenType.UNIQUEIDENTIFIER: 'UNIQUEIDENTIFIER'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.BIT: 'BIT'>, <TokenType.TIME: 'TIME'>, <TokenType.CUBE: 'CUBE'>, <TokenType.CHAR: 'CHAR'>, <TokenType.KILL: 'KILL'>, <TokenType.END: 'END'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.ASC: 'ASC'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.INT256: 'INT256'>, <TokenType.MERGE: 'MERGE'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.JSONB: 'JSONB'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.MODEL: 'MODEL'>, <TokenType.DATE: 'DATE'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.ENUM: 'ENUM'>, <TokenType.CACHE: 'CACHE'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.COPY: 'COPY'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.VAR: 'VAR'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.XML: 'XML'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.TEXT: 'TEXT'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.DATE32: 'DATE32'>, <TokenType.LOAD: 'LOAD'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.DELETE: 'DELETE'>, <TokenType.ROW: 'ROW'>, <TokenType.WAREHOUSE: 'WAREHOUSE'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.MAP: 'MAP'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.TAG: 'TAG'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.UINT256: 'UINT256'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.STRAIGHT_JOIN: 'STRAIGHT_JOIN'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.BINARY: 'BINARY'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.INDEX: 'INDEX'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.INT: 'INT'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.FILTER: 'FILTER'>, <TokenType.SET: 'SET'>, <TokenType.TRUE: 'TRUE'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.UUID: 'UUID'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.JSON: 'JSON'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.MONEY: 'MONEY'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.DESC: 'DESC'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.USE: 'USE'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.SUPER: 'SUPER'>, <TokenType.REFERENCES: 'REFERENCES'>, <TokenType.IPV4: 'IPV4'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.NEXT: 'NEXT'>, <TokenType.KEEP: 'KEEP'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.VIEW: 'VIEW'>, <TokenType.NULL: 'NULL'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.LIST: 'LIST'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.DIV: 'DIV'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.FALSE: 'FALSE'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.INT128: 'INT128'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.STREAMLIT: 'STREAMLIT'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.TOP: 'TOP'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.ORDINALITY: 'ORDINALITY'>}
ALIAS_TOKENS = {<TokenType.ROLLUP: 'ROLLUP'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.UINT128: 'UINT128'>, <TokenType.UNIQUE: 'UNIQUE'>, <TokenType.NESTED: 'NESTED'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.SOME: 'SOME'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.PROCEDURE: 'PROCEDURE'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.STORAGE_INTEGRATION: 'STORAGE_INTEGRATION'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.RENAME: 'RENAME'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.NAME: 'NAME'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.IS: 'IS'>, <TokenType.INET: 'INET'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.FIRST: 'FIRST'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.NATURAL: 'NATURAL'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.CASE: 'CASE'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.ROWS: 'ROWS'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.YEAR: 'YEAR'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.ANY: 'ANY'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.ALL: 'ALL'>, <TokenType.TABLE: 'TABLE'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.RANGE: 'RANGE'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.IPV6: 'IPV6'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.SHOW: 'SHOW'>, <TokenType.SETTINGS: 'SETTINGS'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.UINT: 'UINT'>, <TokenType.UNIQUEIDENTIFIER: 'UNIQUEIDENTIFIER'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.RIGHT: 'RIGHT'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.BIT: 'BIT'>, <TokenType.TIME: 'TIME'>, <TokenType.CUBE: 'CUBE'>, <TokenType.CHAR: 'CHAR'>, <TokenType.KILL: 'KILL'>, <TokenType.END: 'END'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.WINDOW: 'WINDOW'>, <TokenType.ASC: 'ASC'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.INT256: 'INT256'>, <TokenType.MERGE: 'MERGE'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.JSONB: 'JSONB'>, <TokenType.ANTI: 'ANTI'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.MODEL: 'MODEL'>, <TokenType.DATE: 'DATE'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.ENUM: 'ENUM'>, <TokenType.CACHE: 'CACHE'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.APPLY: 'APPLY'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.COPY: 'COPY'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.VAR: 'VAR'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.XML: 'XML'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.TEXT: 'TEXT'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.DATE32: 'DATE32'>, <TokenType.LOAD: 'LOAD'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.DELETE: 'DELETE'>, <TokenType.ROW: 'ROW'>, <TokenType.WAREHOUSE: 'WAREHOUSE'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.MAP: 'MAP'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.SEMI: 'SEMI'>, <TokenType.TAG: 'TAG'>, <TokenType.LEFT: 'LEFT'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.UINT256: 'UINT256'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.BINARY: 'BINARY'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.ASOF: 'ASOF'>, <TokenType.INDEX: 'INDEX'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.INT: 'INT'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.FILTER: 'FILTER'>, <TokenType.SET: 'SET'>, <TokenType.TRUE: 'TRUE'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.UUID: 'UUID'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.JSON: 'JSON'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.MONEY: 'MONEY'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.FULL: 'FULL'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.DESC: 'DESC'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.USE: 'USE'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.FINAL: 'FINAL'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.SUPER: 'SUPER'>, <TokenType.REFERENCES: 'REFERENCES'>, <TokenType.IPV4: 'IPV4'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.NEXT: 'NEXT'>, <TokenType.KEEP: 'KEEP'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.VIEW: 'VIEW'>, <TokenType.NULL: 'NULL'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.LIST: 'LIST'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.DIV: 'DIV'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.FALSE: 'FALSE'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.INT128: 'INT128'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.STREAMLIT: 'STREAMLIT'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.TOP: 'TOP'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.ORDINALITY: 'ORDINALITY'>}
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 = {'UNIQUE', 'PRIMARY KEY', 'PERIOD', 'EXCLUDE', 'CHECK', 'FOREIGN KEY', 'LIKE', '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
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):
 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.Variance: rename_func("varSamp"),
 880            exp.SchemaCommentProperty: lambda self, e: self.naked_property(e),
 881            exp.Stddev: rename_func("stddevSamp"),
 882        }
 883
 884        PROPERTIES_LOCATION = {
 885            **generator.Generator.PROPERTIES_LOCATION,
 886            exp.VolatileProperty: exp.Properties.Location.UNSUPPORTED,
 887            exp.PartitionedByProperty: exp.Properties.Location.POST_SCHEMA,
 888            exp.OnCluster: exp.Properties.Location.POST_NAME,
 889        }
 890
 891        # There's no list in docs, but it can be found in Clickhouse code
 892        # see `ClickHouse/src/Parsers/ParserCreate*.cpp`
 893        ON_CLUSTER_TARGETS = {
 894            "DATABASE",
 895            "TABLE",
 896            "VIEW",
 897            "DICTIONARY",
 898            "INDEX",
 899            "FUNCTION",
 900            "NAMED COLLECTION",
 901        }
 902
 903        # https://clickhouse.com/docs/en/sql-reference/data-types/nullable
 904        NON_NULLABLE_TYPES = {
 905            exp.DataType.Type.ARRAY,
 906            exp.DataType.Type.MAP,
 907            exp.DataType.Type.NULLABLE,
 908            exp.DataType.Type.STRUCT,
 909        }
 910
 911        def strtodate_sql(self, expression: exp.StrToDate) -> str:
 912            strtodate_sql = self.function_fallback_sql(expression)
 913
 914            if not isinstance(expression.parent, exp.Cast):
 915                # StrToDate returns DATEs in other dialects (eg. postgres), so
 916                # this branch aims to improve the transpilation to clickhouse
 917                return f"CAST({strtodate_sql} AS DATE)"
 918
 919            return strtodate_sql
 920
 921        def cast_sql(self, expression: exp.Cast, safe_prefix: t.Optional[str] = None) -> str:
 922            this = expression.this
 923
 924            if isinstance(this, exp.StrToDate) and expression.to == exp.DataType.build("datetime"):
 925                return self.sql(this)
 926
 927            return super().cast_sql(expression, safe_prefix=safe_prefix)
 928
 929        def trycast_sql(self, expression: exp.TryCast) -> str:
 930            dtype = expression.to
 931            if not dtype.is_type(*self.NON_NULLABLE_TYPES, check_nullable=True):
 932                # Casting x into Nullable(T) appears to behave similarly to TRY_CAST(x AS T)
 933                dtype.set("nullable", True)
 934
 935            return super().cast_sql(expression)
 936
 937        def _jsonpathsubscript_sql(self, expression: exp.JSONPathSubscript) -> str:
 938            this = self.json_path_part(expression.this)
 939            return str(int(this) + 1) if is_int(this) else this
 940
 941        def likeproperty_sql(self, expression: exp.LikeProperty) -> str:
 942            return f"AS {self.sql(expression, 'this')}"
 943
 944        def _any_to_has(
 945            self,
 946            expression: exp.EQ | exp.NEQ,
 947            default: t.Callable[[t.Any], str],
 948            prefix: str = "",
 949        ) -> str:
 950            if isinstance(expression.left, exp.Any):
 951                arr = expression.left
 952                this = expression.right
 953            elif isinstance(expression.right, exp.Any):
 954                arr = expression.right
 955                this = expression.left
 956            else:
 957                return default(expression)
 958
 959            return prefix + self.func("has", arr.this.unnest(), this)
 960
 961        def eq_sql(self, expression: exp.EQ) -> str:
 962            return self._any_to_has(expression, super().eq_sql)
 963
 964        def neq_sql(self, expression: exp.NEQ) -> str:
 965            return self._any_to_has(expression, super().neq_sql, "NOT ")
 966
 967        def regexpilike_sql(self, expression: exp.RegexpILike) -> str:
 968            # Manually add a flag to make the search case-insensitive
 969            regex = self.func("CONCAT", "'(?i)'", expression.expression)
 970            return self.func("match", expression.this, regex)
 971
 972        def datatype_sql(self, expression: exp.DataType) -> str:
 973            # String is the standard ClickHouse type, every other variant is just an alias.
 974            # Additionally, any supplied length parameter will be ignored.
 975            #
 976            # https://clickhouse.com/docs/en/sql-reference/data-types/string
 977            if expression.this in self.STRING_TYPE_MAPPING:
 978                dtype = "String"
 979            else:
 980                dtype = super().datatype_sql(expression)
 981
 982            # This section changes the type to `Nullable(...)` if the following conditions hold:
 983            # - It's marked as nullable - this ensures we won't wrap ClickHouse types with `Nullable`
 984            #   and change their semantics
 985            # - It's not the key type of a `Map`. This is because ClickHouse enforces the following
 986            #   constraint: "Type of Map key must be a type, that can be represented by integer or
 987            #   String or FixedString (possibly LowCardinality) or UUID or IPv6"
 988            # - It's not a composite type, e.g. `Nullable(Array(...))` is not a valid type
 989            parent = expression.parent
 990            if (
 991                expression.args.get("nullable") is not False
 992                and not (
 993                    isinstance(parent, exp.DataType)
 994                    and parent.is_type(exp.DataType.Type.MAP, check_nullable=True)
 995                    and expression.index in (None, 0)
 996                )
 997                and not expression.is_type(*self.NON_NULLABLE_TYPES, check_nullable=True)
 998            ):
 999                dtype = f"Nullable({dtype})"
1000
1001            return dtype
1002
1003        def cte_sql(self, expression: exp.CTE) -> str:
1004            if expression.args.get("scalar"):
1005                this = self.sql(expression, "this")
1006                alias = self.sql(expression, "alias")
1007                return f"{this} AS {alias}"
1008
1009            return super().cte_sql(expression)
1010
1011        def after_limit_modifiers(self, expression: exp.Expression) -> t.List[str]:
1012            return super().after_limit_modifiers(expression) + [
1013                (
1014                    self.seg("SETTINGS ") + self.expressions(expression, key="settings", flat=True)
1015                    if expression.args.get("settings")
1016                    else ""
1017                ),
1018                (
1019                    self.seg("FORMAT ") + self.sql(expression, "format")
1020                    if expression.args.get("format")
1021                    else ""
1022                ),
1023            ]
1024
1025        def parameterizedagg_sql(self, expression: exp.ParameterizedAgg) -> str:
1026            params = self.expressions(expression, key="params", flat=True)
1027            return self.func(expression.name, *expression.expressions) + f"({params})"
1028
1029        def anonymousaggfunc_sql(self, expression: exp.AnonymousAggFunc) -> str:
1030            return self.func(expression.name, *expression.expressions)
1031
1032        def combinedaggfunc_sql(self, expression: exp.CombinedAggFunc) -> str:
1033            return self.anonymousaggfunc_sql(expression)
1034
1035        def combinedparameterizedagg_sql(self, expression: exp.CombinedParameterizedAgg) -> str:
1036            return self.parameterizedagg_sql(expression)
1037
1038        def placeholder_sql(self, expression: exp.Placeholder) -> str:
1039            return f"{{{expression.name}: {self.sql(expression, 'kind')}}}"
1040
1041        def oncluster_sql(self, expression: exp.OnCluster) -> str:
1042            return f"ON CLUSTER {self.sql(expression, 'this')}"
1043
1044        def createable_sql(self, expression: exp.Create, locations: t.DefaultDict) -> str:
1045            if expression.kind in self.ON_CLUSTER_TARGETS and locations.get(
1046                exp.Properties.Location.POST_NAME
1047            ):
1048                this_name = self.sql(
1049                    expression.this if isinstance(expression.this, exp.Schema) else expression,
1050                    "this",
1051                )
1052                this_properties = " ".join(
1053                    [self.sql(prop) for prop in locations[exp.Properties.Location.POST_NAME]]
1054                )
1055                this_schema = self.schema_columns_sql(expression.this)
1056                return f"{this_name}{self.sep()}{this_properties}{self.sep()}{this_schema}"
1057
1058            return super().createable_sql(expression, locations)
1059
1060        def create_sql(self, expression: exp.Create) -> str:
1061            # The comment property comes last in CTAS statements, i.e. after the query
1062            query = expression.expression
1063            if isinstance(query, exp.Query):
1064                comment_prop = expression.find(exp.SchemaCommentProperty)
1065                if comment_prop:
1066                    comment_prop.pop()
1067                    query.replace(exp.paren(query))
1068            else:
1069                comment_prop = None
1070
1071            create_sql = super().create_sql(expression)
1072
1073            comment_sql = self.sql(comment_prop)
1074            comment_sql = f" {comment_sql}" if comment_sql else ""
1075
1076            return f"{create_sql}{comment_sql}"
1077
1078        def prewhere_sql(self, expression: exp.PreWhere) -> str:
1079            this = self.indent(self.sql(expression, "this"))
1080            return f"{self.seg('PREWHERE')}{self.sep()}{this}"
1081
1082        def indexcolumnconstraint_sql(self, expression: exp.IndexColumnConstraint) -> str:
1083            this = self.sql(expression, "this")
1084            this = f" {this}" if this else ""
1085            expr = self.sql(expression, "expression")
1086            expr = f" {expr}" if expr else ""
1087            index_type = self.sql(expression, "index_type")
1088            index_type = f" TYPE {index_type}" if index_type else ""
1089            granularity = self.sql(expression, "granularity")
1090            granularity = f" GRANULARITY {granularity}" if granularity else ""
1091
1092            return f"INDEX{this}{expr}{index_type}{granularity}"
1093
1094        def partition_sql(self, expression: exp.Partition) -> str:
1095            return f"PARTITION {self.expressions(expression, flat=True)}"
1096
1097        def partitionid_sql(self, expression: exp.PartitionId) -> str:
1098            return f"ID {self.sql(expression.this)}"
1099
1100        def replacepartition_sql(self, expression: exp.ReplacePartition) -> str:
1101            return (
1102                f"REPLACE {self.sql(expression.expression)} FROM {self.sql(expression, 'source')}"
1103            )
1104
1105        def projectiondef_sql(self, expression: exp.ProjectionDef) -> str:
1106            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.Variance'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.SchemaCommentProperty'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.Stddev'>: <function rename_func.<locals>.<lambda>>}
PROPERTIES_LOCATION = {<class 'sqlglot.expressions.AllowedValuesProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.AlgorithmProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.AutoIncrementProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.AutoRefreshProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.BackupProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.BlockCompressionProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.CharacterSetProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ChecksumProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.CollateProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.CopyGrantsProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.Cluster'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ClusteredByProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DataBlocksizeProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.DataDeletionProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DefinerProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.DictRange'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DictProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DynamicProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.DistKeyProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DistStyleProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.EmptyProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.EngineProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ExecuteAsProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ExternalProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.FallbackProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.FileFormatProperty'>: <Location.POST_WITH: 'POST_WITH'>, <class 'sqlglot.expressions.FreespaceProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.GlobalProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.HeapProperty'>: <Location.POST_WITH: 'POST_WITH'>, <class 'sqlglot.expressions.InheritsProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.IcebergProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.InputModelProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.IsolatedLoadingProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.JournalProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.LanguageProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.LikeProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.LocationProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.LockProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.LockingProperty'>: <Location.POST_ALIAS: 'POST_ALIAS'>, <class 'sqlglot.expressions.LogProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.MaterializedProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.MergeBlockRatioProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.NoPrimaryIndexProperty'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.OnProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.OnCommitProperty'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.Order'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.OutputModelProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.PartitionedByProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.PartitionedOfProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.PrimaryKey'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.Property'>: <Location.POST_WITH: 'POST_WITH'>, <class 'sqlglot.expressions.RemoteWithConnectionModelProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ReturnsProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.RowFormatProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.RowFormatDelimitedProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.RowFormatSerdeProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SampleProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SchemaCommentProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SecureProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.SerdeProperties'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.Set'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SettingsProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SetProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.SetConfigProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SharingProperty'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.SequenceProperties'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.SortKeyProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SqlReadWriteProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SqlSecurityProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.StabilityProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.StreamingTableProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.StrictProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.TemporaryProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.ToTableProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.TransientProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.TransformModelProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.MergeTreeTTL'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.UnloggedProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.ViewAttributeProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.VolatileProperty'>: <Location.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.WithDataProperty'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.WithJournalTableProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.WithSchemaBindingProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.WithSystemVersioningProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.OnCluster'>: <Location.POST_NAME: 'POST_NAME'>}
ON_CLUSTER_TARGETS = {'DATABASE', 'TABLE', 'NAMED COLLECTION', 'DICTIONARY', 'VIEW', 'FUNCTION', 'INDEX'}
NON_NULLABLE_TYPES = {<Type.ARRAY: 'ARRAY'>, <Type.NULLABLE: 'NULLABLE'>, <Type.STRUCT: 'STRUCT'>, <Type.MAP: 'MAP'>}
def strtodate_sql(self, expression: sqlglot.expressions.StrToDate) -> str:
911        def strtodate_sql(self, expression: exp.StrToDate) -> str:
912            strtodate_sql = self.function_fallback_sql(expression)
913
914            if not isinstance(expression.parent, exp.Cast):
915                # StrToDate returns DATEs in other dialects (eg. postgres), so
916                # this branch aims to improve the transpilation to clickhouse
917                return f"CAST({strtodate_sql} AS DATE)"
918
919            return strtodate_sql
def cast_sql( self, expression: sqlglot.expressions.Cast, safe_prefix: Optional[str] = None) -> str:
921        def cast_sql(self, expression: exp.Cast, safe_prefix: t.Optional[str] = None) -> str:
922            this = expression.this
923
924            if isinstance(this, exp.StrToDate) and expression.to == exp.DataType.build("datetime"):
925                return self.sql(this)
926
927            return super().cast_sql(expression, safe_prefix=safe_prefix)
def trycast_sql(self, expression: sqlglot.expressions.TryCast) -> str:
929        def trycast_sql(self, expression: exp.TryCast) -> str:
930            dtype = expression.to
931            if not dtype.is_type(*self.NON_NULLABLE_TYPES, check_nullable=True):
932                # Casting x into Nullable(T) appears to behave similarly to TRY_CAST(x AS T)
933                dtype.set("nullable", True)
934
935            return super().cast_sql(expression)
def likeproperty_sql(self, expression: sqlglot.expressions.LikeProperty) -> str:
941        def likeproperty_sql(self, expression: exp.LikeProperty) -> str:
942            return f"AS {self.sql(expression, 'this')}"
def eq_sql(self, expression: sqlglot.expressions.EQ) -> str:
961        def eq_sql(self, expression: exp.EQ) -> str:
962            return self._any_to_has(expression, super().eq_sql)
def neq_sql(self, expression: sqlglot.expressions.NEQ) -> str:
964        def neq_sql(self, expression: exp.NEQ) -> str:
965            return self._any_to_has(expression, super().neq_sql, "NOT ")
def regexpilike_sql(self, expression: sqlglot.expressions.RegexpILike) -> str:
967        def regexpilike_sql(self, expression: exp.RegexpILike) -> str:
968            # Manually add a flag to make the search case-insensitive
969            regex = self.func("CONCAT", "'(?i)'", expression.expression)
970            return self.func("match", expression.this, regex)
def datatype_sql(self, expression: sqlglot.expressions.DataType) -> str:
 972        def datatype_sql(self, expression: exp.DataType) -> str:
 973            # String is the standard ClickHouse type, every other variant is just an alias.
 974            # Additionally, any supplied length parameter will be ignored.
 975            #
 976            # https://clickhouse.com/docs/en/sql-reference/data-types/string
 977            if expression.this in self.STRING_TYPE_MAPPING:
 978                dtype = "String"
 979            else:
 980                dtype = super().datatype_sql(expression)
 981
 982            # This section changes the type to `Nullable(...)` if the following conditions hold:
 983            # - It's marked as nullable - this ensures we won't wrap ClickHouse types with `Nullable`
 984            #   and change their semantics
 985            # - It's not the key type of a `Map`. This is because ClickHouse enforces the following
 986            #   constraint: "Type of Map key must be a type, that can be represented by integer or
 987            #   String or FixedString (possibly LowCardinality) or UUID or IPv6"
 988            # - It's not a composite type, e.g. `Nullable(Array(...))` is not a valid type
 989            parent = expression.parent
 990            if (
 991                expression.args.get("nullable") is not False
 992                and not (
 993                    isinstance(parent, exp.DataType)
 994                    and parent.is_type(exp.DataType.Type.MAP, check_nullable=True)
 995                    and expression.index in (None, 0)
 996                )
 997                and not expression.is_type(*self.NON_NULLABLE_TYPES, check_nullable=True)
 998            ):
 999                dtype = f"Nullable({dtype})"
1000
1001            return dtype
def cte_sql(self, expression: sqlglot.expressions.CTE) -> str:
1003        def cte_sql(self, expression: exp.CTE) -> str:
1004            if expression.args.get("scalar"):
1005                this = self.sql(expression, "this")
1006                alias = self.sql(expression, "alias")
1007                return f"{this} AS {alias}"
1008
1009            return super().cte_sql(expression)
def after_limit_modifiers(self, expression: sqlglot.expressions.Expression) -> List[str]:
1011        def after_limit_modifiers(self, expression: exp.Expression) -> t.List[str]:
1012            return super().after_limit_modifiers(expression) + [
1013                (
1014                    self.seg("SETTINGS ") + self.expressions(expression, key="settings", flat=True)
1015                    if expression.args.get("settings")
1016                    else ""
1017                ),
1018                (
1019                    self.seg("FORMAT ") + self.sql(expression, "format")
1020                    if expression.args.get("format")
1021                    else ""
1022                ),
1023            ]
def parameterizedagg_sql(self, expression: sqlglot.expressions.ParameterizedAgg) -> str:
1025        def parameterizedagg_sql(self, expression: exp.ParameterizedAgg) -> str:
1026            params = self.expressions(expression, key="params", flat=True)
1027            return self.func(expression.name, *expression.expressions) + f"({params})"
def anonymousaggfunc_sql(self, expression: sqlglot.expressions.AnonymousAggFunc) -> str:
1029        def anonymousaggfunc_sql(self, expression: exp.AnonymousAggFunc) -> str:
1030            return self.func(expression.name, *expression.expressions)
def combinedaggfunc_sql(self, expression: sqlglot.expressions.CombinedAggFunc) -> str:
1032        def combinedaggfunc_sql(self, expression: exp.CombinedAggFunc) -> str:
1033            return self.anonymousaggfunc_sql(expression)
def combinedparameterizedagg_sql(self, expression: sqlglot.expressions.CombinedParameterizedAgg) -> str:
1035        def combinedparameterizedagg_sql(self, expression: exp.CombinedParameterizedAgg) -> str:
1036            return self.parameterizedagg_sql(expression)
def placeholder_sql(self, expression: sqlglot.expressions.Placeholder) -> str:
1038        def placeholder_sql(self, expression: exp.Placeholder) -> str:
1039            return f"{{{expression.name}: {self.sql(expression, 'kind')}}}"
def oncluster_sql(self, expression: sqlglot.expressions.OnCluster) -> str:
1041        def oncluster_sql(self, expression: exp.OnCluster) -> str:
1042            return f"ON CLUSTER {self.sql(expression, 'this')}"
def createable_sql( self, expression: sqlglot.expressions.Create, locations: DefaultDict) -> str:
1044        def createable_sql(self, expression: exp.Create, locations: t.DefaultDict) -> str:
1045            if expression.kind in self.ON_CLUSTER_TARGETS and locations.get(
1046                exp.Properties.Location.POST_NAME
1047            ):
1048                this_name = self.sql(
1049                    expression.this if isinstance(expression.this, exp.Schema) else expression,
1050                    "this",
1051                )
1052                this_properties = " ".join(
1053                    [self.sql(prop) for prop in locations[exp.Properties.Location.POST_NAME]]
1054                )
1055                this_schema = self.schema_columns_sql(expression.this)
1056                return f"{this_name}{self.sep()}{this_properties}{self.sep()}{this_schema}"
1057
1058            return super().createable_sql(expression, locations)
def create_sql(self, expression: sqlglot.expressions.Create) -> str:
1060        def create_sql(self, expression: exp.Create) -> str:
1061            # The comment property comes last in CTAS statements, i.e. after the query
1062            query = expression.expression
1063            if isinstance(query, exp.Query):
1064                comment_prop = expression.find(exp.SchemaCommentProperty)
1065                if comment_prop:
1066                    comment_prop.pop()
1067                    query.replace(exp.paren(query))
1068            else:
1069                comment_prop = None
1070
1071            create_sql = super().create_sql(expression)
1072
1073            comment_sql = self.sql(comment_prop)
1074            comment_sql = f" {comment_sql}" if comment_sql else ""
1075
1076            return f"{create_sql}{comment_sql}"
def prewhere_sql(self, expression: sqlglot.expressions.PreWhere) -> str:
1078        def prewhere_sql(self, expression: exp.PreWhere) -> str:
1079            this = self.indent(self.sql(expression, "this"))
1080            return f"{self.seg('PREWHERE')}{self.sep()}{this}"
def indexcolumnconstraint_sql(self, expression: sqlglot.expressions.IndexColumnConstraint) -> str:
1082        def indexcolumnconstraint_sql(self, expression: exp.IndexColumnConstraint) -> str:
1083            this = self.sql(expression, "this")
1084            this = f" {this}" if this else ""
1085            expr = self.sql(expression, "expression")
1086            expr = f" {expr}" if expr else ""
1087            index_type = self.sql(expression, "index_type")
1088            index_type = f" TYPE {index_type}" if index_type else ""
1089            granularity = self.sql(expression, "granularity")
1090            granularity = f" GRANULARITY {granularity}" if granularity else ""
1091
1092            return f"INDEX{this}{expr}{index_type}{granularity}"
def partition_sql(self, expression: sqlglot.expressions.Partition) -> str:
1094        def partition_sql(self, expression: exp.Partition) -> str:
1095            return f"PARTITION {self.expressions(expression, flat=True)}"
def partitionid_sql(self, expression: sqlglot.expressions.PartitionId) -> str:
1097        def partitionid_sql(self, expression: exp.PartitionId) -> str:
1098            return f"ID {self.sql(expression.this)}"
def replacepartition_sql(self, expression: sqlglot.expressions.ReplacePartition) -> str:
1100        def replacepartition_sql(self, expression: exp.ReplacePartition) -> str:
1101            return (
1102                f"REPLACE {self.sql(expression.expression)} FROM {self.sql(expression, 'source')}"
1103            )
def projectiondef_sql(self, expression: sqlglot.expressions.ProjectionDef) -> str:
1105        def projectiondef_sql(self, expression: exp.ProjectionDef) -> str:
1106            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
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