Edit on GitHub

sqlglot.dialects.clickhouse

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

Determines how function names are going to be normalized.

Possible values:

"upper" or True: Convert names to uppercase. "lower": Convert names to lowercase. False: Disables function name normalization.

NULL_ORDERING = 'nulls_are_last'

Default NULL ordering method to use if not explicitly set. Possible values: "nulls_are_small", "nulls_are_large", "nulls_are_last"

SUPPORTS_USER_DEFINED_TYPES = False

Whether user-defined data types are supported.

SAFE_DIVISION = True

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

LOG_BASE_FIRST: Optional[bool] = None

Whether the base comes first in the LOG function. Possible values: True, False, None (two arguments are not supported by LOG)

FORCE_EARLY_ALIAS_REF_EXPANSION = True

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

For example:

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

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

NORMALIZATION_STRATEGY = <NormalizationStrategy.CASE_SENSITIVE: 'CASE_SENSITIVE'>

Specifies the strategy according to which identifiers should be normalized.

UNESCAPED_SEQUENCES = {'\\a': '\x07', '\\b': '\x08', '\\f': '\x0c', '\\n': '\n', '\\r': '\r', '\\t': '\t', '\\v': '\x0b', '\\\\': '\\', '\\0': '\x00'}

Mapping of an escaped sequence (\n) to its unescaped version ( ).

SUPPORTS_COLUMN_JOIN_MARKS = False

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

