Edit on GitHub

sqlglot.dialects.clickhouse

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

SET_OP_DISTINCT_BY_DEFAULT: Dict[Type[sqlglot.expressions.Expression], Optional[bool]] = {<class 'sqlglot.expressions.Except'>: False, <class 'sqlglot.expressions.Intersect'>: False, <class 'sqlglot.expressions.Union'>: None}

Whether a set operation uses DISTINCT by default. This is None when either DISTINCT or ALL must be explicitly specified.

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