tokenizer_class = <class 'ClickHouse.Tokenizer'>
jsonpath_tokenizer_class = <class 'sqlglot.tokens.JSONPathTokenizer'>
parser_class = <class 'ClickHouse.Parser'>
generator_class = <class 'ClickHouse.Generator'>
TIME_TRIE: Dict = {}
FORMAT_TRIE: Dict = {}
INVERSE_TIME_MAPPING: Dict[str, str] = {}
INVERSE_TIME_TRIE: Dict = {}
INVERSE_FORMAT_MAPPING: Dict[str, str] = {}
INVERSE_FORMAT_TRIE: Dict = {}
ESCAPED_SEQUENCES: Dict[str, str] = {'\x07': '\\a', '\x08': '\\b', '\x0c': '\\f', '\n': '\\n', '\r': '\\r', '\t': '\\t', '\x0b': '\\v', '\\': '\\\\', '\x00': '\\0'}
QUOTE_START = "'"
QUOTE_END = "'"
IDENTIFIER_START = '"'
IDENTIFIER_END = '"'
BIT_START: Optional[str] = '0b'
BIT_END: Optional[str] = ''
HEX_START: Optional[str] = '0x'
HEX_END: Optional[str] = ''
BYTE_START: Optional[str] = None
BYTE_END: Optional[str] = None
UNICODE_START: Optional[str] = None
UNICODE_END: Optional[str] = None
class ClickHouse.Tokenizer(sqlglot.tokens.Tokenizer):
124    class Tokenizer(tokens.Tokenizer):
125        COMMENTS = ["--", "#", "#!", ("/*", "*/")]
126        IDENTIFIERS = ['"', "`"]
127        STRING_ESCAPES = ["'", "\\"]
128        BIT_STRINGS = [("0b", "")]
129        HEX_STRINGS = [("0x", ""), ("0X", "")]
130        HEREDOC_STRINGS = ["$"]
131
132        KEYWORDS = {
133            **tokens.Tokenizer.KEYWORDS,
134            "ATTACH": TokenType.COMMAND,
135            "DATE32": TokenType.DATE32,
136            "DATETIME64": TokenType.DATETIME64,
137            "DICTIONARY": TokenType.DICTIONARY,
138            "ENUM8": TokenType.ENUM8,
139            "ENUM16": TokenType.ENUM16,
140            "FINAL": TokenType.FINAL,
141            "FIXEDSTRING": TokenType.FIXEDSTRING,
142            "FLOAT32": TokenType.FLOAT,
143            "FLOAT64": TokenType.DOUBLE,
144            "GLOBAL": TokenType.GLOBAL,
145            "INT256": TokenType.INT256,
146            "LOWCARDINALITY": TokenType.LOWCARDINALITY,
147            "MAP": TokenType.MAP,
148            "NESTED": TokenType.NESTED,
149            "SAMPLE": TokenType.TABLE_SAMPLE,
150            "TUPLE": TokenType.STRUCT,
151            "UINT128": TokenType.UINT128,
152            "UINT16": TokenType.USMALLINT,
153            "UINT256": TokenType.UINT256,
154            "UINT32": TokenType.UINT,
155            "UINT64": TokenType.UBIGINT,
156            "UINT8": TokenType.UTINYINT,
157            "IPV4": TokenType.IPV4,
158            "IPV6": TokenType.IPV6,
159            "AGGREGATEFUNCTION": TokenType.AGGREGATEFUNCTION,
160            "SIMPLEAGGREGATEFUNCTION": TokenType.SIMPLEAGGREGATEFUNCTION,
161            "SYSTEM": TokenType.COMMAND,
162            "PREWHERE": TokenType.PREWHERE,
163        }
164        KEYWORDS.pop("/*+")
165
166        SINGLE_TOKENS = {
167            **tokens.Tokenizer.SINGLE_TOKENS,
168            "$": TokenType.HEREDOC_STRING,
169        }
COMMENTS = ['--', '#', '#!', ('/*', '*/')]
IDENTIFIERS = ['"', '`']
STRING_ESCAPES = ["'", '\\']
BIT_STRINGS = [('0b', '')]
HEX_STRINGS = [('0x', ''), ('0X', '')]
HEREDOC_STRINGS = ['$']
KEYWORDS = {'{%': <TokenType.BLOCK_START: 'BLOCK_START'>, '{%+': <TokenType.BLOCK_START: 'BLOCK_START'>, '{%-': <TokenType.BLOCK_START: 'BLOCK_START'>, '%}': <TokenType.BLOCK_END: 'BLOCK_END'>, '+%}': <TokenType.BLOCK_END: 'BLOCK_END'>, '-%}': <TokenType.BLOCK_END: 'BLOCK_END'>, '{{+': <TokenType.BLOCK_START: 'BLOCK_START'>, '{{-': <TokenType.BLOCK_START: 'BLOCK_START'>, '+}}': <TokenType.BLOCK_END: 'BLOCK_END'>, '-}}': <TokenType.BLOCK_END: 'BLOCK_END'>, '==': <TokenType.EQ: 'EQ'>, '::': <TokenType.DCOLON: 'DCOLON'>, '||': <TokenType.DPIPE: 'DPIPE'>, '>=': <TokenType.GTE: 'GTE'>, '<=': <TokenType.LTE: 'LTE'>, '<>': <TokenType.NEQ: 'NEQ'>, '!=': <TokenType.NEQ: 'NEQ'>, ':=': <TokenType.COLON_EQ: 'COLON_EQ'>, '<=>': <TokenType.NULLSAFE_EQ: 'NULLSAFE_EQ'>, '->': <TokenType.ARROW: 'ARROW'>, '->>': <TokenType.DARROW: 'DARROW'>, '=>': <TokenType.FARROW: 'FARROW'>, '#>': <TokenType.HASH_ARROW: 'HASH_ARROW'>, '#>>': <TokenType.DHASH_ARROW: 'DHASH_ARROW'>, '<->': <TokenType.LR_ARROW: 'LR_ARROW'>, '&&': <TokenType.DAMP: 'DAMP'>, '??': <TokenType.DQMARK: 'DQMARK'>, 'ALL': <TokenType.ALL: 'ALL'>, 'ALWAYS': <TokenType.ALWAYS: 'ALWAYS'>, 'AND': <TokenType.AND: 'AND'>, 'ANTI': <TokenType.ANTI: 'ANTI'>, 'ANY': <TokenType.ANY: 'ANY'>, 'ASC': <TokenType.ASC: 'ASC'>, 'AS': <TokenType.ALIAS: 'ALIAS'>, 'ASOF': <TokenType.ASOF: 'ASOF'>, 'AUTOINCREMENT': <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, 'AUTO_INCREMENT': <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, 'BEGIN': <TokenType.BEGIN: 'BEGIN'>, 'BETWEEN': <TokenType.BETWEEN: 'BETWEEN'>, 'CACHE': <TokenType.CACHE: 'CACHE'>, 'UNCACHE': <TokenType.UNCACHE: 'UNCACHE'>, 'CASE': <TokenType.CASE: 'CASE'>, 'CHARACTER SET': <TokenType.CHARACTER_SET: 'CHARACTER_SET'>, 'CLUSTER BY': <TokenType.CLUSTER_BY: 'CLUSTER_BY'>, 'COLLATE': <TokenType.COLLATE: 'COLLATE'>, 'COLUMN': <TokenType.COLUMN: 'COLUMN'>, 'COMMIT': <TokenType.COMMIT: 'COMMIT'>, 'CONNECT BY': <TokenType.CONNECT_BY: 'CONNECT_BY'>, 'CONSTRAINT': <TokenType.CONSTRAINT: 'CONSTRAINT'>, 'COPY': <TokenType.COPY: 'COPY'>, 'CREATE': <TokenType.CREATE: 'CREATE'>, 'CROSS': <TokenType.CROSS: 'CROSS'>, 'CUBE': <TokenType.CUBE: 'CUBE'>, 'CURRENT_DATE': <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, 'CURRENT_TIME': <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, 'CURRENT_TIMESTAMP': <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, 'CURRENT_USER': <TokenType.CURRENT_USER: 'CURRENT_USER'>, 'DATABASE': <TokenType.DATABASE: 'DATABASE'>, 'DEFAULT': <TokenType.DEFAULT: 'DEFAULT'>, 'DELETE': <TokenType.DELETE: 'DELETE'>, 'DESC': <TokenType.DESC: 'DESC'>, 'DESCRIBE': <TokenType.DESCRIBE: 'DESCRIBE'>, 'DISTINCT': <TokenType.DISTINCT: 'DISTINCT'>, 'DISTRIBUTE BY': <TokenType.DISTRIBUTE_BY: 'DISTRIBUTE_BY'>, 'DIV': <TokenType.DIV: 'DIV'>, 'DROP': <TokenType.DROP: 'DROP'>, 'ELSE': <TokenType.ELSE: 'ELSE'>, 'END': <TokenType.END: 'END'>, 'ENUM': <TokenType.ENUM: 'ENUM'>, 'ESCAPE': <TokenType.ESCAPE: 'ESCAPE'>, 'EXCEPT': <TokenType.EXCEPT: 'EXCEPT'>, 'EXECUTE': <TokenType.EXECUTE: 'EXECUTE'>, 'EXISTS': <TokenType.EXISTS: 'EXISTS'>, 'FALSE': <TokenType.FALSE: 'FALSE'>, 'FETCH': <TokenType.FETCH: 'FETCH'>, 'FILTER': <TokenType.FILTER: 'FILTER'>, 'FIRST': <TokenType.FIRST: 'FIRST'>, 'FULL': <TokenType.FULL: 'FULL'>, 'FUNCTION': <TokenType.FUNCTION: 'FUNCTION'>, 'FOR': <TokenType.FOR: 'FOR'>, 'FOREIGN KEY': <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, 'FORMAT': <TokenType.FORMAT: 'FORMAT'>, 'FROM': <TokenType.FROM: 'FROM'>, 'GEOGRAPHY': <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, 'GEOMETRY': <TokenType.GEOMETRY: 'GEOMETRY'>, 'GLOB': <TokenType.GLOB: 'GLOB'>, 'GROUP BY': <TokenType.GROUP_BY: 'GROUP_BY'>, 'GROUPING SETS': <TokenType.GROUPING_SETS: 'GROUPING_SETS'>, 'HAVING': <TokenType.HAVING: 'HAVING'>, 'ILIKE': <TokenType.ILIKE: 'ILIKE'>, 'IN': <TokenType.IN: 'IN'>, 'INDEX': <TokenType.INDEX: 'INDEX'>, 'INET': <TokenType.INET: 'INET'>, 'INNER': <TokenType.INNER: 'INNER'>, 'INSERT': <TokenType.INSERT: 'INSERT'>, 'INTERVAL': <TokenType.INTERVAL: 'INTERVAL'>, 'INTERSECT': <TokenType.INTERSECT: 'INTERSECT'>, 'INTO': <TokenType.INTO: 'INTO'>, 'IS': <TokenType.IS: 'IS'>, 'ISNULL': <TokenType.ISNULL: 'ISNULL'>, 'JOIN': <TokenType.JOIN: 'JOIN'>, 'KEEP': <TokenType.KEEP: 'KEEP'>, 'KILL': <TokenType.KILL: 'KILL'>, 'LATERAL': <TokenType.LATERAL: 'LATERAL'>, 'LEFT': <TokenType.LEFT: 'LEFT'>, 'LIKE': <TokenType.LIKE: 'LIKE'>, 'LIMIT': <TokenType.LIMIT: 'LIMIT'>, 'LOAD': <TokenType.LOAD: 'LOAD'>, 'LOCK': <TokenType.LOCK: 'LOCK'>, 'MERGE': <TokenType.MERGE: 'MERGE'>, 'NATURAL': <TokenType.NATURAL: 'NATURAL'>, 'NEXT': <TokenType.NEXT: 'NEXT'>, 'NOT': <TokenType.NOT: 'NOT'>, 'NOTNULL': <TokenType.NOTNULL: 'NOTNULL'>, 'NULL': <TokenType.NULL: 'NULL'>, 'OBJECT': <TokenType.OBJECT: 'OBJECT'>, 'OFFSET': <TokenType.OFFSET: 'OFFSET'>, 'ON': <TokenType.ON: 'ON'>, 'OR': <TokenType.OR: 'OR'>, 'XOR': <TokenType.XOR: 'XOR'>, 'ORDER BY': <TokenType.ORDER_BY: 'ORDER_BY'>, 'ORDINALITY': <TokenType.ORDINALITY: 'ORDINALITY'>, 'OUTER': <TokenType.OUTER: 'OUTER'>, 'OVER': <TokenType.OVER: 'OVER'>, 'OVERLAPS': <TokenType.OVERLAPS: 'OVERLAPS'>, 'OVERWRITE': <TokenType.OVERWRITE: 'OVERWRITE'>, 'PARTITION': <TokenType.PARTITION: 'PARTITION'>, 'PARTITION BY': <TokenType.PARTITION_BY: 'PARTITION_BY'>, 'PARTITIONED BY': <TokenType.PARTITION_BY: 'PARTITION_BY'>, 'PARTITIONED_BY': <TokenType.PARTITION_BY: 'PARTITION_BY'>, 'PERCENT': <TokenType.PERCENT: 'PERCENT'>, 'PIVOT': <TokenType.PIVOT: 'PIVOT'>, 'PRAGMA': <TokenType.PRAGMA: 'PRAGMA'>, 'PRIMARY KEY': <TokenType.PRIMARY_KEY: 'PRIMARY_KEY'>, 'PROCEDURE': <TokenType.PROCEDURE: 'PROCEDURE'>, 'QUALIFY': <TokenType.QUALIFY: 'QUALIFY'>, 'RANGE': <TokenType.RANGE: 'RANGE'>, 'RECURSIVE': <TokenType.RECURSIVE: 'RECURSIVE'>, 'REGEXP': <TokenType.RLIKE: 'RLIKE'>, 'RENAME': <TokenType.RENAME: 'RENAME'>, 'REPLACE': <TokenType.REPLACE: 'REPLACE'>, 'RETURNING': <TokenType.RETURNING: 'RETURNING'>, 'REFERENCES': <TokenType.REFERENCES: 'REFERENCES'>, 'RIGHT': <TokenType.RIGHT: 'RIGHT'>, 'RLIKE': <TokenType.RLIKE: 'RLIKE'>, 'ROLLBACK': <TokenType.ROLLBACK: 'ROLLBACK'>, 'ROLLUP': <TokenType.ROLLUP: 'ROLLUP'>, 'ROW': <TokenType.ROW: 'ROW'>, 'ROWS': <TokenType.ROWS: 'ROWS'>, 'SCHEMA': <TokenType.SCHEMA: 'SCHEMA'>, 'SELECT': <TokenType.SELECT: 'SELECT'>, 'SEMI': <TokenType.SEMI: 'SEMI'>, 'SET': <TokenType.SET: 'SET'>, 'SETTINGS': <TokenType.SETTINGS: 'SETTINGS'>, 'SHOW': <TokenType.SHOW: 'SHOW'>, 'SIMILAR TO': <TokenType.SIMILAR_TO: 'SIMILAR_TO'>, 'SOME': <TokenType.SOME: 'SOME'>, 'SORT BY': <TokenType.SORT_BY: 'SORT_BY'>, 'START WITH': <TokenType.START_WITH: 'START_WITH'>, 'STRAIGHT_JOIN': <TokenType.STRAIGHT_JOIN: 'STRAIGHT_JOIN'>, 'TABLE': <TokenType.TABLE: 'TABLE'>, 'TABLESAMPLE': <TokenType.TABLE_SAMPLE: 'TABLE_SAMPLE'>, 'TEMP': <TokenType.TEMPORARY: 'TEMPORARY'>, 'TEMPORARY': <TokenType.TEMPORARY: 'TEMPORARY'>, 'THEN': <TokenType.THEN: 'THEN'>, 'TRUE': <TokenType.TRUE: 'TRUE'>, 'TRUNCATE': <TokenType.TRUNCATE: 'TRUNCATE'>, 'UNION': <TokenType.UNION: 'UNION'>, 'UNKNOWN': <TokenType.UNKNOWN: 'UNKNOWN'>, 'UNNEST': <TokenType.UNNEST: 'UNNEST'>, 'UNPIVOT': <TokenType.UNPIVOT: 'UNPIVOT'>, 'UPDATE': <TokenType.UPDATE: 'UPDATE'>, 'USE': <TokenType.USE: 'USE'>, 'USING': <TokenType.USING: 'USING'>, 'UUID': <TokenType.UUID: 'UUID'>, 'VALUES': <TokenType.VALUES: 'VALUES'>, 'VIEW': <TokenType.VIEW: 'VIEW'>, 'VOLATILE': <TokenType.VOLATILE: 'VOLATILE'>, 'WHEN': <TokenType.WHEN: 'WHEN'>, 'WHERE': <TokenType.WHERE: 'WHERE'>, 'WINDOW': <TokenType.WINDOW: 'WINDOW'>, 'WITH': <TokenType.WITH: 'WITH'>, 'APPLY': <TokenType.APPLY: 'APPLY'>, 'ARRAY': <TokenType.ARRAY: 'ARRAY'>, 'BIT': <TokenType.BIT: 'BIT'>, 'BOOL': <TokenType.BOOLEAN: 'BOOLEAN'>, 'BOOLEAN': <TokenType.BOOLEAN: 'BOOLEAN'>, 'BYTE': <TokenType.TINYINT: 'TINYINT'>, 'MEDIUMINT': <TokenType.MEDIUMINT: 'MEDIUMINT'>, 'INT1': <TokenType.TINYINT: 'TINYINT'>, 'TINYINT': <TokenType.TINYINT: 'TINYINT'>, 'INT16': <TokenType.SMALLINT: 'SMALLINT'>, 'SHORT': <TokenType.SMALLINT: 'SMALLINT'>, 'SMALLINT': <TokenType.SMALLINT: 'SMALLINT'>, 'INT128': <TokenType.INT128: 'INT128'>, 'HUGEINT': <TokenType.INT128: 'INT128'>, 'INT2': <TokenType.SMALLINT: 'SMALLINT'>, 'INTEGER': <TokenType.INT: 'INT'>, 'INT': <TokenType.INT: 'INT'>, 'INT4': <TokenType.INT: 'INT'>, 'INT32': <TokenType.INT: 'INT'>, 'INT64': <TokenType.BIGINT: 'BIGINT'>, 'LONG': <TokenType.BIGINT: 'BIGINT'>, 'BIGINT': <TokenType.BIGINT: 'BIGINT'>, 'INT8': <TokenType.TINYINT: 'TINYINT'>, 'UINT': <TokenType.UINT: 'UINT'>, 'DEC': <TokenType.DECIMAL: 'DECIMAL'>, 'DECIMAL': <TokenType.DECIMAL: 'DECIMAL'>, 'BIGDECIMAL': <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, 'BIGNUMERIC': <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, 'LIST': <TokenType.LIST: 'LIST'>, 'MAP': <TokenType.MAP: 'MAP'>, 'NULLABLE': <TokenType.NULLABLE: 'NULLABLE'>, 'NUMBER': <TokenType.DECIMAL: 'DECIMAL'>, 'NUMERIC': <TokenType.DECIMAL: 'DECIMAL'>, 'FIXED': <TokenType.DECIMAL: 'DECIMAL'>, 'REAL': <TokenType.FLOAT: 'FLOAT'>, 'FLOAT': <TokenType.FLOAT: 'FLOAT'>, 'FLOAT4': <TokenType.FLOAT: 'FLOAT'>, 'FLOAT8': <TokenType.DOUBLE: 'DOUBLE'>, 'DOUBLE': <TokenType.DOUBLE: 'DOUBLE'>, 'DOUBLE PRECISION': <TokenType.DOUBLE: 'DOUBLE'>, 'JSON': <TokenType.JSON: 'JSON'>, 'JSONB': <TokenType.JSONB: 'JSONB'>, 'CHAR': <TokenType.CHAR: 'CHAR'>, 'CHARACTER': <TokenType.CHAR: 'CHAR'>, 'NCHAR': <TokenType.NCHAR: 'NCHAR'>, 'VARCHAR': <TokenType.VARCHAR: 'VARCHAR'>, 'VARCHAR2': <TokenType.VARCHAR: 'VARCHAR'>, 'NVARCHAR': <TokenType.NVARCHAR: 'NVARCHAR'>, 'NVARCHAR2': <TokenType.NVARCHAR: 'NVARCHAR'>, 'BPCHAR': <TokenType.BPCHAR: 'BPCHAR'>, 'STR': <TokenType.TEXT: 'TEXT'>, 'STRING': <TokenType.TEXT: 'TEXT'>, 'TEXT': <TokenType.TEXT: 'TEXT'>, 'LONGTEXT': <TokenType.LONGTEXT: 'LONGTEXT'>, 'MEDIUMTEXT': <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, 'TINYTEXT': <TokenType.TINYTEXT: 'TINYTEXT'>, 'CLOB': <TokenType.TEXT: 'TEXT'>, 'LONGVARCHAR': <TokenType.TEXT: 'TEXT'>, 'BINARY': <TokenType.BINARY: 'BINARY'>, 'BLOB': <TokenType.VARBINARY: 'VARBINARY'>, 'LONGBLOB': <TokenType.LONGBLOB: 'LONGBLOB'>, 'MEDIUMBLOB': <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, 'TINYBLOB': <TokenType.TINYBLOB: 'TINYBLOB'>, 'BYTEA': <TokenType.VARBINARY: 'VARBINARY'>, 'VARBINARY': <TokenType.VARBINARY: 'VARBINARY'>, 'TIME': <TokenType.TIME: 'TIME'>, 'TIMETZ': <TokenType.TIMETZ: 'TIMETZ'>, 'TIMESTAMP': <TokenType.TIMESTAMP: 'TIMESTAMP'>, 'TIMESTAMPTZ': <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, 'TIMESTAMPLTZ': <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, 'TIMESTAMP_LTZ': <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, 'TIMESTAMPNTZ': <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, 'TIMESTAMP_NTZ': <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, 'DATE': <TokenType.DATE: 'DATE'>, 'DATETIME': <TokenType.DATETIME: 'DATETIME'>, 'INT4RANGE': <TokenType.INT4RANGE: 'INT4RANGE'>, 'INT4MULTIRANGE': <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, 'INT8RANGE': <TokenType.INT8RANGE: 'INT8RANGE'>, 'INT8MULTIRANGE': <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, 'NUMRANGE': <TokenType.NUMRANGE: 'NUMRANGE'>, 'NUMMULTIRANGE': <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, 'TSRANGE': <TokenType.TSRANGE: 'TSRANGE'>, 'TSMULTIRANGE': <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, 'TSTZRANGE': <TokenType.TSTZRANGE: 'TSTZRANGE'>, 'TSTZMULTIRANGE': <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, 'DATERANGE': <TokenType.DATERANGE: 'DATERANGE'>, 'DATEMULTIRANGE': <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, 'UNIQUE': <TokenType.UNIQUE: 'UNIQUE'>, 'VECTOR': <TokenType.VECTOR: 'VECTOR'>, 'STRUCT': <TokenType.STRUCT: 'STRUCT'>, 'SEQUENCE': <TokenType.SEQUENCE: 'SEQUENCE'>, 'VARIANT': <TokenType.VARIANT: 'VARIANT'>, 'ALTER': <TokenType.ALTER: 'ALTER'>, 'ANALYZE': <TokenType.COMMAND: 'COMMAND'>, 'CALL': <TokenType.COMMAND: 'COMMAND'>, 'COMMENT': <TokenType.COMMENT: 'COMMENT'>, 'EXPLAIN': <TokenType.COMMAND: 'COMMAND'>, 'GRANT': <TokenType.COMMAND: 'COMMAND'>, 'OPTIMIZE': <TokenType.COMMAND: 'COMMAND'>, 'PREPARE': <TokenType.COMMAND: 'COMMAND'>, 'VACUUM': <TokenType.COMMAND: 'COMMAND'>, 'USER-DEFINED': <TokenType.USERDEFINED: 'USERDEFINED'>, 'FOR VERSION': <TokenType.VERSION_SNAPSHOT: 'VERSION_SNAPSHOT'>, 'FOR TIMESTAMP': <TokenType.TIMESTAMP_SNAPSHOT: 'TIMESTAMP_SNAPSHOT'>, 'ATTACH': <TokenType.COMMAND: 'COMMAND'>, 'DATE32': <TokenType.DATE32: 'DATE32'>, 'DATETIME64': <TokenType.DATETIME64: 'DATETIME64'>, 'DICTIONARY': <TokenType.DICTIONARY: 'DICTIONARY'>, 'ENUM8': <TokenType.ENUM8: 'ENUM8'>, 'ENUM16': <TokenType.ENUM16: 'ENUM16'>, 'FINAL': <TokenType.FINAL: 'FINAL'>, 'FIXEDSTRING': <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, 'FLOAT32': <TokenType.FLOAT: 'FLOAT'>, 'FLOAT64': <TokenType.DOUBLE: 'DOUBLE'>, 'GLOBAL': <TokenType.GLOBAL: 'GLOBAL'>, 'INT256': <TokenType.INT256: 'INT256'>, 'LOWCARDINALITY': <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, 'NESTED': <TokenType.NESTED: 'NESTED'>, 'SAMPLE': <TokenType.TABLE_SAMPLE: 'TABLE_SAMPLE'>, 'TUPLE': <TokenType.STRUCT: 'STRUCT'>, 'UINT128': <TokenType.UINT128: 'UINT128'>, 'UINT16': <TokenType.USMALLINT: 'USMALLINT'>, 'UINT256': <TokenType.UINT256: 'UINT256'>, 'UINT32': <TokenType.UINT: 'UINT'>, 'UINT64': <TokenType.UBIGINT: 'UBIGINT'>, 'UINT8': <TokenType.UTINYINT: 'UTINYINT'>, 'IPV4': <TokenType.IPV4: 'IPV4'>, 'IPV6': <TokenType.IPV6: 'IPV6'>, 'AGGREGATEFUNCTION': <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, 'SIMPLEAGGREGATEFUNCTION': <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, 'SYSTEM': <TokenType.COMMAND: 'COMMAND'>, 'PREWHERE': <TokenType.PREWHERE: 'PREWHERE'>}
SINGLE_TOKENS = {'(': <TokenType.L_PAREN: 'L_PAREN'>, ')': <TokenType.R_PAREN: 'R_PAREN'>, '[': <TokenType.L_BRACKET: 'L_BRACKET'>, ']': <TokenType.R_BRACKET: 'R_BRACKET'>, '{': <TokenType.L_BRACE: 'L_BRACE'>, '}': <TokenType.R_BRACE: 'R_BRACE'>, '&': <TokenType.AMP: 'AMP'>, '^': <TokenType.CARET: 'CARET'>, ':': <TokenType.COLON: 'COLON'>, ',': <TokenType.COMMA: 'COMMA'>, '.': <TokenType.DOT: 'DOT'>, '-': <TokenType.DASH: 'DASH'>, '=': <TokenType.EQ: 'EQ'>, '>': <TokenType.GT: 'GT'>, '<': <TokenType.LT: 'LT'>, '%': <TokenType.MOD: 'MOD'>, '!': <TokenType.NOT: 'NOT'>, '|': <TokenType.PIPE: 'PIPE'>, '+': <TokenType.PLUS: 'PLUS'>, ';': <TokenType.SEMICOLON: 'SEMICOLON'>, '/': <TokenType.SLASH: 'SLASH'>, '\\': <TokenType.BACKSLASH: 'BACKSLASH'>, '*': <TokenType.STAR: 'STAR'>, '~': <TokenType.TILDA: 'TILDA'>, '?': <TokenType.PLACEHOLDER: 'PLACEHOLDER'>, '@': <TokenType.PARAMETER: 'PARAMETER'>, '#': <TokenType.HASH: 'HASH'>, "'": <TokenType.UNKNOWN: 'UNKNOWN'>, '`': <TokenType.UNKNOWN: 'UNKNOWN'>, '"': <TokenType.UNKNOWN: 'UNKNOWN'>, '$': <TokenType.HEREDOC_STRING: 'HEREDOC_STRING'>}
class ClickHouse.Parser(sqlglot.parser.Parser):
171    class Parser(parser.Parser):
172        # Tested in ClickHouse's playground, it seems that the following two queries do the same thing
173        # * select x from t1 union all select x from t2 limit 1;
174        # * select x from t1 union all (select x from t2 limit 1);
175        MODIFIERS_ATTACHED_TO_SET_OP = False
176        INTERVAL_SPANS = False
177
178        FUNCTIONS = {
179            **parser.Parser.FUNCTIONS,
180            "ANY": exp.AnyValue.from_arg_list,
181            "ARRAYSUM": exp.ArraySum.from_arg_list,
182            "COUNTIF": _build_count_if,
183            "DATE_ADD": build_date_delta(exp.DateAdd, default_unit=None),
184            "DATEADD": build_date_delta(exp.DateAdd, default_unit=None),
185            "DATE_DIFF": build_date_delta(exp.DateDiff, default_unit=None),
186            "DATEDIFF": build_date_delta(exp.DateDiff, default_unit=None),
187            "DATE_FORMAT": _build_date_format,
188            "DATE_SUB": build_date_delta(exp.DateSub, default_unit=None),
189            "DATESUB": build_date_delta(exp.DateSub, default_unit=None),
190            "FORMATDATETIME": _build_date_format,
191            "JSONEXTRACTSTRING": build_json_extract_path(
192                exp.JSONExtractScalar, zero_based_indexing=False
193            ),
194            "MAP": parser.build_var_map,
195            "MATCH": exp.RegexpLike.from_arg_list,
196            "RANDCANONICAL": exp.Rand.from_arg_list,
197            "STR_TO_DATE": _build_str_to_date,
198            "TUPLE": exp.Struct.from_arg_list,
199            "TIMESTAMP_SUB": build_date_delta(exp.TimestampSub, default_unit=None),
200            "TIMESTAMPSUB": build_date_delta(exp.TimestampSub, default_unit=None),
201            "TIMESTAMP_ADD": build_date_delta(exp.TimestampAdd, default_unit=None),
202            "TIMESTAMPADD": build_date_delta(exp.TimestampAdd, default_unit=None),
203            "UNIQ": exp.ApproxDistinct.from_arg_list,
204            "XOR": lambda args: exp.Xor(expressions=args),
205            "MD5": exp.MD5Digest.from_arg_list,
206            "SHA256": lambda args: exp.SHA2(this=seq_get(args, 0), length=exp.Literal.number(256)),
207            "SHA512": lambda args: exp.SHA2(this=seq_get(args, 0), length=exp.Literal.number(512)),
208        }
209
210        AGG_FUNCTIONS = {
211            "count",
212            "min",
213            "max",
214            "sum",
215            "avg",
216            "any",
217            "stddevPop",
218            "stddevSamp",
219            "varPop",
220            "varSamp",
221            "corr",
222            "covarPop",
223            "covarSamp",
224            "entropy",
225            "exponentialMovingAverage",
226            "intervalLengthSum",
227            "kolmogorovSmirnovTest",
228            "mannWhitneyUTest",
229            "median",
230            "rankCorr",
231            "sumKahan",
232            "studentTTest",
233            "welchTTest",
234            "anyHeavy",
235            "anyLast",
236            "boundingRatio",
237            "first_value",
238            "last_value",
239            "argMin",
240            "argMax",
241            "avgWeighted",
242            "topK",
243            "topKWeighted",
244            "deltaSum",
245            "deltaSumTimestamp",
246            "groupArray",
247            "groupArrayLast",
248            "groupUniqArray",
249            "groupArrayInsertAt",
250            "groupArrayMovingAvg",
251            "groupArrayMovingSum",
252            "groupArraySample",
253            "groupBitAnd",
254            "groupBitOr",
255            "groupBitXor",
256            "groupBitmap",
257            "groupBitmapAnd",
258            "groupBitmapOr",
259            "groupBitmapXor",
260            "sumWithOverflow",
261            "sumMap",
262            "minMap",
263            "maxMap",
264            "skewSamp",
265            "skewPop",
266            "kurtSamp",
267            "kurtPop",
268            "uniq",
269            "uniqExact",
270            "uniqCombined",
271            "uniqCombined64",
272            "uniqHLL12",
273            "uniqTheta",
274            "quantile",
275            "quantiles",
276            "quantileExact",
277            "quantilesExact",
278            "quantileExactLow",
279            "quantilesExactLow",
280            "quantileExactHigh",
281            "quantilesExactHigh",
282            "quantileExactWeighted",
283            "quantilesExactWeighted",
284            "quantileTiming",
285            "quantilesTiming",
286            "quantileTimingWeighted",
287            "quantilesTimingWeighted",
288            "quantileDeterministic",
289            "quantilesDeterministic",
290            "quantileTDigest",
291            "quantilesTDigest",
292            "quantileTDigestWeighted",
293            "quantilesTDigestWeighted",
294            "quantileBFloat16",
295            "quantilesBFloat16",
296            "quantileBFloat16Weighted",
297            "quantilesBFloat16Weighted",
298            "simpleLinearRegression",
299            "stochasticLinearRegression",
300            "stochasticLogisticRegression",
301            "categoricalInformationValue",
302            "contingency",
303            "cramersV",
304            "cramersVBiasCorrected",
305            "theilsU",
306            "maxIntersections",
307            "maxIntersectionsPosition",
308            "meanZTest",
309            "quantileInterpolatedWeighted",
310            "quantilesInterpolatedWeighted",
311            "quantileGK",
312            "quantilesGK",
313            "sparkBar",
314            "sumCount",
315            "largestTriangleThreeBuckets",
316            "histogram",
317            "sequenceMatch",
318            "sequenceCount",
319            "windowFunnel",
320            "retention",
321            "uniqUpTo",
322            "sequenceNextNode",
323            "exponentialTimeDecayedAvg",
324        }
325
326        AGG_FUNCTIONS_SUFFIXES = [
327            "If",
328            "Array",
329            "ArrayIf",
330            "Map",
331            "SimpleState",
332            "State",
333            "Merge",
334            "MergeState",
335            "ForEach",
336            "Distinct",
337            "OrDefault",
338            "OrNull",
339            "Resample",
340            "ArgMin",
341            "ArgMax",
342        ]
343
344        FUNC_TOKENS = {
345            *parser.Parser.FUNC_TOKENS,
346            TokenType.SET,
347        }
348
349        RESERVED_TOKENS = parser.Parser.RESERVED_TOKENS - {TokenType.SELECT}
350
351        ID_VAR_TOKENS = {
352            *parser.Parser.ID_VAR_TOKENS,
353            TokenType.LIKE,
354        }
355
356        AGG_FUNC_MAPPING = (
357            lambda functions, suffixes: {
358                f"{f}{sfx}": (f, sfx) for sfx in (suffixes + [""]) for f in functions
359            }
360        )(AGG_FUNCTIONS, AGG_FUNCTIONS_SUFFIXES)
361
362        FUNCTIONS_WITH_ALIASED_ARGS = {*parser.Parser.FUNCTIONS_WITH_ALIASED_ARGS, "TUPLE"}
363
364        FUNCTION_PARSERS = {
365            **parser.Parser.FUNCTION_PARSERS,
366            "ARRAYJOIN": lambda self: self.expression(exp.Explode, this=self._parse_expression()),
367            "QUANTILE": lambda self: self._parse_quantile(),
368        }
369
370        FUNCTION_PARSERS.pop("MATCH")
371
372        NO_PAREN_FUNCTION_PARSERS = parser.Parser.NO_PAREN_FUNCTION_PARSERS.copy()
373        NO_PAREN_FUNCTION_PARSERS.pop("ANY")
374
375        RANGE_PARSERS = {
376            **parser.Parser.RANGE_PARSERS,
377            TokenType.GLOBAL: lambda self, this: self._match(TokenType.IN)
378            and self._parse_in(this, is_global=True),
379        }
380
381        # The PLACEHOLDER entry is popped because 1) it doesn't affect Clickhouse (it corresponds to
382        # the postgres-specific JSONBContains parser) and 2) it makes parsing the ternary op simpler.
383        COLUMN_OPERATORS = parser.Parser.COLUMN_OPERATORS.copy()
384        COLUMN_OPERATORS.pop(TokenType.PLACEHOLDER)
385
386        JOIN_KINDS = {
387            *parser.Parser.JOIN_KINDS,
388            TokenType.ANY,
389            TokenType.ASOF,
390            TokenType.ARRAY,
391        }
392
393        TABLE_ALIAS_TOKENS = parser.Parser.TABLE_ALIAS_TOKENS - {
394            TokenType.ANY,
395            TokenType.ARRAY,
396            TokenType.FINAL,
397            TokenType.FORMAT,
398            TokenType.SETTINGS,
399        }
400
401        ALIAS_TOKENS = parser.Parser.ALIAS_TOKENS - {
402            TokenType.FORMAT,
403        }
404
405        LOG_DEFAULTS_TO_LN = True
406
407        QUERY_MODIFIER_PARSERS = {
408            **parser.Parser.QUERY_MODIFIER_PARSERS,
409            TokenType.SETTINGS: lambda self: (
410                "settings",
411                self._advance() or self._parse_csv(self._parse_assignment),
412            ),
413            TokenType.FORMAT: lambda self: ("format", self._advance() or self._parse_id_var()),
414        }
415
416        CONSTRAINT_PARSERS = {
417            **parser.Parser.CONSTRAINT_PARSERS,
418            "INDEX": lambda self: self._parse_index_constraint(),
419            "CODEC": lambda self: self._parse_compress(),
420        }
421
422        ALTER_PARSERS = {
423            **parser.Parser.ALTER_PARSERS,
424            "REPLACE": lambda self: self._parse_alter_table_replace(),
425        }
426
427        SCHEMA_UNNAMED_CONSTRAINTS = {
428            *parser.Parser.SCHEMA_UNNAMED_CONSTRAINTS,
429            "INDEX",
430        }
431
432        def _parse_types(
433            self, check_func: bool = False, schema: bool = False, allow_identifiers: bool = True
434        ) -> t.Optional[exp.Expression]:
435            dtype = super()._parse_types(
436                check_func=check_func, schema=schema, allow_identifiers=allow_identifiers
437            )
438            if isinstance(dtype, exp.DataType):
439                # Mark every type as non-nullable which is ClickHouse's default. This marker
440                # helps us transpile types from other dialects to ClickHouse, so that we can
441                # e.g. produce `CAST(x AS Nullable(String))` from `CAST(x AS TEXT)`. If there
442                # is a `NULL` value in `x`, the former would fail in ClickHouse without the
443                # `Nullable` type constructor
444                dtype.set("nullable", False)
445
446            return dtype
447
448        def _parse_create(self) -> exp.Create | exp.Command:
449            create = super()._parse_create()
450
451            # DATABASE in ClickHouse is the same as SCHEMA in other dialects
452            if isinstance(create, exp.Create) and create.kind == "DATABASE":
453                create.set("kind", "SCHEMA")
454
455            return create
456
457        def _parse_extract(self) -> exp.Extract | exp.Anonymous:
458            index = self._index
459            this = self._parse_bitwise()
460            if self._match(TokenType.FROM):
461                self._retreat(index)
462                return super()._parse_extract()
463
464            # We return Anonymous here because extract and regexpExtract have different semantics,
465            # so parsing extract(foo, bar) into RegexpExtract can potentially break queries. E.g.,
466            # `extract('foobar', 'b')` works, but ClickHouse crashes for `regexpExtract('foobar', 'b')`.
467            #
468            # TODO: can we somehow convert the former into an equivalent `regexpExtract` call?
469            self._match(TokenType.COMMA)
470            return self.expression(
471                exp.Anonymous, this="extract", expressions=[this, self._parse_bitwise()]
472            )
473
474        def _parse_assignment(self) -> t.Optional[exp.Expression]:
475            this = super()._parse_assignment()
476
477            if self._match(TokenType.PLACEHOLDER):
478                return self.expression(
479                    exp.If,
480                    this=this,
481                    true=self._parse_assignment(),
482                    false=self._match(TokenType.COLON) and self._parse_assignment(),
483                )
484
485            return this
486
487        def _parse_placeholder(self) -> t.Optional[exp.Expression]:
488            """
489            Parse a placeholder expression like SELECT {abc: UInt32} or FROM {table: Identifier}
490            https://clickhouse.com/docs/en/sql-reference/syntax#defining-and-using-query-parameters
491            """
492            if not self._match(TokenType.L_BRACE):
493                return None
494
495            this = self._parse_id_var()
496            self._match(TokenType.COLON)
497            kind = self._parse_types(check_func=False, allow_identifiers=False) or (
498                self._match_text_seq("IDENTIFIER") and "Identifier"
499            )
500
501            if not kind:
502                self.raise_error("Expecting a placeholder type or 'Identifier' for tables")
503            elif not self._match(TokenType.R_BRACE):
504                self.raise_error("Expecting }")
505
506            return self.expression(exp.Placeholder, this=this, kind=kind)
507
508        def _parse_in(self, this: t.Optional[exp.Expression], is_global: bool = False) -> exp.In:
509            this = super()._parse_in(this)
510            this.set("is_global", is_global)
511            return this
512
513        def _parse_table(
514            self,
515            schema: bool = False,
516            joins: bool = False,
517            alias_tokens: t.Optional[t.Collection[TokenType]] = None,
518            parse_bracket: bool = False,
519            is_db_reference: bool = False,
520            parse_partition: bool = False,
521        ) -> t.Optional[exp.Expression]:
522            this = super()._parse_table(
523                schema=schema,
524                joins=joins,
525                alias_tokens=alias_tokens,
526                parse_bracket=parse_bracket,
527                is_db_reference=is_db_reference,
528            )
529
530            if self._match(TokenType.FINAL):
531                this = self.expression(exp.Final, this=this)
532
533            return this
534
535        def _parse_position(self, haystack_first: bool = False) -> exp.StrPosition:
536            return super()._parse_position(haystack_first=True)
537
538        # https://clickhouse.com/docs/en/sql-reference/statements/select/with/
539        def _parse_cte(self) -> exp.CTE:
540            # WITH <identifier> AS <subquery expression>
541            cte: t.Optional[exp.CTE] = self._try_parse(super()._parse_cte)
542
543            if not cte:
544                # WITH <expression> AS <identifier>
545                cte = self.expression(
546                    exp.CTE,
547                    this=self._parse_assignment(),
548                    alias=self._parse_table_alias(),
549                    scalar=True,
550                )
551
552            return cte
553
554        def _parse_join_parts(
555            self,
556        ) -> t.Tuple[t.Optional[Token], t.Optional[Token], t.Optional[Token]]:
557            is_global = self._match(TokenType.GLOBAL) and self._prev
558            kind_pre = self._match_set(self.JOIN_KINDS, advance=False) and self._prev
559
560            if kind_pre:
561                kind = self._match_set(self.JOIN_KINDS) and self._prev
562                side = self._match_set(self.JOIN_SIDES) and self._prev
563                return is_global, side, kind
564
565            return (
566                is_global,
567                self._match_set(self.JOIN_SIDES) and self._prev,
568                self._match_set(self.JOIN_KINDS) and self._prev,
569            )
570
571        def _parse_join(
572            self, skip_join_token: bool = False, parse_bracket: bool = False
573        ) -> t.Optional[exp.Join]:
574            join = super()._parse_join(skip_join_token=skip_join_token, parse_bracket=True)
575            if join:
576                join.set("global", join.args.pop("method", None))
577
578            return join
579
580        def _parse_function(
581            self,
582            functions: t.Optional[t.Dict[str, t.Callable]] = None,
583            anonymous: bool = False,
584            optional_parens: bool = True,
585            any_token: bool = False,
586        ) -> t.Optional[exp.Expression]:
587            expr = super()._parse_function(
588                functions=functions,
589                anonymous=anonymous,
590                optional_parens=optional_parens,
591                any_token=any_token,
592            )
593
594            func = expr.this if isinstance(expr, exp.Window) else expr
595
596            # Aggregate functions can be split in 2 parts: <func_name><suffix>
597            parts = (
598                self.AGG_FUNC_MAPPING.get(func.this) if isinstance(func, exp.Anonymous) else None
599            )
600
601            if parts:
602                params = self._parse_func_params(func)
603
604                kwargs = {
605                    "this": func.this,
606                    "expressions": func.expressions,
607                }
608                if parts[1]:
609                    kwargs["parts"] = parts
610                    exp_class = exp.CombinedParameterizedAgg if params else exp.CombinedAggFunc
611                else:
612                    exp_class = exp.ParameterizedAgg if params else exp.AnonymousAggFunc
613
614                kwargs["exp_class"] = exp_class
615                if params:
616                    kwargs["params"] = params
617
618                func = self.expression(**kwargs)
619
620                if isinstance(expr, exp.Window):
621                    # The window's func was parsed as Anonymous in base parser, fix its
622                    # type to be ClickHouse style CombinedAnonymousAggFunc / AnonymousAggFunc
623                    expr.set("this", func)
624                elif params:
625                    # Params have blocked super()._parse_function() from parsing the following window
626                    # (if that exists) as they're standing between the function call and the window spec
627                    expr = self._parse_window(func)
628                else:
629                    expr = func
630
631            return expr
632
633        def _parse_func_params(
634            self, this: t.Optional[exp.Func] = None
635        ) -> t.Optional[t.List[exp.Expression]]:
636            if self._match_pair(TokenType.R_PAREN, TokenType.L_PAREN):
637                return self._parse_csv(self._parse_lambda)
638
639            if self._match(TokenType.L_PAREN):
640                params = self._parse_csv(self._parse_lambda)
641                self._match_r_paren(this)
642                return params
643
644            return None
645
646        def _parse_quantile(self) -> exp.Quantile:
647            this = self._parse_lambda()
648            params = self._parse_func_params()
649            if params:
650                return self.expression(exp.Quantile, this=params[0], quantile=this)
651            return self.expression(exp.Quantile, this=this, quantile=exp.Literal.number(0.5))
652
653        def _parse_wrapped_id_vars(self, optional: bool = False) -> t.List[exp.Expression]:
654            return super()._parse_wrapped_id_vars(optional=True)
655
656        def _parse_primary_key(
657            self, wrapped_optional: bool = False, in_props: bool = False
658        ) -> exp.PrimaryKeyColumnConstraint | exp.PrimaryKey:
659            return super()._parse_primary_key(
660                wrapped_optional=wrapped_optional or in_props, in_props=in_props
661            )
662
663        def _parse_on_property(self) -> t.Optional[exp.Expression]:
664            index = self._index
665            if self._match_text_seq("CLUSTER"):
666                this = self._parse_id_var()
667                if this:
668                    return self.expression(exp.OnCluster, this=this)
669                else:
670                    self._retreat(index)
671            return None
672
673        def _parse_index_constraint(
674            self, kind: t.Optional[str] = None
675        ) -> exp.IndexColumnConstraint:
676            # INDEX name1 expr TYPE type1(args) GRANULARITY value
677            this = self._parse_id_var()
678            expression = self._parse_assignment()
679
680            index_type = self._match_text_seq("TYPE") and (
681                self._parse_function() or self._parse_var()
682            )
683
684            granularity = self._match_text_seq("GRANULARITY") and self._parse_term()
685
686            return self.expression(
687                exp.IndexColumnConstraint,
688                this=this,
689                expression=expression,
690                index_type=index_type,
691                granularity=granularity,
692            )
693
694        def _parse_partition(self) -> t.Optional[exp.Partition]:
695            # https://clickhouse.com/docs/en/sql-reference/statements/alter/partition#how-to-set-partition-expression
696            if not self._match(TokenType.PARTITION):
697                return None
698
699            if self._match_text_seq("ID"):
700                # Corresponds to the PARTITION ID <string_value> syntax
701                expressions: t.List[exp.Expression] = [
702                    self.expression(exp.PartitionId, this=self._parse_string())
703                ]
704            else:
705                expressions = self._parse_expressions()
706
707            return self.expression(exp.Partition, expressions=expressions)
708
709        def _parse_alter_table_replace(self) -> t.Optional[exp.Expression]:
710            partition = self._parse_partition()
711
712            if not partition or not self._match(TokenType.FROM):
713                return None
714
715            return self.expression(
716                exp.ReplacePartition, expression=partition, source=self._parse_table_parts()
717            )
718
719        def _parse_projection_def(self) -> t.Optional[exp.ProjectionDef]:
720            if not self._match_text_seq("PROJECTION"):
721                return None
722
723            return self.expression(
724                exp.ProjectionDef,
725                this=self._parse_id_var(),
726                expression=self._parse_wrapped(self._parse_statement),
727            )
728
729        def _parse_constraint(self) -> t.Optional[exp.Expression]:
730            return super()._parse_constraint() or self._parse_projection_def()

Parser consumes a list of tokens produced by the Tokenizer and produces a parsed syntax tree.

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

Generator converts a given syntax tree to the corresponding SQL string.

Arguments:
  • pretty: Whether to format the produced SQL string. Default: False.
  • identify: Determines when an identifier should be quoted. Possible values are: False (default): Never quote, except in cases where it's mandatory by the dialect. True or 'always': Always quote. 'safe': Only quote identifiers that are case insensitive.
  • normalize: Whether to normalize identifiers to lowercase. Default: False.
  • pad: The pad size in a formatted string. For example, this affects the indentation of a projection in a query, relative to its nesting level. Default: 2.
  • indent: The indentation size in a formatted string. For example, this affects the indentation of subqueries and filters under a WHERE clause. Default: 2.
  • normalize_functions: How to normalize function names. Possible values are: "upper" or True (default): Convert names to uppercase. "lower": Convert names to lowercase. False: Disables function name normalization.
  • unsupported_level: Determines the generator's behavior when it encounters unsupported expressions. Default ErrorLevel.WARN.
  • max_unsupported: Maximum number of unsupported messages to include in a raised UnsupportedError. This is only relevant if unsupported_level is ErrorLevel.RAISE. Default: 3
  • leading_comma: Whether the comma is leading or trailing in select expressions. This is only relevant when generating in pretty mode. Default: False
  • max_text_width: The max number of characters in a segment before creating new lines in pretty mode. The default is on the smaller end because the length only represents a segment and not the true line length. Default: 80
  • comments: Whether to preserve comments in the output SQL code. Default: True
QUERY_HINTS = False
STRUCT_DELIMITER = ('(', ')')
NVL2_SUPPORTED = False
TABLESAMPLE_REQUIRES_PARENS = False
TABLESAMPLE_SIZE_IS_ROWS = False
TABLESAMPLE_KEYWORDS = 'SAMPLE'
LAST_DAY_SUPPORTS_DATE_PART = False
CAN_IMPLEMENT_ARRAY_ANY = True
SUPPORTS_TO_NUMBER = False
JOIN_HINTS = False
TABLE_HINTS = False
EXPLICIT_SET_OP = True
GROUPINGS_SEP = ''
SET_OP_MODIFIERS = False
SUPPORTS_TABLE_ALIAS_COLUMNS = False
VALUES_AS_TABLE = False
STRING_TYPE_MAPPING = {<Type.CHAR: 'CHAR'>: 'String', <Type.LONGBLOB: 'LONGBLOB'>: 'String', <Type.LONGTEXT: 'LONGTEXT'>: 'String', <Type.MEDIUMBLOB: 'MEDIUMBLOB'>: 'String', <Type.MEDIUMTEXT: 'MEDIUMTEXT'>: 'String', <Type.TINYBLOB: 'TINYBLOB'>: 'String', <Type.TINYTEXT: 'TINYTEXT'>: 'String', <Type.TEXT: 'TEXT'>: 'String', <Type.VARBINARY: 'VARBINARY'>: 'String', <Type.VARCHAR: 'VARCHAR'>: 'String'}
TYPE_MAPPING = {<Type.NCHAR: 'NCHAR'>: 'CHAR', <Type.NVARCHAR: 'NVARCHAR'>: 'VARCHAR', <Type.MEDIUMTEXT: 'MEDIUMTEXT'>: 'String', <Type.LONGTEXT: 'LONGTEXT'>: 'String', <Type.TINYTEXT: 'TINYTEXT'>: 'String', <Type.MEDIUMBLOB: 'MEDIUMBLOB'>: 'String', <Type.LONGBLOB: 'LONGBLOB'>: 'String', <Type.TINYBLOB: 'TINYBLOB'>: 'String', <Type.INET: 'INET'>: 'INET', <Type.ROWVERSION: 'ROWVERSION'>: 'VARBINARY', <Type.CHAR: 'CHAR'>: 'String', <Type.TEXT: 'TEXT'>: 'String', <Type.VARBINARY: 'VARBINARY'>: 'String', <Type.VARCHAR: 'VARCHAR'>: 'String', <Type.ARRAY: 'ARRAY'>: 'Array', <Type.BIGINT: 'BIGINT'>: 'Int64', <Type.DATE32: 'DATE32'>: 'Date32', <Type.DATETIME64: 'DATETIME64'>: 'DateTime64', <Type.TIMESTAMPTZ: 'TIMESTAMPTZ'>: 'TIMESTAMP', <Type.DOUBLE: 'DOUBLE'>: 'Float64', <Type.ENUM: 'ENUM'>: 'Enum', <Type.ENUM8: 'ENUM8'>: 'Enum8', <Type.ENUM16: 'ENUM16'>: 'Enum16', <Type.FIXEDSTRING: 'FIXEDSTRING'>: 'FixedString', <Type.FLOAT: 'FLOAT'>: 'Float32', <Type.INT: 'INT'>: 'Int32', <Type.MEDIUMINT: 'MEDIUMINT'>: 'Int32', <Type.INT128: 'INT128'>: 'Int128', <Type.INT256: 'INT256'>: 'Int256', <Type.LOWCARDINALITY: 'LOWCARDINALITY'>: 'LowCardinality', <Type.MAP: 'MAP'>: 'Map', <Type.NESTED: 'NESTED'>: 'Nested', <Type.NULLABLE: 'NULLABLE'>: 'Nullable', <Type.SMALLINT: 'SMALLINT'>: 'Int16', <Type.STRUCT: 'STRUCT'>: 'Tuple', <Type.TINYINT: 'TINYINT'>: 'Int8', <Type.UBIGINT: 'UBIGINT'>: 'UInt64', <Type.UINT: 'UINT'>: 'UInt32', <Type.UINT128: 'UINT128'>: 'UInt128', <Type.UINT256: 'UINT256'>: 'UInt256', <Type.USMALLINT: 'USMALLINT'>: 'UInt16', <Type.UTINYINT: 'UTINYINT'>: 'UInt8', <Type.IPV4: 'IPV4'>: 'IPv4', <Type.IPV6: 'IPV6'>: 'IPv6', <Type.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>: 'AggregateFunction', <Type.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>: 'SimpleAggregateFunction'}
TRANSFORMS = {<class 'sqlglot.expressions.JSONPathKey'>: <function json_path_key_only_name>, <class 'sqlglot.expressions.JSONPathRoot'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.JSONPathSubscript'>: <function <lambda>>, <class 'sqlglot.expressions.AllowedValuesProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.AutoRefreshProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.BackupProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CaseSpecificColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CharacterSetColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CharacterSetProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ClusteredColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CollateColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CommentColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ConnectByRoot'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CopyGrantsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.DateFormatColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.DefaultColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.DynamicProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.EmptyProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.EncodeColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.EphemeralColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ExcludeColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ExecuteAsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ExternalProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.GlobalProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.HeapProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.IcebergProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.InheritsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.InlineLengthColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.InputModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.IntervalSpan'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.LanguageProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.LocationProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.LogProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.MaterializedProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.NonClusteredColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.NoPrimaryIndexProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.NotForReplicationColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.OnCommitProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.OnProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.OnUpdateColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.OutputModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.PathColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.PivotAny'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ProjectionPolicyColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.RemoteWithConnectionModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ReturnsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SampleProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SecureProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SetConfigProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SetProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SettingsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SharingProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SqlReadWriteProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SqlSecurityProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.StabilityProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Stream'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.StreamingTableProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.StrictProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TemporaryProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TagColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TitleColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ToMap'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ToTableProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TransformModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TransientProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.UppercaseColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.UnloggedProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.VarMap'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.ViewAttributeProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.VolatileProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WithJournalTableProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WithSchemaBindingProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WithOperator'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.AnyValue'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.ApproxDistinct'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.ArrayFilter'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.ArraySize'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.ArraySum'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.ArgMax'>: <function arg_max_or_min_no_count.<locals>._arg_max_or_min_sql>, <class 'sqlglot.expressions.ArgMin'>: <function arg_max_or_min_no_count.<locals>._arg_max_or_min_sql>, <class 'sqlglot.expressions.Array'>: <function inline_array_sql>, <class 'sqlglot.expressions.CastToStrType'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.CountIf'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.CompressColumnConstraint'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.ComputedColumnConstraint'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.CurrentDate'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.DateAdd'>: <function _datetime_delta_sql.<locals>._delta_sql>, <class 'sqlglot.expressions.DateDiff'>: <function _datetime_delta_sql.<locals>._delta_sql>, <class 'sqlglot.expressions.DateStrToDate'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.DateSub'>: <function _datetime_delta_sql.<locals>._delta_sql>, <class 'sqlglot.expressions.Explode'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.Final'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.IsNan'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.JSONExtract'>: <function json_extract_segments.<locals>._json_extract_segments>, <class 'sqlglot.expressions.JSONExtractScalar'>: <function json_extract_segments.<locals>._json_extract_segments>, <class 'sqlglot.expressions.Map'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.Nullif'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.PartitionedByProperty'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.Pivot'>: <function no_pivot_sql>, <class 'sqlglot.expressions.Quantile'>: <function _quantile_sql>, <class 'sqlglot.expressions.RegexpLike'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.Rand'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.StartsWith'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.StrPosition'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.TimeToStr'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.TimestampAdd'>: <function _datetime_delta_sql.<locals>._delta_sql>, <class 'sqlglot.expressions.TimestampSub'>: <function _datetime_delta_sql.<locals>._delta_sql>, <class 'sqlglot.expressions.Xor'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.MD5Digest'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.MD5'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.SHA'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.SHA2'>: <function sha256_sql>, <class 'sqlglot.expressions.UnixToTime'>: <function _unix_to_time_sql>, <class 'sqlglot.expressions.TimestampTrunc'>: <function timestamptrunc_sql.<locals>._timestamptrunc_sql>, <class 'sqlglot.expressions.Variance'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.SchemaCommentProperty'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.Stddev'>: <function rename_func.<locals>.<lambda>>}
PROPERTIES_LOCATION = {<class 'sqlglot.expressions.AllowedValuesProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.AlgorithmProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.AutoIncrementProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.AutoRefreshProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.BackupProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.BlockCompressionProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.CharacterSetProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ChecksumProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.CollateProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.CopyGrantsProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.Cluster'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ClusteredByProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DataBlocksizeProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.DataDeletionProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DefinerProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.DictRange'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DictProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DynamicProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.DistKeyProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DistStyleProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.EmptyProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.EngineProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ExecuteAsProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ExternalProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.FallbackProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.FileFormatProperty'>: <Location.POST_WITH: 'POST_WITH'>, <class 'sqlglot.expressions.FreespaceProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.GlobalProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.HeapProperty'>: <Location.POST_WITH: 'POST_WITH'>, <class 'sqlglot.expressions.InheritsProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.IcebergProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.InputModelProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.IsolatedLoadingProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.JournalProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.LanguageProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.LikeProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.LocationProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.LockProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.LockingProperty'>: <Location.POST_ALIAS: 'POST_ALIAS'>, <class 'sqlglot.expressions.LogProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.MaterializedProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.MergeBlockRatioProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.NoPrimaryIndexProperty'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.OnProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.OnCommitProperty'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.Order'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.OutputModelProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.PartitionedByProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.PartitionedOfProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.PrimaryKey'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.Property'>: <Location.POST_WITH: 'POST_WITH'>, <class 'sqlglot.expressions.RemoteWithConnectionModelProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ReturnsProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.RowFormatProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.RowFormatDelimitedProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.RowFormatSerdeProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SampleProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SchemaCommentProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SecureProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.SerdeProperties'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.Set'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SettingsProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SetProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.SetConfigProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SharingProperty'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.SequenceProperties'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.SortKeyProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SqlReadWriteProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SqlSecurityProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.StabilityProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.StreamingTableProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.StrictProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.TemporaryProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.ToTableProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.TransientProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.TransformModelProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.MergeTreeTTL'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.UnloggedProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.ViewAttributeProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.VolatileProperty'>: <Location.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.WithDataProperty'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.WithJournalTableProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.WithSchemaBindingProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.WithSystemVersioningProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.OnCluster'>: <Location.POST_NAME: 'POST_NAME'>}
ON_CLUSTER_TARGETS = {'TABLE', 'DICTIONARY', 'DATABASE', 'FUNCTION', 'INDEX', 'VIEW', 'NAMED COLLECTION'}
NON_NULLABLE_TYPES = {<Type.MAP: 'MAP'>, <Type.NULLABLE: 'NULLABLE'>, <Type.ARRAY: 'ARRAY'>, <Type.STRUCT: 'STRUCT'>}
def strtodate_sql(self, expression: sqlglot.expressions.StrToDate) -> str:
890        def strtodate_sql(self, expression: exp.StrToDate) -> str:
891            strtodate_sql = self.function_fallback_sql(expression)
892
893            if not isinstance(expression.parent, exp.Cast):
894                # StrToDate returns DATEs in other dialects (eg. postgres), so
895                # this branch aims to improve the transpilation to clickhouse
896                return f"CAST({strtodate_sql} AS DATE)"
897
898            return strtodate_sql
def cast_sql( self, expression: sqlglot.expressions.Cast, safe_prefix: Optional[str] = None) -> str:
900        def cast_sql(self, expression: exp.Cast, safe_prefix: t.Optional[str] = None) -> str:
901            this = expression.this
902
903            if isinstance(this, exp.StrToDate) and expression.to == exp.DataType.build("datetime"):
904                return self.sql(this)
905
906            return super().cast_sql(expression, safe_prefix=safe_prefix)
def trycast_sql(self, expression: sqlglot.expressions.TryCast) -> str:
908        def trycast_sql(self, expression: exp.TryCast) -> str:
909            dtype = expression.to
910            if not dtype.is_type(*self.NON_NULLABLE_TYPES):
911                # Casting x into Nullable(T) appears to behave similarly to TRY_CAST(x AS T)
912                dtype.set("nullable", True)
913
914            return super().cast_sql(expression)
def likeproperty_sql(self, expression: sqlglot.expressions.LikeProperty) -> str:
920        def likeproperty_sql(self, expression: exp.LikeProperty) -> str:
921            return f"AS {self.sql(expression, 'this')}"
def eq_sql(self, expression: sqlglot.expressions.EQ) -> str:
940        def eq_sql(self, expression: exp.EQ) -> str:
941            return self._any_to_has(expression, super().eq_sql)
def neq_sql(self, expression: sqlglot.expressions.NEQ) -> str:
943        def neq_sql(self, expression: exp.NEQ) -> str:
944            return self._any_to_has(expression, super().neq_sql, "NOT ")
def regexpilike_sql(self, expression: sqlglot.expressions.RegexpILike) -> str:
946        def regexpilike_sql(self, expression: exp.RegexpILike) -> str:
947            # Manually add a flag to make the search case-insensitive
948            regex = self.func("CONCAT", "'(?i)'", expression.expression)
949            return self.func("match", expression.this, regex)
def datatype_sql(self, expression: sqlglot.expressions.DataType) -> str:
951        def datatype_sql(self, expression: exp.DataType) -> str:
952            # String is the standard ClickHouse type, every other variant is just an alias.
953            # Additionally, any supplied length parameter will be ignored.
954            #
955            # https://clickhouse.com/docs/en/sql-reference/data-types/string
956            if expression.this in self.STRING_TYPE_MAPPING:
957                dtype = "String"
958            else:
959                dtype = super().datatype_sql(expression)
960
961            # This section changes the type to `Nullable(...)` if the following conditions hold:
962            # - It's marked as nullable - this ensures we won't wrap ClickHouse types with `Nullable`
963            #   and change their semantics
964            # - It's not the key type of a `Map`. This is because ClickHouse enforces the following
965            #   constraint: "Type of Map key must be a type, that can be represented by integer or
966            #   String or FixedString (possibly LowCardinality) or UUID or IPv6"
967            # - It's not a composite type, e.g. `Nullable(Array(...))` is not a valid type
968            parent = expression.parent
969            if (
970                expression.args.get("nullable") is not False
971                and not (
972                    isinstance(parent, exp.DataType)
973                    and parent.is_type(exp.DataType.Type.MAP)
974                    and expression.index in (None, 0)
975                )
976                and not expression.is_type(*self.NON_NULLABLE_TYPES)
977            ):
978                dtype = f"Nullable({dtype})"
979
980            return dtype
def cte_sql(self, expression: sqlglot.expressions.CTE) -> str:
982        def cte_sql(self, expression: exp.CTE) -> str:
983            if expression.args.get("scalar"):
984                this = self.sql(expression, "this")
985                alias = self.sql(expression, "alias")
986                return f"{this} AS {alias}"
987
988            return super().cte_sql(expression)
def after_limit_modifiers(self, expression: sqlglot.expressions.Expression) -> List[str]:
 990        def after_limit_modifiers(self, expression: exp.Expression) -> t.List[str]:
 991            return super().after_limit_modifiers(expression) + [
 992                (
 993                    self.seg("SETTINGS ") + self.expressions(expression, key="settings", flat=True)
 994                    if expression.args.get("settings")
 995                    else ""
 996                ),
 997                (
 998                    self.seg("FORMAT ") + self.sql(expression, "format")
 999                    if expression.args.get("format")
1000                    else ""
1001                ),
1002            ]
def parameterizedagg_sql(self, expression: sqlglot.expressions.ParameterizedAgg) -> str:
1004        def parameterizedagg_sql(self, expression: exp.ParameterizedAgg) -> str:
1005            params = self.expressions(expression, key="params", flat=True)
1006            return self.func(expression.name, *expression.expressions) + f"({params})"
def anonymousaggfunc_sql(self, expression: sqlglot.expressions.AnonymousAggFunc) -> str:
1008        def anonymousaggfunc_sql(self, expression: exp.AnonymousAggFunc) -> str:
1009            return self.func(expression.name, *expression.expressions)
def combinedaggfunc_sql(self, expression: sqlglot.expressions.CombinedAggFunc) -> str:
1011        def combinedaggfunc_sql(self, expression: exp.CombinedAggFunc) -> str:
1012            return self.anonymousaggfunc_sql(expression)
def combinedparameterizedagg_sql(self, expression: sqlglot.expressions.CombinedParameterizedAgg) -> str:
1014        def combinedparameterizedagg_sql(self, expression: exp.CombinedParameterizedAgg) -> str:
1015            return self.parameterizedagg_sql(expression)
def placeholder_sql(self, expression: sqlglot.expressions.Placeholder) -> str:
1017        def placeholder_sql(self, expression: exp.Placeholder) -> str:
1018            return f"{{{expression.name}: {self.sql(expression, 'kind')}}}"
def oncluster_sql(self, expression: sqlglot.expressions.OnCluster) -> str:
1020        def oncluster_sql(self, expression: exp.OnCluster) -> str:
1021            return f"ON CLUSTER {self.sql(expression, 'this')}"
def createable_sql( self, expression: sqlglot.expressions.Create, locations: DefaultDict) -> str:
1023        def createable_sql(self, expression: exp.Create, locations: t.DefaultDict) -> str:
1024            if expression.kind in self.ON_CLUSTER_TARGETS and locations.get(
1025                exp.Properties.Location.POST_NAME
1026            ):
1027                this_name = self.sql(
1028                    expression.this if isinstance(expression.this, exp.Schema) else expression,
1029                    "this",
1030                )
1031                this_properties = " ".join(
1032                    [self.sql(prop) for prop in locations[exp.Properties.Location.POST_NAME]]
1033                )
1034                this_schema = self.schema_columns_sql(expression.this)
1035                return f"{this_name}{self.sep()}{this_properties}{self.sep()}{this_schema}"
1036
1037            return super().createable_sql(expression, locations)
def create_sql(self, expression: sqlglot.expressions.Create) -> str:
1039        def create_sql(self, expression: exp.Create) -> str:
1040            # The comment property comes last in CTAS statements, i.e. after the query
1041            query = expression.expression
1042            if isinstance(query, exp.Query):
1043                comment_prop = expression.find(exp.SchemaCommentProperty)
1044                if comment_prop:
1045                    comment_prop.pop()
1046                    query.replace(exp.paren(query))
1047            else:
1048                comment_prop = None
1049
1050            # ClickHouse only has DATABASEs and objects under them, eg. TABLEs, VIEWs, etc
1051            if expression.kind == "SCHEMA":
1052                expression.set("kind", "DATABASE")
1053
1054            create_sql = super().create_sql(expression)
1055
1056            comment_sql = self.sql(comment_prop)
1057            comment_sql = f" {comment_sql}" if comment_sql else ""
1058
1059            return f"{create_sql}{comment_sql}"
def prewhere_sql(self, expression: sqlglot.expressions.PreWhere) -> str:
1061        def prewhere_sql(self, expression: exp.PreWhere) -> str:
1062            this = self.indent(self.sql(expression, "this"))
1063            return f"{self.seg('PREWHERE')}{self.sep()}{this}"
def indexcolumnconstraint_sql(self, expression: sqlglot.expressions.IndexColumnConstraint) -> str:
1065        def indexcolumnconstraint_sql(self, expression: exp.IndexColumnConstraint) -> str:
1066            this = self.sql(expression, "this")
1067            this = f" {this}" if this else ""
1068            expr = self.sql(expression, "expression")
1069            expr = f" {expr}" if expr else ""
1070            index_type = self.sql(expression, "index_type")
1071            index_type = f" TYPE {index_type}" if index_type else ""
1072            granularity = self.sql(expression, "granularity")
1073            granularity = f" GRANULARITY {granularity}" if granularity else ""
1074
1075            return f"INDEX{this}{expr}{index_type}{granularity}"
def partition_sql(self, expression: sqlglot.expressions.Partition) -> str:
1077        def partition_sql(self, expression: exp.Partition) -> str:
1078            return f"PARTITION {self.expressions(expression, flat=True)}"
def partitionid_sql(self, expression: sqlglot.expressions.PartitionId) -> str:
1080        def partitionid_sql(self, expression: exp.PartitionId) -> str:
1081            return f"ID {self.sql(expression.this)}"
def replacepartition_sql(self, expression: sqlglot.expressions.ReplacePartition) -> str:
1083        def replacepartition_sql(self, expression: exp.ReplacePartition) -> str:
1084            return (
1085                f"REPLACE {self.sql(expression.expression)} FROM {self.sql(expression, 'source')}"
1086            )
def projectiondef_sql(self, expression: sqlglot.expressions.ProjectionDef) -> str:
1088        def projectiondef_sql(self, expression: exp.ProjectionDef) -> str:
1089            return f"PROJECTION {self.sql(expression.this)} {self.wrap(expression.expression)}"
SELECT_KINDS: Tuple[str, ...] = ()
TRY_SUPPORTED = False
SUPPORTS_UESCAPE = False
AFTER_HAVING_MODIFIER_TRANSFORMS = {'windows': <function Generator.<lambda>>, 'qualify': <function Generator.<lambda>>}
Inherited Members
sqlglot.generator.Generator
Generator
NULL_ORDERING_SUPPORTED
IGNORE_NULLS_IN_FUNC
LOCKING_READS_SUPPORTED
WRAP_DERIVED_VALUES
CREATE_FUNCTION_RETURN_AS
MATCHED_BY_SOURCE
SINGLE_STRING_INTERVAL
INTERVAL_ALLOWS_PLURAL_FORM
LIMIT_FETCH
LIMIT_ONLY_LITERALS
RENAME_TABLE_WITH_DB
INDEX_ON
QUERY_HINT_SEP
IS_BOOL_ALLOWED
DUPLICATE_KEY_UPDATE_WITH_SET
LIMIT_IS_TOP
RETURNING_END
EXTRACT_ALLOWS_QUOTES
TZ_TO_WITH_TIME_ZONE
ALTER_TABLE_INCLUDE_COLUMN_KEYWORD
UNNEST_WITH_ORDINALITY
AGGREGATE_FILTER_SUPPORTED
SEMI_ANTI_JOIN_WITH_SIDE
COMPUTED_COLUMN_WITH_TYPE
SUPPORTS_TABLE_COPY
TABLESAMPLE_WITH_METHOD
TABLESAMPLE_SEED_KEYWORD
COLLATE_IS_FUNC
DATA_TYPE_SPECIFIERS_ALLOWED
ENSURE_BOOLS
CTE_RECURSIVE_KEYWORD_REQUIRED
SUPPORTS_SINGLE_ARG_CONCAT
UNPIVOT_ALIASES_ARE_IDENTIFIERS
JSON_KEY_VALUE_PAIR_SEP
INSERT_OVERWRITE
SUPPORTS_SELECT_INTO
SUPPORTS_UNLOGGED_TABLES
SUPPORTS_CREATE_TABLE_LIKE
LIKE_PROPERTY_INSIDE_SCHEMA
MULTI_ARG_DISTINCT
JSON_TYPE_REQUIRED_FOR_EXTRACTION
JSON_PATH_BRACKETED_KEY_SUPPORTED
JSON_PATH_SINGLE_QUOTE_ESCAPE
COPY_PARAMS_ARE_WRAPPED
COPY_PARAMS_EQ_REQUIRED
COPY_HAS_INTO_KEYWORD
STAR_EXCEPT
HEX_FUNC
WITH_PROPERTIES_PREFIX
QUOTE_JSON_PATH
PAD_FILL_PATTERN_IS_REQUIRED
SUPPORTS_EXPLODING_PROJECTIONS
ARRAY_CONCAT_IS_VAR_LEN
SUPPORTS_CONVERT_TIMEZONE
SUPPORTS_NULLABLE_TYPES
PARSE_JSON_NAME
TIME_PART_SINGULARS
TOKEN_MAPPING
PARAMETER_TOKEN
NAMED_PLACEHOLDER_TOKEN
RESERVED_KEYWORDS
WITH_SEPARATED_COMMENTS
EXCLUDE_COMMENTS
UNWRAPPED_INTERVAL_VALUES
PARAMETERIZABLE_TEXT_TYPES
EXPRESSIONS_WITHOUT_NESTED_CTES
SENTINEL_LINE_BREAK
pretty
identify
normalize
pad
unsupported_level
max_unsupported
leading_comma
max_text_width
comments
dialect
normalize_functions
unsupported_messages
generate
preprocess
unsupported
sep
seg
pad_comment
maybe_comment
wrap
no_identify
normalize_func
indent
sql
uncache_sql
cache_sql
characterset_sql
column_parts
column_sql
columnposition_sql
columndef_sql
columnconstraint_sql
computedcolumnconstraint_sql
autoincrementcolumnconstraint_sql
compresscolumnconstraint_sql
generatedasidentitycolumnconstraint_sql
generatedasrowcolumnconstraint_sql
periodforsystemtimeconstraint_sql
notnullcolumnconstraint_sql
transformcolumnconstraint_sql
primarykeycolumnconstraint_sql
uniquecolumnconstraint_sql
sequenceproperties_sql
clone_sql
describe_sql
heredoc_sql
prepend_ctes
with_sql
tablealias_sql
bitstring_sql
hexstring_sql
bytestring_sql
unicodestring_sql
rawstring_sql
datatypeparam_sql
directory_sql
delete_sql
drop_sql
except_sql
except_op
fetch_sql
filter_sql
hint_sql
indexparameters_sql
index_sql
identifier_sql
hex_sql
lowerhex_sql
inputoutputformat_sql
national_sql
properties_sql
root_properties
properties
with_properties
locate_properties
property_name
property_sql
fallbackproperty_sql
journalproperty_sql
freespaceproperty_sql
checksumproperty_sql
mergeblockratioproperty_sql
datablocksizeproperty_sql
blockcompressionproperty_sql
isolatedloadingproperty_sql
partitionboundspec_sql
partitionedofproperty_sql
lockingproperty_sql
withdataproperty_sql
withsystemversioningproperty_sql
insert_sql
intersect_sql
intersect_op
introducer_sql
kill_sql
pseudotype_sql
objectidentifier_sql
onconflict_sql
returning_sql
rowformatdelimitedproperty_sql
withtablehint_sql
indextablehint_sql
historicaldata_sql
table_parts
table_sql
tablesample_sql
pivot_sql
version_sql
tuple_sql
update_sql
values_sql
var_sql
into_sql
from_sql
group_sql
having_sql
connect_sql
prior_sql
join_sql
lambda_sql
lateral_op
lateral_sql
limit_sql
offset_sql
setitem_sql
set_sql
pragma_sql
lock_sql
literal_sql
escape_str
loaddata_sql
null_sql
boolean_sql
order_sql
withfill_sql
cluster_sql
distribute_sql
sort_sql
ordered_sql
matchrecognizemeasure_sql
matchrecognize_sql
query_modifiers
options_modifier
queryoption_sql
offset_limit_modifiers
select_sql
schema_sql
schema_columns_sql
star_sql
parameter_sql
sessionparameter_sql
subquery_sql
qualify_sql
set_operations
union_sql
union_op
unnest_sql
where_sql
window_sql
partition_by_sql
windowspec_sql
withingroup_sql
between_sql
bracket_offset_expressions
bracket_sql
all_sql
any_sql
exists_sql
case_sql
constraint_sql
nextvaluefor_sql
extract_sql
trim_sql
convert_concat_args
concat_sql
concatws_sql
check_sql
foreignkey_sql
primarykey_sql
if_sql
matchagainst_sql
jsonkeyvalue_sql
jsonpath_sql
json_path_part
formatjson_sql
jsonobject_sql
jsonobjectagg_sql
jsonarray_sql
jsonarrayagg_sql
jsoncolumndef_sql
jsonschema_sql
jsontable_sql
openjsoncolumndef_sql
openjson_sql
in_sql
in_unnest_op
interval_sql
return_sql
reference_sql
anonymous_sql
paren_sql
neg_sql
not_sql
alias_sql
pivotalias_sql
aliases_sql
atindex_sql
attimezone_sql
fromtimezone_sql
add_sql
and_sql
or_sql
xor_sql
connector_sql
bitwiseand_sql
bitwiseleftshift_sql
bitwisenot_sql
bitwiseor_sql
bitwiserightshift_sql
bitwisexor_sql
currentdate_sql
collate_sql
command_sql
comment_sql
mergetreettlaction_sql
mergetreettl_sql
transaction_sql
commit_sql
rollback_sql
altercolumn_sql
alterdiststyle_sql
altersortkey_sql
renametable_sql
renamecolumn_sql
alterset_sql
alter_sql
add_column_sql
droppartition_sql
addconstraint_sql
distinct_sql
ignorenulls_sql
respectnulls_sql
havingmax_sql
intdiv_sql
dpipe_sql
div_sql
overlaps_sql
distance_sql
dot_sql
propertyeq_sql
escape_sql
glob_sql
gt_sql
gte_sql
ilike_sql
ilikeany_sql
is_sql
like_sql
likeany_sql
similarto_sql
lt_sql
lte_sql
mod_sql
mul_sql
nullsafeeq_sql
nullsafeneq_sql
slice_sql
sub_sql
try_sql
log_sql
use_sql
binary
function_fallback_sql
func
format_args
too_wide
format_time
expressions
op_expressions
naked_property
tag_sql
token_sql
userdefinedfunction_sql
joinhint_sql
kwarg_sql
when_sql
merge_sql
tochar_sql
tonumber_sql
dictproperty_sql
dictrange_sql
dictsubproperty_sql
clusteredbyproperty_sql
anyvalue_sql
querytransform_sql
indexconstraintoption_sql
checkcolumnconstraint_sql
nvl2_sql
comprehension_sql
columnprefix_sql
opclass_sql
predict_sql
forin_sql
refresh_sql
operator_sql
toarray_sql
tsordstotime_sql
tsordstotimestamp_sql
tsordstodate_sql
unixdate_sql
lastday_sql
dateadd_sql
arrayany_sql
struct_sql
partitionrange_sql
truncatetable_sql
convert_sql
copyparameter_sql
credentials_sql
copy_sql
semicolon_sql
datadeletionproperty_sql
maskingpolicycolumnconstraint_sql
gapfill_sql
scope_resolution
scoperesolution_sql
parsejson_sql
rand_sql
changes_sql
pad_sql
summarize_sql
explodinggenerateseries_sql
arrayconcat_sql
converttimezone_sql