Edit on GitHub

# sqlglot.dialects.clickhouse

View Source

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

DATEΤΙΜΕ_DELTA = typing.Union[sqlglot.expressions.DateAdd, sqlglot.expressions.DateDiff, sqlglot.expressions.DateSub, sqlglot.expressions.TimestampSub, sqlglot.expressions.TimestampAdd]
class ClickHouse(sqlglot.dialects.dialect.Dialect): View Source

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

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

##### Inherited Members

sqlglot.dialects.dialect.Dialect
  Dialect
  INDEX_OFFSET
  WEEK_OFFSET
  UNNEST_COLUMN_ONLY
  ALIAS_POST_TABLESAMPLE
  TABLESAMPLE_SIZE_IS_PERCENT
  NORMALIZATION_STRATEGY
  IDENTIFIERS_CAN_START_WITH_DIGIT
  DPIPE_IS_STRING_CONCAT
  STRICT_STRING_CONCAT
  SUPPORTS_SEMI_ANTI_JOIN
  COPY_PARAMS_ARE_CSV
  TYPED_DIVISION
  CONCAT_COALESCE
  HEX_LOWERCASE
  DATE_FORMAT
  DATEINT_FORMAT
  TIME_FORMAT
  TIME_MAPPING
  FORMAT_MAPPING
  PSEUDOCOLUMNS
  PREFER_CTE_ALIAS_COLUMN
  EXPAND_ALIAS_REFS_EARLY_ONLY_IN_GROUP_BY
  SUPPORTS_ORDER_BY_ALL
  DATE_PART_MAPPING
  get_or_raise
  format_time
  settings
  normalize_identifier
  case_sensitive
  can_identify
  quote_identifier
  to_json_path
  parse
  parse_into
  generate
  transpile
  tokenize
  tokenizer
  jsonpath_tokenizer
  parser
  generator

class ClickHouse.Tokenizer(sqlglot.tokens.Tokenizer): View Source

    112    class Tokenizer(tokens.Tokenizer):
    113        COMMENTS = ["--", "#", "#!", ("/*", "*/")]
    114        IDENTIFIERS = ['"', "`"]
    115        STRING_ESCAPES = ["'", "\\"]
    116        BIT_STRINGS = [("0b", "")]
    117        HEX_STRINGS = [("0x", ""), ("0X", "")]
    118        HEREDOC_STRINGS = ["$"]
    119
    120        KEYWORDS = {
    121            **tokens.Tokenizer.KEYWORDS,
    122            "ATTACH": TokenType.COMMAND,
    123            "DATE32": TokenType.DATE32,
    124            "DATETIME64": TokenType.DATETIME64,
    125            "DICTIONARY": TokenType.DICTIONARY,
    126            "ENUM8": TokenType.ENUM8,
    127            "ENUM16": TokenType.ENUM16,
    128            "FINAL": TokenType.FINAL,
    129            "FIXEDSTRING": TokenType.FIXEDSTRING,
    130            "FLOAT32": TokenType.FLOAT,
    131            "FLOAT64": TokenType.DOUBLE,
    132            "GLOBAL": TokenType.GLOBAL,
    133            "INT256": TokenType.INT256,
    134            "LOWCARDINALITY": TokenType.LOWCARDINALITY,
    135            "MAP": TokenType.MAP,
    136            "NESTED": TokenType.NESTED,
    137            "SAMPLE": TokenType.TABLE_SAMPLE,
    138            "TUPLE": TokenType.STRUCT,
    139            "UINT128": TokenType.UINT128,
    140            "UINT16": TokenType.USMALLINT,
    141            "UINT256": TokenType.UINT256,
    142            "UINT32": TokenType.UINT,
    143            "UINT64": TokenType.UBIGINT,
    144            "UINT8": TokenType.UTINYINT,
    145            "IPV4": TokenType.IPV4,
    146            "IPV6": TokenType.IPV6,
    147            "AGGREGATEFUNCTION": TokenType.AGGREGATEFUNCTION,
    148            "SIMPLEAGGREGATEFUNCTION": TokenType.SIMPLEAGGREGATEFUNCTION,
    149            "SYSTEM": TokenType.COMMAND,
    150            "PREWHERE": TokenType.PREWHERE,
    151        }
    152        KEYWORDS.pop("/*+")
    153
    154        SINGLE_TOKENS = {
    155            **tokens.Tokenizer.SINGLE_TOKENS,
    156            "$": TokenType.HEREDOC_STRING,
    157        }

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'>, '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'>}

##### Inherited Members

sqlglot.tokens.Tokenizer
  Tokenizer
  BYTE_STRINGS
  RAW_STRINGS
  UNICODE_STRINGS
  IDENTIFIER_ESCAPES
  QUOTES
  VAR_SINGLE_TOKENS
  HEREDOC_TAG_IS_IDENTIFIER
  HEREDOC_STRING_ALTERNATIVE
  STRING_ESCAPES_ALLOWED_IN_RAW_STRINGS
  WHITE_SPACE
  COMMANDS
  COMMAND_PREFIX_TOKENS
  NUMERIC_LITERALS
  dialect
  reset
  tokenize
  tokenize_rs
  size
  sql
  tokens

class ClickHouse.Parser(sqlglot.parser.Parser): View Source

    159    class Parser(parser.Parser):
    160        # Tested in ClickHouse's playground, it seems that the following two queries do the same thing
    161        # * select x from t1 union all select x from t2 limit 1;
    162        # * select x from t1 union all (select x from t2 limit 1);
    163        MODIFIERS_ATTACHED_TO_SET_OP = False
    164        INTERVAL_SPANS = False
    165
    166        FUNCTIONS = {
    167            **parser.Parser.FUNCTIONS,
    168            "ANY": exp.AnyValue.from_arg_list,
    169            "ARRAYSUM": exp.ArraySum.from_arg_list,
    170            "COUNTIF": _build_count_if,
    171            "DATE_ADD": build_date_delta(exp.DateAdd, default_unit=None),
    172            "DATEADD": build_date_delta(exp.DateAdd, default_unit=None),
    173            "DATE_DIFF": build_date_delta(exp.DateDiff, default_unit=None),
    174            "DATEDIFF": build_date_delta(exp.DateDiff, default_unit=None),
    175            "DATE_FORMAT": _build_date_format,
    176            "DATE_SUB": build_date_delta(exp.DateSub, default_unit=None),
    177            "DATESUB": build_date_delta(exp.DateSub, default_unit=None),
    178            "FORMATDATETIME": _build_date_format,
    179            "JSONEXTRACTSTRING": build_json_extract_path(
    180                exp.JSONExtractScalar, zero_based_indexing=False
    181            ),
    182            "MAP": parser.build_var_map,
    183            "MATCH": exp.RegexpLike.from_arg_list,
    184            "RANDCANONICAL": exp.Rand.from_arg_list,
    185            "TUPLE": exp.Struct.from_arg_list,
    186            "TIMESTAMP_SUB": build_date_delta(exp.TimestampSub, default_unit=None),
    187            "TIMESTAMPSUB": build_date_delta(exp.TimestampSub, default_unit=None),
    188            "TIMESTAMP_ADD": build_date_delta(exp.TimestampAdd, default_unit=None),
    189            "TIMESTAMPADD": build_date_delta(exp.TimestampAdd, default_unit=None),
    190            "UNIQ": exp.ApproxDistinct.from_arg_list,
    191            "XOR": lambda args: exp.Xor(expressions=args),
    192            "MD5": exp.MD5Digest.from_arg_list,
    193            "SHA256": lambda args: exp.SHA2(this=seq_get(args, 0), length=exp.Literal.number(256)),
    194            "SHA512": lambda args: exp.SHA2(this=seq_get(args, 0), length=exp.Literal.number(512)),
    195        }
    196
    197        AGG_FUNCTIONS = {
    198            "count",
    199            "min",
    200            "max",
    201            "sum",
    202            "avg",
    203            "any",
    204            "stddevPop",
    205            "stddevSamp",
    206            "varPop",
    207            "varSamp",
    208            "corr",
    209            "covarPop",
    210            "covarSamp",
    211            "entropy",
    212            "exponentialMovingAverage",
    213            "intervalLengthSum",
    214            "kolmogorovSmirnovTest",
    215            "mannWhitneyUTest",
    216            "median",
    217            "rankCorr",
    218            "sumKahan",
    219            "studentTTest",
    220            "welchTTest",
    221            "anyHeavy",
    222            "anyLast",
    223            "boundingRatio",
    224            "first_value",
    225            "last_value",
    226            "argMin",
    227            "argMax",
    228            "avgWeighted",
    229            "topK",
    230            "topKWeighted",
    231            "deltaSum",
    232            "deltaSumTimestamp",
    233            "groupArray",
    234            "groupArrayLast",
    235            "groupUniqArray",
    236            "groupArrayInsertAt",
    237            "groupArrayMovingAvg",
    238            "groupArrayMovingSum",
    239            "groupArraySample",
    240            "groupBitAnd",
    241            "groupBitOr",
    242            "groupBitXor",
    243            "groupBitmap",
    244            "groupBitmapAnd",
    245            "groupBitmapOr",
    246            "groupBitmapXor",
    247            "sumWithOverflow",
    248            "sumMap",
    249            "minMap",
    250            "maxMap",
    251            "skewSamp",
    252            "skewPop",
    253            "kurtSamp",
    254            "kurtPop",
    255            "uniq",
    256            "uniqExact",
    257            "uniqCombined",
    258            "uniqCombined64",
    259            "uniqHLL12",
    260            "uniqTheta",
    261            "quantile",
    262            "quantiles",
    263            "quantileExact",
    264            "quantilesExact",
    265            "quantileExactLow",
    266            "quantilesExactLow",
    267            "quantileExactHigh",
    268            "quantilesExactHigh",
    269            "quantileExactWeighted",
    270            "quantilesExactWeighted",
    271            "quantileTiming",
    272            "quantilesTiming",
    273            "quantileTimingWeighted",
    274            "quantilesTimingWeighted",
    275            "quantileDeterministic",
    276            "quantilesDeterministic",
    277            "quantileTDigest",
    278            "quantilesTDigest",
    279            "quantileTDigestWeighted",
    280            "quantilesTDigestWeighted",
    281            "quantileBFloat16",
    282            "quantilesBFloat16",
    283            "quantileBFloat16Weighted",
    284            "quantilesBFloat16Weighted",
    285            "simpleLinearRegression",
    286            "stochasticLinearRegression",
    287            "stochasticLogisticRegression",
    288            "categoricalInformationValue",
    289            "contingency",
    290            "cramersV",
    291            "cramersVBiasCorrected",
    292            "theilsU",
    293            "maxIntersections",
    294            "maxIntersectionsPosition",
    295            "meanZTest",
    296            "quantileInterpolatedWeighted",
    297            "quantilesInterpolatedWeighted",
    298            "quantileGK",
    299            "quantilesGK",
    300            "sparkBar",
    301            "sumCount",
    302            "largestTriangleThreeBuckets",
    303            "histogram",
    304            "sequenceMatch",
    305            "sequenceCount",
    306            "windowFunnel",
    307            "retention",
    308            "uniqUpTo",
    309            "sequenceNextNode",
    310            "exponentialTimeDecayedAvg",
    311        }
    312
    313        AGG_FUNCTIONS_SUFFIXES = [
    314            "If",
    315            "Array",
    316            "ArrayIf",
    317            "Map",
    318            "SimpleState",
    319            "State",
    320            "Merge",
    321            "MergeState",
    322            "ForEach",
    323            "Distinct",
    324            "OrDefault",
    325            "OrNull",
    326            "Resample",
    327            "ArgMin",
    328            "ArgMax",
    329        ]
    330
    331        FUNC_TOKENS = {
    332            *parser.Parser.FUNC_TOKENS,
    333            TokenType.SET,
    334        }
    335
    336        RESERVED_TOKENS = parser.Parser.RESERVED_TOKENS - {TokenType.SELECT}
    337
    338        AGG_FUNC_MAPPING = (
    339            lambda functions, suffixes: {
    340                f"{f}{sfx}": (f, sfx) for sfx in (suffixes + [""]) for f in functions
    341            }
    342        )(AGG_FUNCTIONS, AGG_FUNCTIONS_SUFFIXES)
    343
    344        FUNCTIONS_WITH_ALIASED_ARGS = {*parser.Parser.FUNCTIONS_WITH_ALIASED_ARGS, "TUPLE"}
    345
    346        FUNCTION_PARSERS = {
    347            **parser.Parser.FUNCTION_PARSERS,
    348            "ARRAYJOIN": lambda self: self.expression(exp.Explode, this=self._parse_expression()),
    349            "QUANTILE": lambda self: self._parse_quantile(),
    350        }
    351
    352        FUNCTION_PARSERS.pop("MATCH")
    353
    354        NO_PAREN_FUNCTION_PARSERS = parser.Parser.NO_PAREN_FUNCTION_PARSERS.copy()
    355        NO_PAREN_FUNCTION_PARSERS.pop("ANY")
    356
    357        RANGE_PARSERS = {
    358            **parser.Parser.RANGE_PARSERS,
    359            TokenType.GLOBAL: lambda self, this: self._match(TokenType.IN)
    360            and self._parse_in(this, is_global=True),
    361        }
    362
    363        # The PLACEHOLDER entry is popped because 1) it doesn't affect Clickhouse (it corresponds to
    364        # the postgres-specific JSONBContains parser) and 2) it makes parsing the ternary op simpler.
    365        COLUMN_OPERATORS = parser.Parser.COLUMN_OPERATORS.copy()
    366        COLUMN_OPERATORS.pop(TokenType.PLACEHOLDER)
    367
    368        JOIN_KINDS = {
    369            *parser.Parser.JOIN_KINDS,
    370            TokenType.ANY,
    371            TokenType.ASOF,
    372            TokenType.ARRAY,
    373        }
    374
    375        TABLE_ALIAS_TOKENS = parser.Parser.TABLE_ALIAS_TOKENS - {
    376            TokenType.ANY,
    377            TokenType.ARRAY,
    378            TokenType.FINAL,
    379            TokenType.FORMAT,
    380            TokenType.SETTINGS,
    381        }
    382
    383        ALIAS_TOKENS = parser.Parser.ALIAS_TOKENS - {
    384            TokenType.FORMAT,
    385        }
    386
    387        LOG_DEFAULTS_TO_LN = True
    388
    389        QUERY_MODIFIER_PARSERS = {
    390            **parser.Parser.QUERY_MODIFIER_PARSERS,
    391            TokenType.SETTINGS: lambda self: (
    392                "settings",
    393                self._advance() or self._parse_csv(self._parse_assignment),
    394            ),
    395            TokenType.FORMAT: lambda self: ("format", self._advance() or self._parse_id_var()),
    396        }
    397
    398        CONSTRAINT_PARSERS = {
    399            **parser.Parser.CONSTRAINT_PARSERS,
    400            "INDEX": lambda self: self._parse_index_constraint(),
    401            "CODEC": lambda self: self._parse_compress(),
    402        }
    403
    404        ALTER_PARSERS = {
    405            **parser.Parser.ALTER_PARSERS,
    406            "REPLACE": lambda self: self._parse_alter_table_replace(),
    407        }
    408
    409        SCHEMA_UNNAMED_CONSTRAINTS = {
    410            *parser.Parser.SCHEMA_UNNAMED_CONSTRAINTS,
    411            "INDEX",
    412        }
    413
    414        def _parse_extract(self) -> exp.Extract | exp.Anonymous:
    415            index = self._index
    416            this = self._parse_bitwise()
    417            if self._match(TokenType.FROM):
    418                self._retreat(index)
    419                return super()._parse_extract()
    420
    421            # We return Anonymous here because extract and regexpExtract have different semantics,
    422            # so parsing extract(foo, bar) into RegexpExtract can potentially break queries. E.g.,
    423            # `extract('foobar', 'b')` works, but CH crashes for `regexpExtract('foobar', 'b')`.
    424            #
    425            # TODO: can we somehow convert the former into an equivalent `regexpExtract` call?
    426            self._match(TokenType.COMMA)
    427            return self.expression(
    428                exp.Anonymous, this="extract", expressions=[this, self._parse_bitwise()]
    429            )
    430
    431        def _parse_assignment(self) -> t.Optional[exp.Expression]:
    432            this = super()._parse_assignment()
    433
    434            if self._match(TokenType.PLACEHOLDER):
    435                return self.expression(
    436                    exp.If,
    437                    this=this,
    438                    true=self._parse_assignment(),
    439                    false=self._match(TokenType.COLON) and self._parse_assignment(),
    440                )
    441
    442            return this
    443
    444        def _parse_placeholder(self) -> t.Optional[exp.Expression]:
    445            """
    446            Parse a placeholder expression like SELECT {abc: UInt32} or FROM {table: Identifier}
    447            https://clickhouse.com/docs/en/sql-reference/syntax#defining-and-using-query-parameters
    448            """
    449            if not self._match(TokenType.L_BRACE):
    450                return None
    451
    452            this = self._parse_id_var()
    453            self._match(TokenType.COLON)
    454            kind = self._parse_types(check_func=False, allow_identifiers=False) or (
    455                self._match_text_seq("IDENTIFIER") and "Identifier"
    456            )
    457
    458            if not kind:
    459                self.raise_error("Expecting a placeholder type or 'Identifier' for tables")
    460            elif not self._match(TokenType.R_BRACE):
    461                self.raise_error("Expecting }")
    462
    463            return self.expression(exp.Placeholder, this=this, kind=kind)
    464
    465        def _parse_in(self, this: t.Optional[exp.Expression], is_global: bool = False) -> exp.In:
    466            this = super()._parse_in(this)
    467            this.set("is_global", is_global)
    468            return this
    469
    470        def _parse_table(
    471            self,
    472            schema: bool = False,
    473            joins: bool = False,
    474            alias_tokens: t.Optional[t.Collection[TokenType]] = None,
    475            parse_bracket: bool = False,
    476            is_db_reference: bool = False,
    477            parse_partition: bool = False,
    478        ) -> t.Optional[exp.Expression]:
    479            this = super()._parse_table(
    480                schema=schema,
    481                joins=joins,
    482                alias_tokens=alias_tokens,
    483                parse_bracket=parse_bracket,
    484                is_db_reference=is_db_reference,
    485            )
    486
    487            if self._match(TokenType.FINAL):
    488                this = self.expression(exp.Final, this=this)
    489
    490            return this
    491
    492        def _parse_position(self, haystack_first: bool = False) -> exp.StrPosition:
    493            return super()._parse_position(haystack_first=True)
    494
    495        # https://clickhouse.com/docs/en/sql-reference/statements/select/with/
    496        def _parse_cte(self) -> exp.CTE:
    497            # WITH <identifier> AS <subquery expression>
    498            cte: t.Optional[exp.CTE] = self._try_parse(super()._parse_cte)
    499
    500            if not cte:
    501                # WITH <expression> AS <identifier>
    502                cte = self.expression(
    503                    exp.CTE,
    504                    this=self._parse_assignment(),
    505                    alias=self._parse_table_alias(),
    506                    scalar=True,
    507                )
    508
    509            return cte
    510
    511        def _parse_join_parts(
    512            self,
    513        ) -> t.Tuple[t.Optional[Token], t.Optional[Token], t.Optional[Token]]:
    514            is_global = self._match(TokenType.GLOBAL) and self._prev
    515            kind_pre = self._match_set(self.JOIN_KINDS, advance=False) and self._prev
    516
    517            if kind_pre:
    518                kind = self._match_set(self.JOIN_KINDS) and self._prev
    519                side = self._match_set(self.JOIN_SIDES) and self._prev
    520                return is_global, side, kind
    521
    522            return (
    523                is_global,
    524                self._match_set(self.JOIN_SIDES) and self._prev,
    525                self._match_set(self.JOIN_KINDS) and self._prev,
    526            )
    527
    528        def _parse_join(
    529            self, skip_join_token: bool = False, parse_bracket: bool = False
    530        ) -> t.Optional[exp.Join]:
    531            join = super()._parse_join(skip_join_token=skip_join_token, parse_bracket=True)
    532            if join:
    533                join.set("global", join.args.pop("method", None))
    534
    535            return join
    536
    537        def _parse_function(
    538            self,
    539            functions: t.Optional[t.Dict[str, t.Callable]] = None,
    540            anonymous: bool = False,
    541            optional_parens: bool = True,
    542            any_token: bool = False,
    543        ) -> t.Optional[exp.Expression]:
    544            expr = super()._parse_function(
    545                functions=functions,
    546                anonymous=anonymous,
    547                optional_parens=optional_parens,
    548                any_token=any_token,
    549            )
    550
    551            func = expr.this if isinstance(expr, exp.Window) else expr
    552
    553            # Aggregate functions can be split in 2 parts: <func_name><suffix>
    554            parts = (
    555                self.AGG_FUNC_MAPPING.get(func.this) if isinstance(func, exp.Anonymous) else None
    556            )
    557
    558            if parts:
    559                params = self._parse_func_params(func)
    560
    561                kwargs = {
    562                    "this": func.this,
    563                    "expressions": func.expressions,
    564                }
    565                if parts[1]:
    566                    kwargs["parts"] = parts
    567                    exp_class = exp.CombinedParameterizedAgg if params else exp.CombinedAggFunc
    568                else:
    569                    exp_class = exp.ParameterizedAgg if params else exp.AnonymousAggFunc
    570
    571                kwargs["exp_class"] = exp_class
    572                if params:
    573                    kwargs["params"] = params
    574
    575                func = self.expression(**kwargs)
    576
    577                if isinstance(expr, exp.Window):
    578                    # The window's func was parsed as Anonymous in base parser, fix its
    579                    # type to be CH style CombinedAnonymousAggFunc / AnonymousAggFunc
    580                    expr.set("this", func)
    581                elif params:
    582                    # Params have blocked super()._parse_function() from parsing the following window
    583                    # (if that exists) as they're standing between the function call and the window spec
    584                    expr = self._parse_window(func)
    585                else:
    586                    expr = func
    587
    588            return expr
    589
    590        def _parse_func_params(
    591            self, this: t.Optional[exp.Func] = None
    592        ) -> t.Optional[t.List[exp.Expression]]:
    593            if self._match_pair(TokenType.R_PAREN, TokenType.L_PAREN):
    594                return self._parse_csv(self._parse_lambda)
    595
    596            if self._match(TokenType.L_PAREN):
    597                params = self._parse_csv(self._parse_lambda)
    598                self._match_r_paren(this)
    599                return params
    600
    601            return None
    602
    603        def _parse_quantile(self) -> exp.Quantile:
    604            this = self._parse_lambda()
    605            params = self._parse_func_params()
    606            if params:
    607                return self.expression(exp.Quantile, this=params[0], quantile=this)
    608            return self.expression(exp.Quantile, this=this, quantile=exp.Literal.number(0.5))
    609
    610        def _parse_wrapped_id_vars(self, optional: bool = False) -> t.List[exp.Expression]:
    611            return super()._parse_wrapped_id_vars(optional=True)
    612
    613        def _parse_primary_key(
    614            self, wrapped_optional: bool = False, in_props: bool = False
    615        ) -> exp.PrimaryKeyColumnConstraint | exp.PrimaryKey:
    616            return super()._parse_primary_key(
    617                wrapped_optional=wrapped_optional or in_props, in_props=in_props
    618            )
    619
    620        def _parse_on_property(self) -> t.Optional[exp.Expression]:
    621            index = self._index
    622            if self._match_text_seq("CLUSTER"):
    623                this = self._parse_id_var()
    624                if this:
    625                    return self.expression(exp.OnCluster, this=this)
    626                else:
    627                    self._retreat(index)
    628            return None
    629
    630        def _parse_index_constraint(
    631            self, kind: t.Optional[str] = None
    632        ) -> exp.IndexColumnConstraint:
    633            # INDEX name1 expr TYPE type1(args) GRANULARITY value
    634            this = self._parse_id_var()
    635            expression = self._parse_assignment()
    636
    637            index_type = self._match_text_seq("TYPE") and (
    638                self._parse_function() or self._parse_var()
    639            )
    640
    641            granularity = self._match_text_seq("GRANULARITY") and self._parse_term()
    642
    643            return self.expression(
    644                exp.IndexColumnConstraint,
    645                this=this,
    646                expression=expression,
    647                index_type=index_type,
    648                granularity=granularity,
    649            )
    650
    651        def _parse_partition(self) -> t.Optional[exp.Partition]:
    652            # https://clickhouse.com/docs/en/sql-reference/statements/alter/partition#how-to-set-partition-expression
    653            if not self._match(TokenType.PARTITION):
    654                return None
    655
    656            if self._match_text_seq("ID"):
    657                # Corresponds to the PARTITION ID <string_value> syntax
    658                expressions: t.List[exp.Expression] = [
    659                    self.expression(exp.PartitionId, this=self._parse_string())
    660                ]
    661            else:
    662                expressions = self._parse_expressions()
    663
    664            return self.expression(exp.Partition, expressions=expressions)
    665
    666        def _parse_alter_table_replace(self) -> t.Optional[exp.Expression]:
    667            partition = self._parse_partition()
    668
    669            if not partition or not self._match(TokenType.FROM):
    670                return None
    671
    672            return self.expression(
    673                exp.ReplacePartition, expression=partition, source=self._parse_table_parts()
    674            )
    675
    676        def _parse_projection_def(self) -> t.Optional[exp.ProjectionDef]:
    677            if not self._match_text_seq("PROJECTION"):
    678                return None
    679
    680            return self.expression(
    681                exp.ProjectionDef,
    682                this=self._parse_id_var(),
    683                expression=self._parse_wrapped(self._parse_statement),
    684            )
    685
    686        def _parse_constraint(self) -> t.Optional[exp.Expression]:
    687            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': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Array'>>, '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'>>, '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'>>, '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': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GenerateDateArray'>>, 'GENERATE_SERIES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GenerateSeries'>>, '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'>>, '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'>>, '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': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrToDate'>>, '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 = {'kolmogorovSmirnovTest', 'varSamp', 'corr', 'quantileBFloat16', 'avgWeighted', 'sequenceNextNode', 'avg', 'uniqCombined64', 'quantile', 'mannWhitneyUTest', 'groupUniqArray', 'intervalLengthSum', 'rankCorr', 'quantileExactWeighted', 'stochasticLinearRegression', 'groupBitmapOr', 'groupArrayMovingAvg', 'cramersV', 'max', 'kurtPop', 'groupArray', 'uniqUpTo', 'quantileExactLow', 'groupBitOr', 'exponentialMovingAverage', 'entropy', 'min', 'quantileExact', 'histogram', 'quantilesTimingWeighted', 'retention', 'maxMap', 'boundingRatio', 'sumCount', 'deltaSum', 'quantilesTiming', 'sumKahan', 'maxIntersections', 'quantilesInterpolatedWeighted', 'quantileInterpolatedWeighted', 'uniq', 'quantileExactHigh', 'groupBitAnd', 'covarSamp', 'quantilesDeterministic', 'topK', 'simpleLinearRegression', 'median', 'topKWeighted', 'quantileBFloat16Weighted', 'quantilesGK', 'argMin', 'quantilesBFloat16Weighted', 'quantilesBFloat16', 'skewSamp', 'varPop', 'quantilesExactLow', 'categoricalInformationValue', 'quantileTiming', 'deltaSumTimestamp', 'quantiles', 'contingency', 'quantilesTDigestWeighted', 'argMax', 'anyHeavy', 'meanZTest', 'quantileGK', 'maxIntersectionsPosition', 'studentTTest', 'quantilesExactWeighted', 'quantileTDigest', 'covarPop', 'groupBitmapXor', 'theilsU', 'any', 'last_value', 'quantileTimingWeighted', 'skewPop', 'stochasticLogisticRegression', 'sumWithOverflow', 'cramersVBiasCorrected', 'groupBitXor', 'count', 'sumMap', 'groupBitmap', 'stddevSamp', 'uniqHLL12', 'largestTriangleThreeBuckets', 'minMap', 'sparkBar', 'stddevPop', 'sequenceMatch', 'kurtSamp', 'anyLast', 'groupArrayInsertAt', 'uniqCombined', 'uniqTheta', 'welchTTest', 'groupBitmapAnd', 'sum', 'quantilesExactHigh', 'first_value', 'exponentialTimeDecayedAvg', 'quantilesExact', 'uniqExact', 'groupArraySample', 'quantileTDigestWeighted', 'windowFunnel', 'quantileDeterministic', 'sequenceCount', 'quantilesTDigest', 'groupArrayLast', 'groupArrayMovingSum'}
AGG_FUNCTIONS_SUFFIXES = ['If', 'Array', 'ArrayIf', 'Map', 'SimpleState', 'State', 'Merge', 'MergeState', 'ForEach', 'Distinct', 'OrDefault', 'OrNull', 'Resample', 'ArgMin', 'ArgMax']
FUNC_TOKENS = {<TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.TIME: 'TIME'>, <TokenType.MONEY: 'MONEY'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.UINT128: 'UINT128'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.UUID: 'UUID'>, <TokenType.SOME: 'SOME'>, <TokenType.RIGHT: 'RIGHT'>, <TokenType.XOR: 'XOR'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.INET: 'INET'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.LIST: 'LIST'>, <TokenType.FILTER: 'FILTER'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.INT128: 'INT128'>, <TokenType.SET: 'SET'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.ANY: 'ANY'>, <TokenType.ROW: 'ROW'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.DATE32: 'DATE32'>, <TokenType.GLOB: 'GLOB'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.FORMAT: 'FORMAT'>, <TokenType.NESTED: 'NESTED'>, <TokenType.LIKE: 'LIKE'>, <TokenType.UINT256: 'UINT256'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.MAP: 'MAP'>, <TokenType.DATE: 'DATE'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.INT: 'INT'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.XML: 'XML'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.JSON: 'JSON'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.INDEX: 'INDEX'>, <TokenType.ILIKE: 'ILIKE'>, <TokenType.YEAR: 'YEAR'>, <TokenType.RLIKE: 'RLIKE'>, <TokenType.SUPER: 'SUPER'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.IPV6: 'IPV6'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.NULL: 'NULL'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.ENUM: 'ENUM'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.TEXT: 'TEXT'>, <TokenType.WINDOW: 'WINDOW'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.BINARY: 'BINARY'>, <TokenType.INT256: 'INT256'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.MERGE: 'MERGE'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.TABLE: 'TABLE'>, <TokenType.UNIQUEIDENTIFIER: 'UNIQUEIDENTIFIER'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.ALL: 'ALL'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.VAR: 'VAR'>, <TokenType.NAME: 'NAME'>, <TokenType.JSONB: 'JSONB'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.UINT: 'UINT'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.RANGE: 'RANGE'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.PRIMARY_KEY: 'PRIMARY_KEY'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.CHAR: 'CHAR'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.INSERT: 'INSERT'>, <TokenType.FIRST: 'FIRST'>, <TokenType.BIT: 'BIT'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.LEFT: 'LEFT'>, <TokenType.IPV4: 'IPV4'>}
RESERVED_TOKENS = {<TokenType.STAR: 'STAR'>, <TokenType.L_BRACKET: 'L_BRACKET'>, <TokenType.R_PAREN: 'R_PAREN'>, <TokenType.SLASH: 'SLASH'>, <TokenType.L_PAREN: 'L_PAREN'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.BACKSLASH: 'BACKSLASH'>, <TokenType.L_BRACE: 'L_BRACE'>, <TokenType.COMMA: 'COMMA'>, <TokenType.R_BRACE: 'R_BRACE'>, <TokenType.LT: 'LT'>, <TokenType.DOT: 'DOT'>, <TokenType.HASH: 'HASH'>, <TokenType.CARET: 'CARET'>, <TokenType.SEMICOLON: 'SEMICOLON'>, <TokenType.PLUS: 'PLUS'>, <TokenType.R_BRACKET: 'R_BRACKET'>, <TokenType.DASH: 'DASH'>, <TokenType.EQ: 'EQ'>, <TokenType.TILDA: 'TILDA'>, <TokenType.PLACEHOLDER: 'PLACEHOLDER'>, <TokenType.MOD: 'MOD'>, <TokenType.AMP: 'AMP'>, <TokenType.GT: 'GT'>, <TokenType.COLON: 'COLON'>, <TokenType.NOT: 'NOT'>, <TokenType.PIPE: 'PIPE'>, <TokenType.PARAMETER: 'PARAMETER'>}
AGG_FUNC_MAPPING = {'kolmogorovSmirnovTestIf': ('kolmogorovSmirnovTest', 'If'), 'varSampIf': ('varSamp', 'If'), 'corrIf': ('corr', 'If'), 'quantileBFloat16If': ('quantileBFloat16', 'If'), 'avgWeightedIf': ('avgWeighted', 'If'), 'sequenceNextNodeIf': ('sequenceNextNode', 'If'), 'avgIf': ('avg', 'If'), 'uniqCombined64If': ('uniqCombined64', 'If'), 'quantileIf': ('quantile', 'If'), 'mannWhitneyUTestIf': ('mannWhitneyUTest', 'If'), 'groupUniqArrayIf': ('groupUniqArray', 'If'), 'intervalLengthSumIf': ('intervalLengthSum', 'If'), 'rankCorrIf': ('rankCorr', 'If'), 'quantileExactWeightedIf': ('quantileExactWeighted', 'If'), 'stochasticLinearRegressionIf': ('stochasticLinearRegression', 'If'), 'groupBitmapOrIf': ('groupBitmapOr', 'If'), 'groupArrayMovingAvgIf': ('groupArrayMovingAvg', 'If'), 'cramersVIf': ('cramersV', 'If'), 'maxIf': ('max', 'If'), 'kurtPopIf': ('kurtPop', 'If'), 'groupArrayIf': ('groupArray', 'If'), 'uniqUpToIf': ('uniqUpTo', 'If'), 'quantileExactLowIf': ('quantileExactLow', 'If'), 'groupBitOrIf': ('groupBitOr', 'If'), 'exponentialMovingAverageIf': ('exponentialMovingAverage', 'If'), 'entropyIf': ('entropy', 'If'), 'minIf': ('min', 'If'), 'quantileExactIf': ('quantileExact', 'If'), 'histogramIf': ('histogram', 'If'), 'quantilesTimingWeightedIf': ('quantilesTimingWeighted', 'If'), 'retentionIf': ('retention', 'If'), 'maxMapIf': ('maxMap', 'If'), 'boundingRatioIf': ('boundingRatio', 'If'), 'sumCountIf': ('sumCount', 'If'), 'deltaSumIf': ('deltaSum', 'If'), 'quantilesTimingIf': ('quantilesTiming', 'If'), 'sumKahanIf': ('sumKahan', 'If'), 'maxIntersectionsIf': ('maxIntersections', 'If'), 'quantilesInterpolatedWeightedIf': ('quantilesInterpolatedWeighted', 'If'), 'quantileInterpolatedWeightedIf': ('quantileInterpolatedWeighted', 'If'), 'uniqIf': ('uniq', 'If'), 'quantileExactHighIf': ('quantileExactHigh', 'If'), 'groupBitAndIf': ('groupBitAnd', 'If'), 'covarSampIf': ('covarSamp', 'If'), 'quantilesDeterministicIf': ('quantilesDeterministic', 'If'), 'topKIf': ('topK', 'If'), 'simpleLinearRegressionIf': ('simpleLinearRegression', 'If'), 'medianIf': ('median', 'If'), 'topKWeightedIf': ('topKWeighted', 'If'), 'quantileBFloat16WeightedIf': ('quantileBFloat16Weighted', 'If'), 'quantilesGKIf': ('quantilesGK', 'If'), 'argMinIf': ('argMin', 'If'), 'quantilesBFloat16WeightedIf': ('quantilesBFloat16Weighted', 'If'), 'quantilesBFloat16If': ('quantilesBFloat16', 'If'), 'skewSampIf': ('skewSamp', 'If'), 'varPopIf': ('varPop', 'If'), 'quantilesExactLowIf': ('quantilesExactLow', 'If'), 'categoricalInformationValueIf': ('categoricalInformationValue', 'If'), 'quantileTimingIf': ('quantileTiming', 'If'), 'deltaSumTimestampIf': ('deltaSumTimestamp', 'If'), 'quantilesIf': ('quantiles', 'If'), 'contingencyIf': ('contingency', 'If'), 'quantilesTDigestWeightedIf': ('quantilesTDigestWeighted', 'If'), 'argMaxIf': ('argMax', 'If'), 'anyHeavyIf': ('anyHeavy', 'If'), 'meanZTestIf': ('meanZTest', 'If'), 'quantileGKIf': ('quantileGK', 'If'), 'maxIntersectionsPositionIf': ('maxIntersectionsPosition', 'If'), 'studentTTestIf': ('studentTTest', 'If'), 'quantilesExactWeightedIf': ('quantilesExactWeighted', 'If'), 'quantileTDigestIf': ('quantileTDigest', 'If'), 'covarPopIf': ('covarPop', 'If'), 'groupBitmapXorIf': ('groupBitmapXor', 'If'), 'theilsUIf': ('theilsU', 'If'), 'anyIf': ('any', 'If'), 'last_valueIf': ('last_value', 'If'), 'quantileTimingWeightedIf': ('quantileTimingWeighted', 'If'), 'skewPopIf': ('skewPop', 'If'), 'stochasticLogisticRegressionIf': ('stochasticLogisticRegression', 'If'), 'sumWithOverflowIf': ('sumWithOverflow', 'If'), 'cramersVBiasCorrectedIf': ('cramersVBiasCorrected', 'If'), 'groupBitXorIf': ('groupBitXor', 'If'), 'countIf': ('count', 'If'), 'sumMapIf': ('sumMap', 'If'), 'groupBitmapIf': ('groupBitmap', 'If'), 'stddevSampIf': ('stddevSamp', 'If'), 'uniqHLL12If': ('uniqHLL12', 'If'), 'largestTriangleThreeBucketsIf': ('largestTriangleThreeBuckets', 'If'), 'minMapIf': ('minMap', 'If'), 'sparkBarIf': ('sparkBar', 'If'), 'stddevPopIf': ('stddevPop', 'If'), 'sequenceMatchIf': ('sequenceMatch', 'If'), 'kurtSampIf': ('kurtSamp', 'If'), 'anyLastIf': ('anyLast', 'If'), 'groupArrayInsertAtIf': ('groupArrayInsertAt', 'If'), 'uniqCombinedIf': ('uniqCombined', 'If'), 'uniqThetaIf': ('uniqTheta', 'If'), 'welchTTestIf': ('welchTTest', 'If'), 'groupBitmapAndIf': ('groupBitmapAnd', 'If'), 'sumIf': ('sum', 'If'), 'quantilesExactHighIf': ('quantilesExactHigh', 'If'), 'first_valueIf': ('first_value', 'If'), 'exponentialTimeDecayedAvgIf': ('exponentialTimeDecayedAvg', 'If'), 'quantilesExactIf': ('quantilesExact', 'If'), 'uniqExactIf': ('uniqExact', 'If'), 'groupArraySampleIf': ('groupArraySample', 'If'), 'quantileTDigestWeightedIf': ('quantileTDigestWeighted', 'If'), 'windowFunnelIf': ('windowFunnel', 'If'), 'quantileDeterministicIf': ('quantileDeterministic', 'If'), 'sequenceCountIf': ('sequenceCount', 'If'), 'quantilesTDigestIf': ('quantilesTDigest', 'If'), 'groupArrayLastIf': ('groupArrayLast', 'If'), 'groupArrayMovingSumIf': ('groupArrayMovingSum', 'If'), 'kolmogorovSmirnovTestArray': ('kolmogorovSmirnovTest', 'Array'), 'varSampArray': ('varSamp', 'Array'), 'corrArray': ('corr', 'Array'), 'quantileBFloat16Array': ('quantileBFloat16', 'Array'), 'avgWeightedArray': ('avgWeighted', 'Array'), 'sequenceNextNodeArray': ('sequenceNextNode', 'Array'), 'avgArray': ('avg', 'Array'), 'uniqCombined64Array': ('uniqCombined64', 'Array'), 'quantileArray': ('quantile', 'Array'), 'mannWhitneyUTestArray': ('mannWhitneyUTest', 'Array'), 'groupUniqArrayArray': ('groupUniqArray', 'Array'), 'intervalLengthSumArray': ('intervalLengthSum', 'Array'), 'rankCorrArray': ('rankCorr', 'Array'), 'quantileExactWeightedArray': ('quantileExactWeighted', 'Array'), 'stochasticLinearRegressionArray': ('stochasticLinearRegression', 'Array'), 'groupBitmapOrArray': ('groupBitmapOr', 'Array'), 'groupArrayMovingAvgArray': ('groupArrayMovingAvg', 'Array'), 'cramersVArray': ('cramersV', 'Array'), 'maxArray': ('max', 'Array'), 'kurtPopArray': ('kurtPop', 'Array'), 'groupArrayArray': ('groupArray', 'Array'), 'uniqUpToArray': ('uniqUpTo', 'Array'), 'quantileExactLowArray': ('quantileExactLow', 'Array'), 'groupBitOrArray': ('groupBitOr', 'Array'), 'exponentialMovingAverageArray': ('exponentialMovingAverage', 'Array'), 'entropyArray': ('entropy', 'Array'), 'minArray': ('min', 'Array'), 'quantileExactArray': ('quantileExact', 'Array'), 'histogramArray': ('histogram', 'Array'), 'quantilesTimingWeightedArray': ('quantilesTimingWeighted', 'Array'), 'retentionArray': ('retention', 'Array'), 'maxMapArray': ('maxMap', 'Array'), 'boundingRatioArray': ('boundingRatio', 'Array'), 'sumCountArray': ('sumCount', 'Array'), 'deltaSumArray': ('deltaSum', 'Array'), 'quantilesTimingArray': ('quantilesTiming', 'Array'), 'sumKahanArray': ('sumKahan', 'Array'), 'maxIntersectionsArray': ('maxIntersections', 'Array'), 'quantilesInterpolatedWeightedArray': ('quantilesInterpolatedWeighted', 'Array'), 'quantileInterpolatedWeightedArray': ('quantileInterpolatedWeighted', 'Array'), 'uniqArray': ('uniq', 'Array'), 'quantileExactHighArray': ('quantileExactHigh', 'Array'), 'groupBitAndArray': ('groupBitAnd', 'Array'), 'covarSampArray': ('covarSamp', 'Array'), 'quantilesDeterministicArray': ('quantilesDeterministic', 'Array'), 'topKArray': ('topK', 'Array'), 'simpleLinearRegressionArray': ('simpleLinearRegression', 'Array'), 'medianArray': ('median', 'Array'), 'topKWeightedArray': ('topKWeighted', 'Array'), 'quantileBFloat16WeightedArray': ('quantileBFloat16Weighted', 'Array'), 'quantilesGKArray': ('quantilesGK', 'Array'), 'argMinArray': ('argMin', 'Array'), 'quantilesBFloat16WeightedArray': ('quantilesBFloat16Weighted', 'Array'), 'quantilesBFloat16Array': ('quantilesBFloat16', 'Array'), 'skewSampArray': ('skewSamp', 'Array'), 'varPopArray': ('varPop', 'Array'), 'quantilesExactLowArray': ('quantilesExactLow', 'Array'), 'categoricalInformationValueArray': ('categoricalInformationValue', 'Array'), 'quantileTimingArray': ('quantileTiming', 'Array'), 'deltaSumTimestampArray': ('deltaSumTimestamp', 'Array'), 'quantilesArray': ('quantiles', 'Array'), 'contingencyArray': ('contingency', 'Array'), 'quantilesTDigestWeightedArray': ('quantilesTDigestWeighted', 'Array'), 'argMaxArray': ('argMax', 'Array'), 'anyHeavyArray': ('anyHeavy', 'Array'), 'meanZTestArray': ('meanZTest', 'Array'), 'quantileGKArray': ('quantileGK', 'Array'), 'maxIntersectionsPositionArray': ('maxIntersectionsPosition', 'Array'), 'studentTTestArray': ('studentTTest', 'Array'), 'quantilesExactWeightedArray': ('quantilesExactWeighted', 'Array'), 'quantileTDigestArray': ('quantileTDigest', 'Array'), 'covarPopArray': ('covarPop', 'Array'), 'groupBitmapXorArray': ('groupBitmapXor', 'Array'), 'theilsUArray': ('theilsU', 'Array'), 'anyArray': ('any', 'Array'), 'last_valueArray': ('last_value', 'Array'), 'quantileTimingWeightedArray': ('quantileTimingWeighted', 'Array'), 'skewPopArray': ('skewPop', 'Array'), 'stochasticLogisticRegressionArray': ('stochasticLogisticRegression', 'Array'), 'sumWithOverflowArray': ('sumWithOverflow', 'Array'), 'cramersVBiasCorrectedArray': ('cramersVBiasCorrected', 'Array'), 'groupBitXorArray': ('groupBitXor', 'Array'), 'countArray': ('count', 'Array'), 'sumMapArray': ('sumMap', 'Array'), 'groupBitmapArray': ('groupBitmap', 'Array'), 'stddevSampArray': ('stddevSamp', 'Array'), 'uniqHLL12Array': ('uniqHLL12', 'Array'), 'largestTriangleThreeBucketsArray': ('largestTriangleThreeBuckets', 'Array'), 'minMapArray': ('minMap', 'Array'), 'sparkBarArray': ('sparkBar', 'Array'), 'stddevPopArray': ('stddevPop', 'Array'), 'sequenceMatchArray': ('sequenceMatch', 'Array'), 'kurtSampArray': ('kurtSamp', 'Array'), 'anyLastArray': ('anyLast', 'Array'), 'groupArrayInsertAtArray': ('groupArrayInsertAt', 'Array'), 'uniqCombinedArray': ('uniqCombined', 'Array'), 'uniqThetaArray': ('uniqTheta', 'Array'), 'welchTTestArray': ('welchTTest', 'Array'), 'groupBitmapAndArray': ('groupBitmapAnd', 'Array'), 'sumArray': ('sum', 'Array'), 'quantilesExactHighArray': ('quantilesExactHigh', 'Array'), 'first_valueArray': ('first_value', 'Array'), 'exponentialTimeDecayedAvgArray': ('exponentialTimeDecayedAvg', 'Array'), 'quantilesExactArray': ('quantilesExact', 'Array'), 'uniqExactArray': ('uniqExact', 'Array'), 'groupArraySampleArray': ('groupArraySample', 'Array'), 'quantileTDigestWeightedArray': ('quantileTDigestWeighted', 'Array'), 'windowFunnelArray': ('windowFunnel', 'Array'), 'quantileDeterministicArray': ('quantileDeterministic', 'Array'), 'sequenceCountArray': ('sequenceCount', 'Array'), 'quantilesTDigestArray': ('quantilesTDigest', 'Array'), 'groupArrayLastArray': ('groupArrayLast', 'Array'), 'groupArrayMovingSumArray': ('groupArrayMovingSum', 'Array'), 'kolmogorovSmirnovTestArrayIf': ('kolmogorovSmirnovTest', 'ArrayIf'), 'varSampArrayIf': ('varSamp', 'ArrayIf'), 'corrArrayIf': ('corr', 'ArrayIf'), 'quantileBFloat16ArrayIf': ('quantileBFloat16', 'ArrayIf'), 'avgWeightedArrayIf': ('avgWeighted', 'ArrayIf'), 'sequenceNextNodeArrayIf': ('sequenceNextNode', 'ArrayIf'), 'avgArrayIf': ('avg', 'ArrayIf'), 'uniqCombined64ArrayIf': ('uniqCombined64', 'ArrayIf'), 'quantileArrayIf': ('quantile', 'ArrayIf'), 'mannWhitneyUTestArrayIf': ('mannWhitneyUTest', 'ArrayIf'), 'groupUniqArrayArrayIf': ('groupUniqArray', 'ArrayIf'), 'intervalLengthSumArrayIf': ('intervalLengthSum', 'ArrayIf'), 'rankCorrArrayIf': ('rankCorr', 'ArrayIf'), 'quantileExactWeightedArrayIf': ('quantileExactWeighted', 'ArrayIf'), 'stochasticLinearRegressionArrayIf': ('stochasticLinearRegression', 'ArrayIf'), 'groupBitmapOrArrayIf': ('groupBitmapOr', 'ArrayIf'), 'groupArrayMovingAvgArrayIf': ('groupArrayMovingAvg', 'ArrayIf'), 'cramersVArrayIf': ('cramersV', 'ArrayIf'), 'maxArrayIf': ('max', 'ArrayIf'), 'kurtPopArrayIf': ('kurtPop', 'ArrayIf'), 'groupArrayArrayIf': ('groupArray', 'ArrayIf'), 'uniqUpToArrayIf': ('uniqUpTo', 'ArrayIf'), 'quantileExactLowArrayIf': ('quantileExactLow', 'ArrayIf'), 'groupBitOrArrayIf': ('groupBitOr', 'ArrayIf'), 'exponentialMovingAverageArrayIf': ('exponentialMovingAverage', 'ArrayIf'), 'entropyArrayIf': ('entropy', 'ArrayIf'), 'minArrayIf': ('min', 'ArrayIf'), 'quantileExactArrayIf': ('quantileExact', 'ArrayIf'), 'histogramArrayIf': ('histogram', 'ArrayIf'), 'quantilesTimingWeightedArrayIf': ('quantilesTimingWeighted', 'ArrayIf'), 'retentionArrayIf': ('retention', 'ArrayIf'), 'maxMapArrayIf': ('maxMap', 'ArrayIf'), 'boundingRatioArrayIf': ('boundingRatio', 'ArrayIf'), 'sumCountArrayIf': ('sumCount', 'ArrayIf'), 'deltaSumArrayIf': ('deltaSum', 'ArrayIf'), 'quantilesTimingArrayIf': ('quantilesTiming', 'ArrayIf'), 'sumKahanArrayIf': ('sumKahan', 'ArrayIf'), 'maxIntersectionsArrayIf': ('maxIntersections', 'ArrayIf'), 'quantilesInterpolatedWeightedArrayIf': ('quantilesInterpolatedWeighted', 'ArrayIf'), 'quantileInterpolatedWeightedArrayIf': ('quantileInterpolatedWeighted', 'ArrayIf'), 'uniqArrayIf': ('uniq', 'ArrayIf'), 'quantileExactHighArrayIf': ('quantileExactHigh', 'ArrayIf'), 'groupBitAndArrayIf': ('groupBitAnd', 'ArrayIf'), 'covarSampArrayIf': ('covarSamp', 'ArrayIf'), 'quantilesDeterministicArrayIf': ('quantilesDeterministic', 'ArrayIf'), 'topKArrayIf': ('topK', 'ArrayIf'), 'simpleLinearRegressionArrayIf': ('simpleLinearRegression', 'ArrayIf'), 'medianArrayIf': ('median', 'ArrayIf'), 'topKWeightedArrayIf': ('topKWeighted', 'ArrayIf'), 'quantileBFloat16WeightedArrayIf': ('quantileBFloat16Weighted', 'ArrayIf'), 'quantilesGKArrayIf': ('quantilesGK', 'ArrayIf'), 'argMinArrayIf': ('argMin', 'ArrayIf'), 'quantilesBFloat16WeightedArrayIf': ('quantilesBFloat16Weighted', 'ArrayIf'), 'quantilesBFloat16ArrayIf': ('quantilesBFloat16', 'ArrayIf'), 'skewSampArrayIf': ('skewSamp', 'ArrayIf'), 'varPopArrayIf': ('varPop', 'ArrayIf'), 'quantilesExactLowArrayIf': ('quantilesExactLow', 'ArrayIf'), 'categoricalInformationValueArrayIf': ('categoricalInformationValue', 'ArrayIf'), 'quantileTimingArrayIf': ('quantileTiming', 'ArrayIf'), 'deltaSumTimestampArrayIf': ('deltaSumTimestamp', 'ArrayIf'), 'quantilesArrayIf': ('quantiles', 'ArrayIf'), 'contingencyArrayIf': ('contingency', 'ArrayIf'), 'quantilesTDigestWeightedArrayIf': ('quantilesTDigestWeighted', 'ArrayIf'), 'argMaxArrayIf': ('argMax', 'ArrayIf'), 'anyHeavyArrayIf': ('anyHeavy', 'ArrayIf'), 'meanZTestArrayIf': ('meanZTest', 'ArrayIf'), 'quantileGKArrayIf': ('quantileGK', 'ArrayIf'), 'maxIntersectionsPositionArrayIf': ('maxIntersectionsPosition', 'ArrayIf'), 'studentTTestArrayIf': ('studentTTest', 'ArrayIf'), 'quantilesExactWeightedArrayIf': ('quantilesExactWeighted', 'ArrayIf'), 'quantileTDigestArrayIf': ('quantileTDigest', 'ArrayIf'), 'covarPopArrayIf': ('covarPop', 'ArrayIf'), 'groupBitmapXorArrayIf': ('groupBitmapXor', 'ArrayIf'), 'theilsUArrayIf': ('theilsU', 'ArrayIf'), 'anyArrayIf': ('any', 'ArrayIf'), 'last_valueArrayIf': ('last_value', 'ArrayIf'), 'quantileTimingWeightedArrayIf': ('quantileTimingWeighted', 'ArrayIf'), 'skewPopArrayIf': ('skewPop', 'ArrayIf'), 'stochasticLogisticRegressionArrayIf': ('stochasticLogisticRegression', 'ArrayIf'), 'sumWithOverflowArrayIf': ('sumWithOverflow', 'ArrayIf'), 'cramersVBiasCorrectedArrayIf': ('cramersVBiasCorrected', 'ArrayIf'), 'groupBitXorArrayIf': ('groupBitXor', 'ArrayIf'), 'countArrayIf': ('count', 'ArrayIf'), 'sumMapArrayIf': ('sumMap', 'ArrayIf'), 'groupBitmapArrayIf': ('groupBitmap', 'ArrayIf'), 'stddevSampArrayIf': ('stddevSamp', 'ArrayIf'), 'uniqHLL12ArrayIf': ('uniqHLL12', 'ArrayIf'), 'largestTriangleThreeBucketsArrayIf': ('largestTriangleThreeBuckets', 'ArrayIf'), 'minMapArrayIf': ('minMap', 'ArrayIf'), 'sparkBarArrayIf': ('sparkBar', 'ArrayIf'), 'stddevPopArrayIf': ('stddevPop', 'ArrayIf'), 'sequenceMatchArrayIf': ('sequenceMatch', 'ArrayIf'), 'kurtSampArrayIf': ('kurtSamp', 'ArrayIf'), 'anyLastArrayIf': ('anyLast', 'ArrayIf'), 'groupArrayInsertAtArrayIf': ('groupArrayInsertAt', 'ArrayIf'), 'uniqCombinedArrayIf': ('uniqCombined', 'ArrayIf'), 'uniqThetaArrayIf': ('uniqTheta', 'ArrayIf'), 'welchTTestArrayIf': ('welchTTest', 'ArrayIf'), 'groupBitmapAndArrayIf': ('groupBitmapAnd', 'ArrayIf'), 'sumArrayIf': ('sum', 'ArrayIf'), 'quantilesExactHighArrayIf': ('quantilesExactHigh', 'ArrayIf'), 'first_valueArrayIf': ('first_value', 'ArrayIf'), 'exponentialTimeDecayedAvgArrayIf': ('exponentialTimeDecayedAvg', 'ArrayIf'), 'quantilesExactArrayIf': ('quantilesExact', 'ArrayIf'), 'uniqExactArrayIf': ('uniqExact', 'ArrayIf'), 'groupArraySampleArrayIf': ('groupArraySample', 'ArrayIf'), 'quantileTDigestWeightedArrayIf': ('quantileTDigestWeighted', 'ArrayIf'), 'windowFunnelArrayIf': ('windowFunnel', 'ArrayIf'), 'quantileDeterministicArrayIf': ('quantileDeterministic', 'ArrayIf'), 'sequenceCountArrayIf': ('sequenceCount', 'ArrayIf'), 'quantilesTDigestArrayIf': ('quantilesTDigest', 'ArrayIf'), 'groupArrayLastArrayIf': ('groupArrayLast', 'ArrayIf'), 'groupArrayMovingSumArrayIf': ('groupArrayMovingSum', 'ArrayIf'), 'kolmogorovSmirnovTestMap': ('kolmogorovSmirnovTest', 'Map'), 'varSampMap': ('varSamp', 'Map'), 'corrMap': ('corr', 'Map'), 'quantileBFloat16Map': ('quantileBFloat16', 'Map'), 'avgWeightedMap': ('avgWeighted', 'Map'), 'sequenceNextNodeMap': ('sequenceNextNode', 'Map'), 'avgMap': ('avg', 'Map'), 'uniqCombined64Map': ('uniqCombined64', 'Map'), 'quantileMap': ('quantile', 'Map'), 'mannWhitneyUTestMap': ('mannWhitneyUTest', 'Map'), 'groupUniqArrayMap': ('groupUniqArray', 'Map'), 'intervalLengthSumMap': ('intervalLengthSum', 'Map'), 'rankCorrMap': ('rankCorr', 'Map'), 'quantileExactWeightedMap': ('quantileExactWeighted', 'Map'), 'stochasticLinearRegressionMap': ('stochasticLinearRegression', 'Map'), 'groupBitmapOrMap': ('groupBitmapOr', 'Map'), 'groupArrayMovingAvgMap': ('groupArrayMovingAvg', 'Map'), 'cramersVMap': ('cramersV', 'Map'), 'maxMap': ('maxMap', ''), 'kurtPopMap': ('kurtPop', 'Map'), 'groupArrayMap': ('groupArray', 'Map'), 'uniqUpToMap': ('uniqUpTo', 'Map'), 'quantileExactLowMap': ('quantileExactLow', 'Map'), 'groupBitOrMap': ('groupBitOr', 'Map'), 'exponentialMovingAverageMap': ('exponentialMovingAverage', 'Map'), 'entropyMap': ('entropy', 'Map'), 'minMap': ('minMap', ''), 'quantileExactMap': ('quantileExact', 'Map'), 'histogramMap': ('histogram', 'Map'), 'quantilesTimingWeightedMap': ('quantilesTimingWeighted', 'Map'), 'retentionMap': ('retention', 'Map'), 'maxMapMap': ('maxMap', 'Map'), 'boundingRatioMap': ('boundingRatio', 'Map'), 'sumCountMap': ('sumCount', 'Map'), 'deltaSumMap': ('deltaSum', 'Map'), 'quantilesTimingMap': ('quantilesTiming', 'Map'), 'sumKahanMap': ('sumKahan', 'Map'), 'maxIntersectionsMap': ('maxIntersections', 'Map'), 'quantilesInterpolatedWeightedMap': ('quantilesInterpolatedWeighted', 'Map'), 'quantileInterpolatedWeightedMap': ('quantileInterpolatedWeighted', 'Map'), 'uniqMap': ('uniq', 'Map'), 'quantileExactHighMap': ('quantileExactHigh', 'Map'), 'groupBitAndMap': ('groupBitAnd', 'Map'), 'covarSampMap': ('covarSamp', 'Map'), 'quantilesDeterministicMap': ('quantilesDeterministic', 'Map'), 'topKMap': ('topK', 'Map'), 'simpleLinearRegressionMap': ('simpleLinearRegression', 'Map'), 'medianMap': ('median', 'Map'), 'topKWeightedMap': ('topKWeighted', 'Map'), 'quantileBFloat16WeightedMap': ('quantileBFloat16Weighted', 'Map'), 'quantilesGKMap': ('quantilesGK', 'Map'), 'argMinMap': ('argMin', 'Map'), 'quantilesBFloat16WeightedMap': ('quantilesBFloat16Weighted', 'Map'), 'quantilesBFloat16Map': ('quantilesBFloat16', 'Map'), 'skewSampMap': ('skewSamp', 'Map'), 'varPopMap': ('varPop', 'Map'), 'quantilesExactLowMap': ('quantilesExactLow', 'Map'), 'categoricalInformationValueMap': ('categoricalInformationValue', 'Map'), 'quantileTimingMap': ('quantileTiming', 'Map'), 'deltaSumTimestampMap': ('deltaSumTimestamp', 'Map'), 'quantilesMap': ('quantiles', 'Map'), 'contingencyMap': ('contingency', 'Map'), 'quantilesTDigestWeightedMap': ('quantilesTDigestWeighted', 'Map'), 'argMaxMap': ('argMax', 'Map'), 'anyHeavyMap': ('anyHeavy', 'Map'), 'meanZTestMap': ('meanZTest', 'Map'), 'quantileGKMap': ('quantileGK', 'Map'), 'maxIntersectionsPositionMap': ('maxIntersectionsPosition', 'Map'), 'studentTTestMap': ('studentTTest', 'Map'), 'quantilesExactWeightedMap': ('quantilesExactWeighted', 'Map'), 'quantileTDigestMap': ('quantileTDigest', 'Map'), 'covarPopMap': ('covarPop', 'Map'), 'groupBitmapXorMap': ('groupBitmapXor', 'Map'), 'theilsUMap': ('theilsU', 'Map'), 'anyMap': ('any', 'Map'), 'last_valueMap': ('last_value', 'Map'), 'quantileTimingWeightedMap': ('quantileTimingWeighted', 'Map'), 'skewPopMap': ('skewPop', 'Map'), 'stochasticLogisticRegressionMap': ('stochasticLogisticRegression', 'Map'), 'sumWithOverflowMap': ('sumWithOverflow', 'Map'), 'cramersVBiasCorrectedMap': ('cramersVBiasCorrected', 'Map'), 'groupBitXorMap': ('groupBitXor', 'Map'), 'countMap': ('count', 'Map'), 'sumMapMap': ('sumMap', 'Map'), 'groupBitmapMap': ('groupBitmap', 'Map'), 'stddevSampMap': ('stddevSamp', 'Map'), 'uniqHLL12Map': ('uniqHLL12', 'Map'), 'largestTriangleThreeBucketsMap': ('largestTriangleThreeBuckets', 'Map'), 'minMapMap': ('minMap', 'Map'), 'sparkBarMap': ('sparkBar', 'Map'), 'stddevPopMap': ('stddevPop', 'Map'), 'sequenceMatchMap': ('sequenceMatch', 'Map'), 'kurtSampMap': ('kurtSamp', 'Map'), 'anyLastMap': ('anyLast', 'Map'), 'groupArrayInsertAtMap': ('groupArrayInsertAt', 'Map'), 'uniqCombinedMap': ('uniqCombined', 'Map'), 'uniqThetaMap': ('uniqTheta', 'Map'), 'welchTTestMap': ('welchTTest', 'Map'), 'groupBitmapAndMap': ('groupBitmapAnd', 'Map'), 'sumMap': ('sumMap', ''), 'quantilesExactHighMap': ('quantilesExactHigh', 'Map'), 'first_valueMap': ('first_value', 'Map'), 'exponentialTimeDecayedAvgMap': ('exponentialTimeDecayedAvg', 'Map'), 'quantilesExactMap': ('quantilesExact', 'Map'), 'uniqExactMap': ('uniqExact', 'Map'), 'groupArraySampleMap': ('groupArraySample', 'Map'), 'quantileTDigestWeightedMap': ('quantileTDigestWeighted', 'Map'), 'windowFunnelMap': ('windowFunnel', 'Map'), 'quantileDeterministicMap': ('quantileDeterministic', 'Map'), 'sequenceCountMap': ('sequenceCount', 'Map'), 'quantilesTDigestMap': ('quantilesTDigest', 'Map'), 'groupArrayLastMap': ('groupArrayLast', 'Map'), 'groupArrayMovingSumMap': ('groupArrayMovingSum', 'Map'), 'kolmogorovSmirnovTestSimpleState': ('kolmogorovSmirnovTest', 'SimpleState'), 'varSampSimpleState': ('varSamp', 'SimpleState'), 'corrSimpleState': ('corr', 'SimpleState'), 'quantileBFloat16SimpleState': ('quantileBFloat16', 'SimpleState'), 'avgWeightedSimpleState': ('avgWeighted', 'SimpleState'), 'sequenceNextNodeSimpleState': ('sequenceNextNode', 'SimpleState'), 'avgSimpleState': ('avg', 'SimpleState'), 'uniqCombined64SimpleState': ('uniqCombined64', 'SimpleState'), 'quantileSimpleState': ('quantile', 'SimpleState'), 'mannWhitneyUTestSimpleState': ('mannWhitneyUTest', 'SimpleState'), 'groupUniqArraySimpleState': ('groupUniqArray', 'SimpleState'), 'intervalLengthSumSimpleState': ('intervalLengthSum', 'SimpleState'), 'rankCorrSimpleState': ('rankCorr', 'SimpleState'), 'quantileExactWeightedSimpleState': ('quantileExactWeighted', 'SimpleState'), 'stochasticLinearRegressionSimpleState': ('stochasticLinearRegression', 'SimpleState'), 'groupBitmapOrSimpleState': ('groupBitmapOr', 'SimpleState'), 'groupArrayMovingAvgSimpleState': ('groupArrayMovingAvg', 'SimpleState'), 'cramersVSimpleState': ('cramersV', 'SimpleState'), 'maxSimpleState': ('max', 'SimpleState'), 'kurtPopSimpleState': ('kurtPop', 'SimpleState'), 'groupArraySimpleState': ('groupArray', 'SimpleState'), 'uniqUpToSimpleState': ('uniqUpTo', 'SimpleState'), 'quantileExactLowSimpleState': ('quantileExactLow', 'SimpleState'), 'groupBitOrSimpleState': ('groupBitOr', 'SimpleState'), 'exponentialMovingAverageSimpleState': ('exponentialMovingAverage', 'SimpleState'), 'entropySimpleState': ('entropy', 'SimpleState'), 'minSimpleState': ('min', 'SimpleState'), 'quantileExactSimpleState': ('quantileExact', 'SimpleState'), 'histogramSimpleState': ('histogram', 'SimpleState'), 'quantilesTimingWeightedSimpleState': ('quantilesTimingWeighted', 'SimpleState'), 'retentionSimpleState': ('retention', 'SimpleState'), 'maxMapSimpleState': ('maxMap', 'SimpleState'), 'boundingRatioSimpleState': ('boundingRatio', 'SimpleState'), 'sumCountSimpleState': ('sumCount', 'SimpleState'), 'deltaSumSimpleState': ('deltaSum', 'SimpleState'), 'quantilesTimingSimpleState': ('quantilesTiming', 'SimpleState'), 'sumKahanSimpleState': ('sumKahan', 'SimpleState'), 'maxIntersectionsSimpleState': ('maxIntersections', 'SimpleState'), 'quantilesInterpolatedWeightedSimpleState': ('quantilesInterpolatedWeighted', 'SimpleState'), 'quantileInterpolatedWeightedSimpleState': ('quantileInterpolatedWeighted', 'SimpleState'), 'uniqSimpleState': ('uniq', 'SimpleState'), 'quantileExactHighSimpleState': ('quantileExactHigh', 'SimpleState'), 'groupBitAndSimpleState': ('groupBitAnd', 'SimpleState'), 'covarSampSimpleState': ('covarSamp', 'SimpleState'), 'quantilesDeterministicSimpleState': ('quantilesDeterministic', 'SimpleState'), 'topKSimpleState': ('topK', 'SimpleState'), 'simpleLinearRegressionSimpleState': ('simpleLinearRegression', 'SimpleState'), 'medianSimpleState': ('median', 'SimpleState'), 'topKWeightedSimpleState': ('topKWeighted', 'SimpleState'), 'quantileBFloat16WeightedSimpleState': ('quantileBFloat16Weighted', 'SimpleState'), 'quantilesGKSimpleState': ('quantilesGK', 'SimpleState'), 'argMinSimpleState': ('argMin', 'SimpleState'), 'quantilesBFloat16WeightedSimpleState': ('quantilesBFloat16Weighted', 'SimpleState'), 'quantilesBFloat16SimpleState': ('quantilesBFloat16', 'SimpleState'), 'skewSampSimpleState': ('skewSamp', 'SimpleState'), 'varPopSimpleState': ('varPop', 'SimpleState'), 'quantilesExactLowSimpleState': ('quantilesExactLow', 'SimpleState'), 'categoricalInformationValueSimpleState': ('categoricalInformationValue', 'SimpleState'), 'quantileTimingSimpleState': ('quantileTiming', 'SimpleState'), 'deltaSumTimestampSimpleState': ('deltaSumTimestamp', 'SimpleState'), 'quantilesSimpleState': ('quantiles', 'SimpleState'), 'contingencySimpleState': ('contingency', 'SimpleState'), 'quantilesTDigestWeightedSimpleState': ('quantilesTDigestWeighted', 'SimpleState'), 'argMaxSimpleState': ('argMax', 'SimpleState'), 'anyHeavySimpleState': ('anyHeavy', 'SimpleState'), 'meanZTestSimpleState': ('meanZTest', 'SimpleState'), 'quantileGKSimpleState': ('quantileGK', 'SimpleState'), 'maxIntersectionsPositionSimpleState': ('maxIntersectionsPosition', 'SimpleState'), 'studentTTestSimpleState': ('studentTTest', 'SimpleState'), 'quantilesExactWeightedSimpleState': ('quantilesExactWeighted', 'SimpleState'), 'quantileTDigestSimpleState': ('quantileTDigest', 'SimpleState'), 'covarPopSimpleState': ('covarPop', 'SimpleState'), 'groupBitmapXorSimpleState': ('groupBitmapXor', 'SimpleState'), 'theilsUSimpleState': ('theilsU', 'SimpleState'), 'anySimpleState': ('any', 'SimpleState'), 'last_valueSimpleState': ('last_value', 'SimpleState'), 'quantileTimingWeightedSimpleState': ('quantileTimingWeighted', 'SimpleState'), 'skewPopSimpleState': ('skewPop', 'SimpleState'), 'stochasticLogisticRegressionSimpleState': ('stochasticLogisticRegression', 'SimpleState'), 'sumWithOverflowSimpleState': ('sumWithOverflow', 'SimpleState'), 'cramersVBiasCorrectedSimpleState': ('cramersVBiasCorrected', 'SimpleState'), 'groupBitXorSimpleState': ('groupBitXor', 'SimpleState'), 'countSimpleState': ('count', 'SimpleState'), 'sumMapSimpleState': ('sumMap', 'SimpleState'), 'groupBitmapSimpleState': ('groupBitmap', 'SimpleState'), 'stddevSampSimpleState': ('stddevSamp', 'SimpleState'), 'uniqHLL12SimpleState': ('uniqHLL12', 'SimpleState'), 'largestTriangleThreeBucketsSimpleState': ('largestTriangleThreeBuckets', 'SimpleState'), 'minMapSimpleState': ('minMap', 'SimpleState'), 'sparkBarSimpleState': ('sparkBar', 'SimpleState'), 'stddevPopSimpleState': ('stddevPop', 'SimpleState'), 'sequenceMatchSimpleState': ('sequenceMatch', 'SimpleState'), 'kurtSampSimpleState': ('kurtSamp', 'SimpleState'), 'anyLastSimpleState': ('anyLast', 'SimpleState'), 'groupArrayInsertAtSimpleState': ('groupArrayInsertAt', 'SimpleState'), 'uniqCombinedSimpleState': ('uniqCombined', 'SimpleState'), 'uniqThetaSimpleState': ('uniqTheta', 'SimpleState'), 'welchTTestSimpleState': ('welchTTest', 'SimpleState'), 'groupBitmapAndSimpleState': ('groupBitmapAnd', 'SimpleState'), 'sumSimpleState': ('sum', 'SimpleState'), 'quantilesExactHighSimpleState': ('quantilesExactHigh', 'SimpleState'), 'first_valueSimpleState': ('first_value', 'SimpleState'), 'exponentialTimeDecayedAvgSimpleState': ('exponentialTimeDecayedAvg', 'SimpleState'), 'quantilesExactSimpleState': ('quantilesExact', 'SimpleState'), 'uniqExactSimpleState': ('uniqExact', 'SimpleState'), 'groupArraySampleSimpleState': ('groupArraySample', 'SimpleState'), 'quantileTDigestWeightedSimpleState': ('quantileTDigestWeighted', 'SimpleState'), 'windowFunnelSimpleState': ('windowFunnel', 'SimpleState'), 'quantileDeterministicSimpleState': ('quantileDeterministic', 'SimpleState'), 'sequenceCountSimpleState': ('sequenceCount', 'SimpleState'), 'quantilesTDigestSimpleState': ('quantilesTDigest', 'SimpleState'), 'groupArrayLastSimpleState': ('groupArrayLast', 'SimpleState'), 'groupArrayMovingSumSimpleState': ('groupArrayMovingSum', 'SimpleState'), 'kolmogorovSmirnovTestState': ('kolmogorovSmirnovTest', 'State'), 'varSampState': ('varSamp', 'State'), 'corrState': ('corr', 'State'), 'quantileBFloat16State': ('quantileBFloat16', 'State'), 'avgWeightedState': ('avgWeighted', 'State'), 'sequenceNextNodeState': ('sequenceNextNode', 'State'), 'avgState': ('avg', 'State'), 'uniqCombined64State': ('uniqCombined64', 'State'), 'quantileState': ('quantile', 'State'), 'mannWhitneyUTestState': ('mannWhitneyUTest', 'State'), 'groupUniqArrayState': ('groupUniqArray', 'State'), 'intervalLengthSumState': ('intervalLengthSum', 'State'), 'rankCorrState': ('rankCorr', 'State'), 'quantileExactWeightedState': ('quantileExactWeighted', 'State'), 'stochasticLinearRegressionState': ('stochasticLinearRegression', 'State'), 'groupBitmapOrState': ('groupBitmapOr', 'State'), 'groupArrayMovingAvgState': ('groupArrayMovingAvg', 'State'), 'cramersVState': ('cramersV', 'State'), 'maxState': ('max', 'State'), 'kurtPopState': ('kurtPop', 'State'), 'groupArrayState': ('groupArray', 'State'), 'uniqUpToState': ('uniqUpTo', 'State'), 'quantileExactLowState': ('quantileExactLow', 'State'), 'groupBitOrState': ('groupBitOr', 'State'), 'exponentialMovingAverageState': ('exponentialMovingAverage', 'State'), 'entropyState': ('entropy', 'State'), 'minState': ('min', 'State'), 'quantileExactState': ('quantileExact', 'State'), 'histogramState': ('histogram', 'State'), 'quantilesTimingWeightedState': ('quantilesTimingWeighted', 'State'), 'retentionState': ('retention', 'State'), 'maxMapState': ('maxMap', 'State'), 'boundingRatioState': ('boundingRatio', 'State'), 'sumCountState': ('sumCount', 'State'), 'deltaSumState': ('deltaSum', 'State'), 'quantilesTimingState': ('quantilesTiming', 'State'), 'sumKahanState': ('sumKahan', 'State'), 'maxIntersectionsState': ('maxIntersections', 'State'), 'quantilesInterpolatedWeightedState': ('quantilesInterpolatedWeighted', 'State'), 'quantileInterpolatedWeightedState': ('quantileInterpolatedWeighted', 'State'), 'uniqState': ('uniq', 'State'), 'quantileExactHighState': ('quantileExactHigh', 'State'), 'groupBitAndState': ('groupBitAnd', 'State'), 'covarSampState': ('covarSamp', 'State'), 'quantilesDeterministicState': ('quantilesDeterministic', 'State'), 'topKState': ('topK', 'State'), 'simpleLinearRegressionState': ('simpleLinearRegression', 'State'), 'medianState': ('median', 'State'), 'topKWeightedState': ('topKWeighted', 'State'), 'quantileBFloat16WeightedState': ('quantileBFloat16Weighted', 'State'), 'quantilesGKState': ('quantilesGK', 'State'), 'argMinState': ('argMin', 'State'), 'quantilesBFloat16WeightedState': ('quantilesBFloat16Weighted', 'State'), 'quantilesBFloat16State': ('quantilesBFloat16', 'State'), 'skewSampState': ('skewSamp', 'State'), 'varPopState': ('varPop', 'State'), 'quantilesExactLowState': ('quantilesExactLow', 'State'), 'categoricalInformationValueState': ('categoricalInformationValue', 'State'), 'quantileTimingState': ('quantileTiming', 'State'), 'deltaSumTimestampState': ('deltaSumTimestamp', 'State'), 'quantilesState': ('quantiles', 'State'), 'contingencyState': ('contingency', 'State'), 'quantilesTDigestWeightedState': ('quantilesTDigestWeighted', 'State'), 'argMaxState': ('argMax', 'State'), 'anyHeavyState': ('anyHeavy', 'State'), 'meanZTestState': ('meanZTest', 'State'), 'quantileGKState': ('quantileGK', 'State'), 'maxIntersectionsPositionState': ('maxIntersectionsPosition', 'State'), 'studentTTestState': ('studentTTest', 'State'), 'quantilesExactWeightedState': ('quantilesExactWeighted', 'State'), 'quantileTDigestState': ('quantileTDigest', 'State'), 'covarPopState': ('covarPop', 'State'), 'groupBitmapXorState': ('groupBitmapXor', 'State'), 'theilsUState': ('theilsU', 'State'), 'anyState': ('any', 'State'), 'last_valueState': ('last_value', 'State'), 'quantileTimingWeightedState': ('quantileTimingWeighted', 'State'), 'skewPopState': ('skewPop', 'State'), 'stochasticLogisticRegressionState': ('stochasticLogisticRegression', 'State'), 'sumWithOverflowState': ('sumWithOverflow', 'State'), 'cramersVBiasCorrectedState': ('cramersVBiasCorrected', 'State'), 'groupBitXorState': ('groupBitXor', 'State'), 'countState': ('count', 'State'), 'sumMapState': ('sumMap', 'State'), 'groupBitmapState': ('groupBitmap', 'State'), 'stddevSampState': ('stddevSamp', 'State'), 'uniqHLL12State': ('uniqHLL12', 'State'), 'largestTriangleThreeBucketsState': ('largestTriangleThreeBuckets', 'State'), 'minMapState': ('minMap', 'State'), 'sparkBarState': ('sparkBar', 'State'), 'stddevPopState': ('stddevPop', 'State'), 'sequenceMatchState': ('sequenceMatch', 'State'), 'kurtSampState': ('kurtSamp', 'State'), 'anyLastState': ('anyLast', 'State'), 'groupArrayInsertAtState': ('groupArrayInsertAt', 'State'), 'uniqCombinedState': ('uniqCombined', 'State'), 'uniqThetaState': ('uniqTheta', 'State'), 'welchTTestState': ('welchTTest', 'State'), 'groupBitmapAndState': ('groupBitmapAnd', 'State'), 'sumState': ('sum', 'State'), 'quantilesExactHighState': ('quantilesExactHigh', 'State'), 'first_valueState': ('first_value', 'State'), 'exponentialTimeDecayedAvgState': ('exponentialTimeDecayedAvg', 'State'), 'quantilesExactState': ('quantilesExact', 'State'), 'uniqExactState': ('uniqExact', 'State'), 'groupArraySampleState': ('groupArraySample', 'State'), 'quantileTDigestWeightedState': ('quantileTDigestWeighted', 'State'), 'windowFunnelState': ('windowFunnel', 'State'), 'quantileDeterministicState': ('quantileDeterministic', 'State'), 'sequenceCountState': ('sequenceCount', 'State'), 'quantilesTDigestState': ('quantilesTDigest', 'State'), 'groupArrayLastState': ('groupArrayLast', 'State'), 'groupArrayMovingSumState': ('groupArrayMovingSum', 'State'), 'kolmogorovSmirnovTestMerge': ('kolmogorovSmirnovTest', 'Merge'), 'varSampMerge': ('varSamp', 'Merge'), 'corrMerge': ('corr', 'Merge'), 'quantileBFloat16Merge': ('quantileBFloat16', 'Merge'), 'avgWeightedMerge': ('avgWeighted', 'Merge'), 'sequenceNextNodeMerge': ('sequenceNextNode', 'Merge'), 'avgMerge': ('avg', 'Merge'), 'uniqCombined64Merge': ('uniqCombined64', 'Merge'), 'quantileMerge': ('quantile', 'Merge'), 'mannWhitneyUTestMerge': ('mannWhitneyUTest', 'Merge'), 'groupUniqArrayMerge': ('groupUniqArray', 'Merge'), 'intervalLengthSumMerge': ('intervalLengthSum', 'Merge'), 'rankCorrMerge': ('rankCorr', 'Merge'), 'quantileExactWeightedMerge': ('quantileExactWeighted', 'Merge'), 'stochasticLinearRegressionMerge': ('stochasticLinearRegression', 'Merge'), 'groupBitmapOrMerge': ('groupBitmapOr', 'Merge'), 'groupArrayMovingAvgMerge': ('groupArrayMovingAvg', 'Merge'), 'cramersVMerge': ('cramersV', 'Merge'), 'maxMerge': ('max', 'Merge'), 'kurtPopMerge': ('kurtPop', 'Merge'), 'groupArrayMerge': ('groupArray', 'Merge'), 'uniqUpToMerge': ('uniqUpTo', 'Merge'), 'quantileExactLowMerge': ('quantileExactLow', 'Merge'), 'groupBitOrMerge': ('groupBitOr', 'Merge'), 'exponentialMovingAverageMerge': ('exponentialMovingAverage', 'Merge'), 'entropyMerge': ('entropy', 'Merge'), 'minMerge': ('min', 'Merge'), 'quantileExactMerge': ('quantileExact', 'Merge'), 'histogramMerge': ('histogram', 'Merge'), 'quantilesTimingWeightedMerge': ('quantilesTimingWeighted', 'Merge'), 'retentionMerge': ('retention', 'Merge'), 'maxMapMerge': ('maxMap', 'Merge'), 'boundingRatioMerge': ('boundingRatio', 'Merge'), 'sumCountMerge': ('sumCount', 'Merge'), 'deltaSumMerge': ('deltaSum', 'Merge'), 'quantilesTimingMerge': ('quantilesTiming', 'Merge'), 'sumKahanMerge': ('sumKahan', 'Merge'), 'maxIntersectionsMerge': ('maxIntersections', 'Merge'), 'quantilesInterpolatedWeightedMerge': ('quantilesInterpolatedWeighted', 'Merge'), 'quantileInterpolatedWeightedMerge': ('quantileInterpolatedWeighted', 'Merge'), 'uniqMerge': ('uniq', 'Merge'), 'quantileExactHighMerge': ('quantileExactHigh', 'Merge'), 'groupBitAndMerge': ('groupBitAnd', 'Merge'), 'covarSampMerge': ('covarSamp', 'Merge'), 'quantilesDeterministicMerge': ('quantilesDeterministic', 'Merge'), 'topKMerge': ('topK', 'Merge'), 'simpleLinearRegressionMerge': ('simpleLinearRegression', 'Merge'), 'medianMerge': ('median', 'Merge'), 'topKWeightedMerge': ('topKWeighted', 'Merge'), 'quantileBFloat16WeightedMerge': ('quantileBFloat16Weighted', 'Merge'), 'quantilesGKMerge': ('quantilesGK', 'Merge'), 'argMinMerge': ('argMin', 'Merge'), 'quantilesBFloat16WeightedMerge': ('quantilesBFloat16Weighted', 'Merge'), 'quantilesBFloat16Merge': ('quantilesBFloat16', 'Merge'), 'skewSampMerge': ('skewSamp', 'Merge'), 'varPopMerge': ('varPop', 'Merge'), 'quantilesExactLowMerge': ('quantilesExactLow', 'Merge'), 'categoricalInformationValueMerge': ('categoricalInformationValue', 'Merge'), 'quantileTimingMerge': ('quantileTiming', 'Merge'), 'deltaSumTimestampMerge': ('deltaSumTimestamp', 'Merge'), 'quantilesMerge': ('quantiles', 'Merge'), 'contingencyMerge': ('contingency', 'Merge'), 'quantilesTDigestWeightedMerge': ('quantilesTDigestWeighted', 'Merge'), 'argMaxMerge': ('argMax', 'Merge'), 'anyHeavyMerge': ('anyHeavy', 'Merge'), 'meanZTestMerge': ('meanZTest', 'Merge'), 'quantileGKMerge': ('quantileGK', 'Merge'), 'maxIntersectionsPositionMerge': ('maxIntersectionsPosition', 'Merge'), 'studentTTestMerge': ('studentTTest', 'Merge'), 'quantilesExactWeightedMerge': ('quantilesExactWeighted', 'Merge'), 'quantileTDigestMerge': ('quantileTDigest', 'Merge'), 'covarPopMerge': ('covarPop', 'Merge'), 'groupBitmapXorMerge': ('groupBitmapXor', 'Merge'), 'theilsUMerge': ('theilsU', 'Merge'), 'anyMerge': ('any', 'Merge'), 'last_valueMerge': ('last_value', 'Merge'), 'quantileTimingWeightedMerge': ('quantileTimingWeighted', 'Merge'), 'skewPopMerge': ('skewPop', 'Merge'), 'stochasticLogisticRegressionMerge': ('stochasticLogisticRegression', 'Merge'), 'sumWithOverflowMerge': ('sumWithOverflow', 'Merge'), 'cramersVBiasCorrectedMerge': ('cramersVBiasCorrected', 'Merge'), 'groupBitXorMerge': ('groupBitXor', 'Merge'), 'countMerge': ('count', 'Merge'), 'sumMapMerge': ('sumMap', 'Merge'), 'groupBitmapMerge': ('groupBitmap', 'Merge'), 'stddevSampMerge': ('stddevSamp', 'Merge'), 'uniqHLL12Merge': ('uniqHLL12', 'Merge'), 'largestTriangleThreeBucketsMerge': ('largestTriangleThreeBuckets', 'Merge'), 'minMapMerge': ('minMap', 'Merge'), 'sparkBarMerge': ('sparkBar', 'Merge'), 'stddevPopMerge': ('stddevPop', 'Merge'), 'sequenceMatchMerge': ('sequenceMatch', 'Merge'), 'kurtSampMerge': ('kurtSamp', 'Merge'), 'anyLastMerge': ('anyLast', 'Merge'), 'groupArrayInsertAtMerge': ('groupArrayInsertAt', 'Merge'), 'uniqCombinedMerge': ('uniqCombined', 'Merge'), 'uniqThetaMerge': ('uniqTheta', 'Merge'), 'welchTTestMerge': ('welchTTest', 'Merge'), 'groupBitmapAndMerge': ('groupBitmapAnd', 'Merge'), 'sumMerge': ('sum', 'Merge'), 'quantilesExactHighMerge': ('quantilesExactHigh', 'Merge'), 'first_valueMerge': ('first_value', 'Merge'), 'exponentialTimeDecayedAvgMerge': ('exponentialTimeDecayedAvg', 'Merge'), 'quantilesExactMerge': ('quantilesExact', 'Merge'), 'uniqExactMerge': ('uniqExact', 'Merge'), 'groupArraySampleMerge': ('groupArraySample', 'Merge'), 'quantileTDigestWeightedMerge': ('quantileTDigestWeighted', 'Merge'), 'windowFunnelMerge': ('windowFunnel', 'Merge'), 'quantileDeterministicMerge': ('quantileDeterministic', 'Merge'), 'sequenceCountMerge': ('sequenceCount', 'Merge'), 'quantilesTDigestMerge': ('quantilesTDigest', 'Merge'), 'groupArrayLastMerge': ('groupArrayLast', 'Merge'), 'groupArrayMovingSumMerge': ('groupArrayMovingSum', 'Merge'), 'kolmogorovSmirnovTestMergeState': ('kolmogorovSmirnovTest', 'MergeState'), 'varSampMergeState': ('varSamp', 'MergeState'), 'corrMergeState': ('corr', 'MergeState'), 'quantileBFloat16MergeState': ('quantileBFloat16', 'MergeState'), 'avgWeightedMergeState': ('avgWeighted', 'MergeState'), 'sequenceNextNodeMergeState': ('sequenceNextNode', 'MergeState'), 'avgMergeState': ('avg', 'MergeState'), 'uniqCombined64MergeState': ('uniqCombined64', 'MergeState'), 'quantileMergeState': ('quantile', 'MergeState'), 'mannWhitneyUTestMergeState': ('mannWhitneyUTest', 'MergeState'), 'groupUniqArrayMergeState': ('groupUniqArray', 'MergeState'), 'intervalLengthSumMergeState': ('intervalLengthSum', 'MergeState'), 'rankCorrMergeState': ('rankCorr', 'MergeState'), 'quantileExactWeightedMergeState': ('quantileExactWeighted', 'MergeState'), 'stochasticLinearRegressionMergeState': ('stochasticLinearRegression', 'MergeState'), 'groupBitmapOrMergeState': ('groupBitmapOr', 'MergeState'), 'groupArrayMovingAvgMergeState': ('groupArrayMovingAvg', 'MergeState'), 'cramersVMergeState': ('cramersV', 'MergeState'), 'maxMergeState': ('max', 'MergeState'), 'kurtPopMergeState': ('kurtPop', 'MergeState'), 'groupArrayMergeState': ('groupArray', 'MergeState'), 'uniqUpToMergeState': ('uniqUpTo', 'MergeState'), 'quantileExactLowMergeState': ('quantileExactLow', 'MergeState'), 'groupBitOrMergeState': ('groupBitOr', 'MergeState'), 'exponentialMovingAverageMergeState': ('exponentialMovingAverage', 'MergeState'), 'entropyMergeState': ('entropy', 'MergeState'), 'minMergeState': ('min', 'MergeState'), 'quantileExactMergeState': ('quantileExact', 'MergeState'), 'histogramMergeState': ('histogram', 'MergeState'), 'quantilesTimingWeightedMergeState': ('quantilesTimingWeighted', 'MergeState'), 'retentionMergeState': ('retention', 'MergeState'), 'maxMapMergeState': ('maxMap', 'MergeState'), 'boundingRatioMergeState': ('boundingRatio', 'MergeState'), 'sumCountMergeState': ('sumCount', 'MergeState'), 'deltaSumMergeState': ('deltaSum', 'MergeState'), 'quantilesTimingMergeState': ('quantilesTiming', 'MergeState'), 'sumKahanMergeState': ('sumKahan', 'MergeState'), 'maxIntersectionsMergeState': ('maxIntersections', 'MergeState'), 'quantilesInterpolatedWeightedMergeState': ('quantilesInterpolatedWeighted', 'MergeState'), 'quantileInterpolatedWeightedMergeState': ('quantileInterpolatedWeighted', 'MergeState'), 'uniqMergeState': ('uniq', 'MergeState'), 'quantileExactHighMergeState': ('quantileExactHigh', 'MergeState'), 'groupBitAndMergeState': ('groupBitAnd', 'MergeState'), 'covarSampMergeState': ('covarSamp', 'MergeState'), 'quantilesDeterministicMergeState': ('quantilesDeterministic', 'MergeState'), 'topKMergeState': ('topK', 'MergeState'), 'simpleLinearRegressionMergeState': ('simpleLinearRegression', 'MergeState'), 'medianMergeState': ('median', 'MergeState'), 'topKWeightedMergeState': ('topKWeighted', 'MergeState'), 'quantileBFloat16WeightedMergeState': ('quantileBFloat16Weighted', 'MergeState'), 'quantilesGKMergeState': ('quantilesGK', 'MergeState'), 'argMinMergeState': ('argMin', 'MergeState'), 'quantilesBFloat16WeightedMergeState': ('quantilesBFloat16Weighted', 'MergeState'), 'quantilesBFloat16MergeState': ('quantilesBFloat16', 'MergeState'), 'skewSampMergeState': ('skewSamp', 'MergeState'), 'varPopMergeState': ('varPop', 'MergeState'), 'quantilesExactLowMergeState': ('quantilesExactLow', 'MergeState'), 'categoricalInformationValueMergeState': ('categoricalInformationValue', 'MergeState'), 'quantileTimingMergeState': ('quantileTiming', 'MergeState'), 'deltaSumTimestampMergeState': ('deltaSumTimestamp', 'MergeState'), 'quantilesMergeState': ('quantiles', 'MergeState'), 'contingencyMergeState': ('contingency', 'MergeState'), 'quantilesTDigestWeightedMergeState': ('quantilesTDigestWeighted', 'MergeState'), 'argMaxMergeState': ('argMax', 'MergeState'), 'anyHeavyMergeState': ('anyHeavy', 'MergeState'), 'meanZTestMergeState': ('meanZTest', 'MergeState'), 'quantileGKMergeState': ('quantileGK', 'MergeState'), 'maxIntersectionsPositionMergeState': ('maxIntersectionsPosition', 'MergeState'), 'studentTTestMergeState': ('studentTTest', 'MergeState'), 'quantilesExactWeightedMergeState': ('quantilesExactWeighted', 'MergeState'), 'quantileTDigestMergeState': ('quantileTDigest', 'MergeState'), 'covarPopMergeState': ('covarPop', 'MergeState'), 'groupBitmapXorMergeState': ('groupBitmapXor', 'MergeState'), 'theilsUMergeState': ('theilsU', 'MergeState'), 'anyMergeState': ('any', 'MergeState'), 'last_valueMergeState': ('last_value', 'MergeState'), 'quantileTimingWeightedMergeState': ('quantileTimingWeighted', 'MergeState'), 'skewPopMergeState': ('skewPop', 'MergeState'), 'stochasticLogisticRegressionMergeState': ('stochasticLogisticRegression', 'MergeState'), 'sumWithOverflowMergeState': ('sumWithOverflow', 'MergeState'), 'cramersVBiasCorrectedMergeState': ('cramersVBiasCorrected', 'MergeState'), 'groupBitXorMergeState': ('groupBitXor', 'MergeState'), 'countMergeState': ('count', 'MergeState'), 'sumMapMergeState': ('sumMap', 'MergeState'), 'groupBitmapMergeState': ('groupBitmap', 'MergeState'), 'stddevSampMergeState': ('stddevSamp', 'MergeState'), 'uniqHLL12MergeState': ('uniqHLL12', 'MergeState'), 'largestTriangleThreeBucketsMergeState': ('largestTriangleThreeBuckets', 'MergeState'), 'minMapMergeState': ('minMap', 'MergeState'), 'sparkBarMergeState': ('sparkBar', 'MergeState'), 'stddevPopMergeState': ('stddevPop', 'MergeState'), 'sequenceMatchMergeState': ('sequenceMatch', 'MergeState'), 'kurtSampMergeState': ('kurtSamp', 'MergeState'), 'anyLastMergeState': ('anyLast', 'MergeState'), 'groupArrayInsertAtMergeState': ('groupArrayInsertAt', 'MergeState'), 'uniqCombinedMergeState': ('uniqCombined', 'MergeState'), 'uniqThetaMergeState': ('uniqTheta', 'MergeState'), 'welchTTestMergeState': ('welchTTest', 'MergeState'), 'groupBitmapAndMergeState': ('groupBitmapAnd', 'MergeState'), 'sumMergeState': ('sum', 'MergeState'), 'quantilesExactHighMergeState': ('quantilesExactHigh', 'MergeState'), 'first_valueMergeState': ('first_value', 'MergeState'), 'exponentialTimeDecayedAvgMergeState': ('exponentialTimeDecayedAvg', 'MergeState'), 'quantilesExactMergeState': ('quantilesExact', 'MergeState'), 'uniqExactMergeState': ('uniqExact', 'MergeState'), 'groupArraySampleMergeState': ('groupArraySample', 'MergeState'), 'quantileTDigestWeightedMergeState': ('quantileTDigestWeighted', 'MergeState'), 'windowFunnelMergeState': ('windowFunnel', 'MergeState'), 'quantileDeterministicMergeState': ('quantileDeterministic', 'MergeState'), 'sequenceCountMergeState': ('sequenceCount', 'MergeState'), 'quantilesTDigestMergeState': ('quantilesTDigest', 'MergeState'), 'groupArrayLastMergeState': ('groupArrayLast', 'MergeState'), 'groupArrayMovingSumMergeState': ('groupArrayMovingSum', 'MergeState'), 'kolmogorovSmirnovTestForEach': ('kolmogorovSmirnovTest', 'ForEach'), 'varSampForEach': ('varSamp', 'ForEach'), 'corrForEach': ('corr', 'ForEach'), 'quantileBFloat16ForEach': ('quantileBFloat16', 'ForEach'), 'avgWeightedForEach': ('avgWeighted', 'ForEach'), 'sequenceNextNodeForEach': ('sequenceNextNode', 'ForEach'), 'avgForEach': ('avg', 'ForEach'), 'uniqCombined64ForEach': ('uniqCombined64', 'ForEach'), 'quantileForEach': ('quantile', 'ForEach'), 'mannWhitneyUTestForEach': ('mannWhitneyUTest', 'ForEach'), 'groupUniqArrayForEach': ('groupUniqArray', 'ForEach'), 'intervalLengthSumForEach': ('intervalLengthSum', 'ForEach'), 'rankCorrForEach': ('rankCorr', 'ForEach'), 'quantileExactWeightedForEach': ('quantileExactWeighted', 'ForEach'), 'stochasticLinearRegressionForEach': ('stochasticLinearRegression', 'ForEach'), 'groupBitmapOrForEach': ('groupBitmapOr', 'ForEach'), 'groupArrayMovingAvgForEach': ('groupArrayMovingAvg', 'ForEach'), 'cramersVForEach': ('cramersV', 'ForEach'), 'maxForEach': ('max', 'ForEach'), 'kurtPopForEach': ('kurtPop', 'ForEach'), 'groupArrayForEach': ('groupArray', 'ForEach'), 'uniqUpToForEach': ('uniqUpTo', 'ForEach'), 'quantileExactLowForEach': ('quantileExactLow', 'ForEach'), 'groupBitOrForEach': ('groupBitOr', 'ForEach'), 'exponentialMovingAverageForEach': ('exponentialMovingAverage', 'ForEach'), 'entropyForEach': ('entropy', 'ForEach'), 'minForEach': ('min', 'ForEach'), 'quantileExactForEach': ('quantileExact', 'ForEach'), 'histogramForEach': ('histogram', 'ForEach'), 'quantilesTimingWeightedForEach': ('quantilesTimingWeighted', 'ForEach'), 'retentionForEach': ('retention', 'ForEach'), 'maxMapForEach': ('maxMap', 'ForEach'), 'boundingRatioForEach': ('boundingRatio', 'ForEach'), 'sumCountForEach': ('sumCount', 'ForEach'), 'deltaSumForEach': ('deltaSum', 'ForEach'), 'quantilesTimingForEach': ('quantilesTiming', 'ForEach'), 'sumKahanForEach': ('sumKahan', 'ForEach'), 'maxIntersectionsForEach': ('maxIntersections', 'ForEach'), 'quantilesInterpolatedWeightedForEach': ('quantilesInterpolatedWeighted', 'ForEach'), 'quantileInterpolatedWeightedForEach': ('quantileInterpolatedWeighted', 'ForEach'), 'uniqForEach': ('uniq', 'ForEach'), 'quantileExactHighForEach': ('quantileExactHigh', 'ForEach'), 'groupBitAndForEach': ('groupBitAnd', 'ForEach'), 'covarSampForEach': ('covarSamp', 'ForEach'), 'quantilesDeterministicForEach': ('quantilesDeterministic', 'ForEach'), 'topKForEach': ('topK', 'ForEach'), 'simpleLinearRegressionForEach': ('simpleLinearRegression', 'ForEach'), 'medianForEach': ('median', 'ForEach'), 'topKWeightedForEach': ('topKWeighted', 'ForEach'), 'quantileBFloat16WeightedForEach': ('quantileBFloat16Weighted', 'ForEach'), 'quantilesGKForEach': ('quantilesGK', 'ForEach'), 'argMinForEach': ('argMin', 'ForEach'), 'quantilesBFloat16WeightedForEach': ('quantilesBFloat16Weighted', 'ForEach'), 'quantilesBFloat16ForEach': ('quantilesBFloat16', 'ForEach'), 'skewSampForEach': ('skewSamp', 'ForEach'), 'varPopForEach': ('varPop', 'ForEach'), 'quantilesExactLowForEach': ('quantilesExactLow', 'ForEach'), 'categoricalInformationValueForEach': ('categoricalInformationValue', 'ForEach'), 'quantileTimingForEach': ('quantileTiming', 'ForEach'), 'deltaSumTimestampForEach': ('deltaSumTimestamp', 'ForEach'), 'quantilesForEach': ('quantiles', 'ForEach'), 'contingencyForEach': ('contingency', 'ForEach'), 'quantilesTDigestWeightedForEach': ('quantilesTDigestWeighted', 'ForEach'), 'argMaxForEach': ('argMax', 'ForEach'), 'anyHeavyForEach': ('anyHeavy', 'ForEach'), 'meanZTestForEach': ('meanZTest', 'ForEach'), 'quantileGKForEach': ('quantileGK', 'ForEach'), 'maxIntersectionsPositionForEach': ('maxIntersectionsPosition', 'ForEach'), 'studentTTestForEach': ('studentTTest', 'ForEach'), 'quantilesExactWeightedForEach': ('quantilesExactWeighted', 'ForEach'), 'quantileTDigestForEach': ('quantileTDigest', 'ForEach'), 'covarPopForEach': ('covarPop', 'ForEach'), 'groupBitmapXorForEach': ('groupBitmapXor', 'ForEach'), 'theilsUForEach': ('theilsU', 'ForEach'), 'anyForEach': ('any', 'ForEach'), 'last_valueForEach': ('last_value', 'ForEach'), 'quantileTimingWeightedForEach': ('quantileTimingWeighted', 'ForEach'), 'skewPopForEach': ('skewPop', 'ForEach'), 'stochasticLogisticRegressionForEach': ('stochasticLogisticRegression', 'ForEach'), 'sumWithOverflowForEach': ('sumWithOverflow', 'ForEach'), 'cramersVBiasCorrectedForEach': ('cramersVBiasCorrected', 'ForEach'), 'groupBitXorForEach': ('groupBitXor', 'ForEach'), 'countForEach': ('count', 'ForEach'), 'sumMapForEach': ('sumMap', 'ForEach'), 'groupBitmapForEach': ('groupBitmap', 'ForEach'), 'stddevSampForEach': ('stddevSamp', 'ForEach'), 'uniqHLL12ForEach': ('uniqHLL12', 'ForEach'), 'largestTriangleThreeBucketsForEach': ('largestTriangleThreeBuckets', 'ForEach'), 'minMapForEach': ('minMap', 'ForEach'), 'sparkBarForEach': ('sparkBar', 'ForEach'), 'stddevPopForEach': ('stddevPop', 'ForEach'), 'sequenceMatchForEach': ('sequenceMatch', 'ForEach'), 'kurtSampForEach': ('kurtSamp', 'ForEach'), 'anyLastForEach': ('anyLast', 'ForEach'), 'groupArrayInsertAtForEach': ('groupArrayInsertAt', 'ForEach'), 'uniqCombinedForEach': ('uniqCombined', 'ForEach'), 'uniqThetaForEach': ('uniqTheta', 'ForEach'), 'welchTTestForEach': ('welchTTest', 'ForEach'), 'groupBitmapAndForEach': ('groupBitmapAnd', 'ForEach'), 'sumForEach': ('sum', 'ForEach'), 'quantilesExactHighForEach': ('quantilesExactHigh', 'ForEach'), 'first_valueForEach': ('first_value', 'ForEach'), 'exponentialTimeDecayedAvgForEach': ('exponentialTimeDecayedAvg', 'ForEach'), 'quantilesExactForEach': ('quantilesExact', 'ForEach'), 'uniqExactForEach': ('uniqExact', 'ForEach'), 'groupArraySampleForEach': ('groupArraySample', 'ForEach'), 'quantileTDigestWeightedForEach': ('quantileTDigestWeighted', 'ForEach'), 'windowFunnelForEach': ('windowFunnel', 'ForEach'), 'quantileDeterministicForEach': ('quantileDeterministic', 'ForEach'), 'sequenceCountForEach': ('sequenceCount', 'ForEach'), 'quantilesTDigestForEach': ('quantilesTDigest', 'ForEach'), 'groupArrayLastForEach': ('groupArrayLast', 'ForEach'), 'groupArrayMovingSumForEach': ('groupArrayMovingSum', 'ForEach'), 'kolmogorovSmirnovTestDistinct': ('kolmogorovSmirnovTest', 'Distinct'), 'varSampDistinct': ('varSamp', 'Distinct'), 'corrDistinct': ('corr', 'Distinct'), 'quantileBFloat16Distinct': ('quantileBFloat16', 'Distinct'), 'avgWeightedDistinct': ('avgWeighted', 'Distinct'), 'sequenceNextNodeDistinct': ('sequenceNextNode', 'Distinct'), 'avgDistinct': ('avg', 'Distinct'), 'uniqCombined64Distinct': ('uniqCombined64', 'Distinct'), 'quantileDistinct': ('quantile', 'Distinct'), 'mannWhitneyUTestDistinct': ('mannWhitneyUTest', 'Distinct'), 'groupUniqArrayDistinct': ('groupUniqArray', 'Distinct'), 'intervalLengthSumDistinct': ('intervalLengthSum', 'Distinct'), 'rankCorrDistinct': ('rankCorr', 'Distinct'), 'quantileExactWeightedDistinct': ('quantileExactWeighted', 'Distinct'), 'stochasticLinearRegressionDistinct': ('stochasticLinearRegression', 'Distinct'), 'groupBitmapOrDistinct': ('groupBitmapOr', 'Distinct'), 'groupArrayMovingAvgDistinct': ('groupArrayMovingAvg', 'Distinct'), 'cramersVDistinct': ('cramersV', 'Distinct'), 'maxDistinct': ('max', 'Distinct'), 'kurtPopDistinct': ('kurtPop', 'Distinct'), 'groupArrayDistinct': ('groupArray', 'Distinct'), 'uniqUpToDistinct': ('uniqUpTo', 'Distinct'), 'quantileExactLowDistinct': ('quantileExactLow', 'Distinct'), 'groupBitOrDistinct': ('groupBitOr', 'Distinct'), 'exponentialMovingAverageDistinct': ('exponentialMovingAverage', 'Distinct'), 'entropyDistinct': ('entropy', 'Distinct'), 'minDistinct': ('min', 'Distinct'), 'quantileExactDistinct': ('quantileExact', 'Distinct'), 'histogramDistinct': ('histogram', 'Distinct'), 'quantilesTimingWeightedDistinct': ('quantilesTimingWeighted', 'Distinct'), 'retentionDistinct': ('retention', 'Distinct'), 'maxMapDistinct': ('maxMap', 'Distinct'), 'boundingRatioDistinct': ('boundingRatio', 'Distinct'), 'sumCountDistinct': ('sumCount', 'Distinct'), 'deltaSumDistinct': ('deltaSum', 'Distinct'), 'quantilesTimingDistinct': ('quantilesTiming', 'Distinct'), 'sumKahanDistinct': ('sumKahan', 'Distinct'), 'maxIntersectionsDistinct': ('maxIntersections', 'Distinct'), 'quantilesInterpolatedWeightedDistinct': ('quantilesInterpolatedWeighted', 'Distinct'), 'quantileInterpolatedWeightedDistinct': ('quantileInterpolatedWeighted', 'Distinct'), 'uniqDistinct': ('uniq', 'Distinct'), 'quantileExactHighDistinct': ('quantileExactHigh', 'Distinct'), 'groupBitAndDistinct': ('groupBitAnd', 'Distinct'), 'covarSampDistinct': ('covarSamp', 'Distinct'), 'quantilesDeterministicDistinct': ('quantilesDeterministic', 'Distinct'), 'topKDistinct': ('topK', 'Distinct'), 'simpleLinearRegressionDistinct': ('simpleLinearRegression', 'Distinct'), 'medianDistinct': ('median', 'Distinct'), 'topKWeightedDistinct': ('topKWeighted', 'Distinct'), 'quantileBFloat16WeightedDistinct': ('quantileBFloat16Weighted', 'Distinct'), 'quantilesGKDistinct': ('quantilesGK', 'Distinct'), 'argMinDistinct': ('argMin', 'Distinct'), 'quantilesBFloat16WeightedDistinct': ('quantilesBFloat16Weighted', 'Distinct'), 'quantilesBFloat16Distinct': ('quantilesBFloat16', 'Distinct'), 'skewSampDistinct': ('skewSamp', 'Distinct'), 'varPopDistinct': ('varPop', 'Distinct'), 'quantilesExactLowDistinct': ('quantilesExactLow', 'Distinct'), 'categoricalInformationValueDistinct': ('categoricalInformationValue', 'Distinct'), 'quantileTimingDistinct': ('quantileTiming', 'Distinct'), 'deltaSumTimestampDistinct': ('deltaSumTimestamp', 'Distinct'), 'quantilesDistinct': ('quantiles', 'Distinct'), 'contingencyDistinct': ('contingency', 'Distinct'), 'quantilesTDigestWeightedDistinct': ('quantilesTDigestWeighted', 'Distinct'), 'argMaxDistinct': ('argMax', 'Distinct'), 'anyHeavyDistinct': ('anyHeavy', 'Distinct'), 'meanZTestDistinct': ('meanZTest', 'Distinct'), 'quantileGKDistinct': ('quantileGK', 'Distinct'), 'maxIntersectionsPositionDistinct': ('maxIntersectionsPosition', 'Distinct'), 'studentTTestDistinct': ('studentTTest', 'Distinct'), 'quantilesExactWeightedDistinct': ('quantilesExactWeighted', 'Distinct'), 'quantileTDigestDistinct': ('quantileTDigest', 'Distinct'), 'covarPopDistinct': ('covarPop', 'Distinct'), 'groupBitmapXorDistinct': ('groupBitmapXor', 'Distinct'), 'theilsUDistinct': ('theilsU', 'Distinct'), 'anyDistinct': ('any', 'Distinct'), 'last_valueDistinct': ('last_value', 'Distinct'), 'quantileTimingWeightedDistinct': ('quantileTimingWeighted', 'Distinct'), 'skewPopDistinct': ('skewPop', 'Distinct'), 'stochasticLogisticRegressionDistinct': ('stochasticLogisticRegression', 'Distinct'), 'sumWithOverflowDistinct': ('sumWithOverflow', 'Distinct'), 'cramersVBiasCorrectedDistinct': ('cramersVBiasCorrected', 'Distinct'), 'groupBitXorDistinct': ('groupBitXor', 'Distinct'), 'countDistinct': ('count', 'Distinct'), 'sumMapDistinct': ('sumMap', 'Distinct'), 'groupBitmapDistinct': ('groupBitmap', 'Distinct'), 'stddevSampDistinct': ('stddevSamp', 'Distinct'), 'uniqHLL12Distinct': ('uniqHLL12', 'Distinct'), 'largestTriangleThreeBucketsDistinct': ('largestTriangleThreeBuckets', 'Distinct'), 'minMapDistinct': ('minMap', 'Distinct'), 'sparkBarDistinct': ('sparkBar', 'Distinct'), 'stddevPopDistinct': ('stddevPop', 'Distinct'), 'sequenceMatchDistinct': ('sequenceMatch', 'Distinct'), 'kurtSampDistinct': ('kurtSamp', 'Distinct'), 'anyLastDistinct': ('anyLast', 'Distinct'), 'groupArrayInsertAtDistinct': ('groupArrayInsertAt', 'Distinct'), 'uniqCombinedDistinct': ('uniqCombined', 'Distinct'), 'uniqThetaDistinct': ('uniqTheta', 'Distinct'), 'welchTTestDistinct': ('welchTTest', 'Distinct'), 'groupBitmapAndDistinct': ('groupBitmapAnd', 'Distinct'), 'sumDistinct': ('sum', 'Distinct'), 'quantilesExactHighDistinct': ('quantilesExactHigh', 'Distinct'), 'first_valueDistinct': ('first_value', 'Distinct'), 'exponentialTimeDecayedAvgDistinct': ('exponentialTimeDecayedAvg', 'Distinct'), 'quantilesExactDistinct': ('quantilesExact', 'Distinct'), 'uniqExactDistinct': ('uniqExact', 'Distinct'), 'groupArraySampleDistinct': ('groupArraySample', 'Distinct'), 'quantileTDigestWeightedDistinct': ('quantileTDigestWeighted', 'Distinct'), 'windowFunnelDistinct': ('windowFunnel', 'Distinct'), 'quantileDeterministicDistinct': ('quantileDeterministic', 'Distinct'), 'sequenceCountDistinct': ('sequenceCount', 'Distinct'), 'quantilesTDigestDistinct': ('quantilesTDigest', 'Distinct'), 'groupArrayLastDistinct': ('groupArrayLast', 'Distinct'), 'groupArrayMovingSumDistinct': ('groupArrayMovingSum', 'Distinct'), 'kolmogorovSmirnovTestOrDefault': ('kolmogorovSmirnovTest', 'OrDefault'), 'varSampOrDefault': ('varSamp', 'OrDefault'), 'corrOrDefault': ('corr', 'OrDefault'), 'quantileBFloat16OrDefault': ('quantileBFloat16', 'OrDefault'), 'avgWeightedOrDefault': ('avgWeighted', 'OrDefault'), 'sequenceNextNodeOrDefault': ('sequenceNextNode', 'OrDefault'), 'avgOrDefault': ('avg', 'OrDefault'), 'uniqCombined64OrDefault': ('uniqCombined64', 'OrDefault'), 'quantileOrDefault': ('quantile', 'OrDefault'), 'mannWhitneyUTestOrDefault': ('mannWhitneyUTest', 'OrDefault'), 'groupUniqArrayOrDefault': ('groupUniqArray', 'OrDefault'), 'intervalLengthSumOrDefault': ('intervalLengthSum', 'OrDefault'), 'rankCorrOrDefault': ('rankCorr', 'OrDefault'), 'quantileExactWeightedOrDefault': ('quantileExactWeighted', 'OrDefault'), 'stochasticLinearRegressionOrDefault': ('stochasticLinearRegression', 'OrDefault'), 'groupBitmapOrOrDefault': ('groupBitmapOr', 'OrDefault'), 'groupArrayMovingAvgOrDefault': ('groupArrayMovingAvg', 'OrDefault'), 'cramersVOrDefault': ('cramersV', 'OrDefault'), 'maxOrDefault': ('max', 'OrDefault'), 'kurtPopOrDefault': ('kurtPop', 'OrDefault'), 'groupArrayOrDefault': ('groupArray', 'OrDefault'), 'uniqUpToOrDefault': ('uniqUpTo', 'OrDefault'), 'quantileExactLowOrDefault': ('quantileExactLow', 'OrDefault'), 'groupBitOrOrDefault': ('groupBitOr', 'OrDefault'), 'exponentialMovingAverageOrDefault': ('exponentialMovingAverage', 'OrDefault'), 'entropyOrDefault': ('entropy', 'OrDefault'), 'minOrDefault': ('min', 'OrDefault'), 'quantileExactOrDefault': ('quantileExact', 'OrDefault'), 'histogramOrDefault': ('histogram', 'OrDefault'), 'quantilesTimingWeightedOrDefault': ('quantilesTimingWeighted', 'OrDefault'), 'retentionOrDefault': ('retention', 'OrDefault'), 'maxMapOrDefault': ('maxMap', 'OrDefault'), 'boundingRatioOrDefault': ('boundingRatio', 'OrDefault'), 'sumCountOrDefault': ('sumCount', 'OrDefault'), 'deltaSumOrDefault': ('deltaSum', 'OrDefault'), 'quantilesTimingOrDefault': ('quantilesTiming', 'OrDefault'), 'sumKahanOrDefault': ('sumKahan', 'OrDefault'), 'maxIntersectionsOrDefault': ('maxIntersections', 'OrDefault'), 'quantilesInterpolatedWeightedOrDefault': ('quantilesInterpolatedWeighted', 'OrDefault'), 'quantileInterpolatedWeightedOrDefault': ('quantileInterpolatedWeighted', 'OrDefault'), 'uniqOrDefault': ('uniq', 'OrDefault'), 'quantileExactHighOrDefault': ('quantileExactHigh', 'OrDefault'), 'groupBitAndOrDefault': ('groupBitAnd', 'OrDefault'), 'covarSampOrDefault': ('covarSamp', 'OrDefault'), 'quantilesDeterministicOrDefault': ('quantilesDeterministic', 'OrDefault'), 'topKOrDefault': ('topK', 'OrDefault'), 'simpleLinearRegressionOrDefault': ('simpleLinearRegression', 'OrDefault'), 'medianOrDefault': ('median', 'OrDefault'), 'topKWeightedOrDefault': ('topKWeighted', 'OrDefault'), 'quantileBFloat16WeightedOrDefault': ('quantileBFloat16Weighted', 'OrDefault'), 'quantilesGKOrDefault': ('quantilesGK', 'OrDefault'), 'argMinOrDefault': ('argMin', 'OrDefault'), 'quantilesBFloat16WeightedOrDefault': ('quantilesBFloat16Weighted', 'OrDefault'), 'quantilesBFloat16OrDefault': ('quantilesBFloat16', 'OrDefault'), 'skewSampOrDefault': ('skewSamp', 'OrDefault'), 'varPopOrDefault': ('varPop', 'OrDefault'), 'quantilesExactLowOrDefault': ('quantilesExactLow', 'OrDefault'), 'categoricalInformationValueOrDefault': ('categoricalInformationValue', 'OrDefault'), 'quantileTimingOrDefault': ('quantileTiming', 'OrDefault'), 'deltaSumTimestampOrDefault': ('deltaSumTimestamp', 'OrDefault'), 'quantilesOrDefault': ('quantiles', 'OrDefault'), 'contingencyOrDefault': ('contingency', 'OrDefault'), 'quantilesTDigestWeightedOrDefault': ('quantilesTDigestWeighted', 'OrDefault'), 'argMaxOrDefault': ('argMax', 'OrDefault'), 'anyHeavyOrDefault': ('anyHeavy', 'OrDefault'), 'meanZTestOrDefault': ('meanZTest', 'OrDefault'), 'quantileGKOrDefault': ('quantileGK', 'OrDefault'), 'maxIntersectionsPositionOrDefault': ('maxIntersectionsPosition', 'OrDefault'), 'studentTTestOrDefault': ('studentTTest', 'OrDefault'), 'quantilesExactWeightedOrDefault': ('quantilesExactWeighted', 'OrDefault'), 'quantileTDigestOrDefault': ('quantileTDigest', 'OrDefault'), 'covarPopOrDefault': ('covarPop', 'OrDefault'), 'groupBitmapXorOrDefault': ('groupBitmapXor', 'OrDefault'), 'theilsUOrDefault': ('theilsU', 'OrDefault'), 'anyOrDefault': ('any', 'OrDefault'), 'last_valueOrDefault': ('last_value', 'OrDefault'), 'quantileTimingWeightedOrDefault': ('quantileTimingWeighted', 'OrDefault'), 'skewPopOrDefault': ('skewPop', 'OrDefault'), 'stochasticLogisticRegressionOrDefault': ('stochasticLogisticRegression', 'OrDefault'), 'sumWithOverflowOrDefault': ('sumWithOverflow', 'OrDefault'), 'cramersVBiasCorrectedOrDefault': ('cramersVBiasCorrected', 'OrDefault'), 'groupBitXorOrDefault': ('groupBitXor', 'OrDefault'), 'countOrDefault': ('count', 'OrDefault'), 'sumMapOrDefault': ('sumMap', 'OrDefault'), 'groupBitmapOrDefault': ('groupBitmap', 'OrDefault'), 'stddevSampOrDefault': ('stddevSamp', 'OrDefault'), 'uniqHLL12OrDefault': ('uniqHLL12', 'OrDefault'), 'largestTriangleThreeBucketsOrDefault': ('largestTriangleThreeBuckets', 'OrDefault'), 'minMapOrDefault': ('minMap', 'OrDefault'), 'sparkBarOrDefault': ('sparkBar', 'OrDefault'), 'stddevPopOrDefault': ('stddevPop', 'OrDefault'), 'sequenceMatchOrDefault': ('sequenceMatch', 'OrDefault'), 'kurtSampOrDefault': ('kurtSamp', 'OrDefault'), 'anyLastOrDefault': ('anyLast', 'OrDefault'), 'groupArrayInsertAtOrDefault': ('groupArrayInsertAt', 'OrDefault'), 'uniqCombinedOrDefault': ('uniqCombined', 'OrDefault'), 'uniqThetaOrDefault': ('uniqTheta', 'OrDefault'), 'welchTTestOrDefault': ('welchTTest', 'OrDefault'), 'groupBitmapAndOrDefault': ('groupBitmapAnd', 'OrDefault'), 'sumOrDefault': ('sum', 'OrDefault'), 'quantilesExactHighOrDefault': ('quantilesExactHigh', 'OrDefault'), 'first_valueOrDefault': ('first_value', 'OrDefault'), 'exponentialTimeDecayedAvgOrDefault': ('exponentialTimeDecayedAvg', 'OrDefault'), 'quantilesExactOrDefault': ('quantilesExact', 'OrDefault'), 'uniqExactOrDefault': ('uniqExact', 'OrDefault'), 'groupArraySampleOrDefault': ('groupArraySample', 'OrDefault'), 'quantileTDigestWeightedOrDefault': ('quantileTDigestWeighted', 'OrDefault'), 'windowFunnelOrDefault': ('windowFunnel', 'OrDefault'), 'quantileDeterministicOrDefault': ('quantileDeterministic', 'OrDefault'), 'sequenceCountOrDefault': ('sequenceCount', 'OrDefault'), 'quantilesTDigestOrDefault': ('quantilesTDigest', 'OrDefault'), 'groupArrayLastOrDefault': ('groupArrayLast', 'OrDefault'), 'groupArrayMovingSumOrDefault': ('groupArrayMovingSum', 'OrDefault'), 'kolmogorovSmirnovTestOrNull': ('kolmogorovSmirnovTest', 'OrNull'), 'varSampOrNull': ('varSamp', 'OrNull'), 'corrOrNull': ('corr', 'OrNull'), 'quantileBFloat16OrNull': ('quantileBFloat16', 'OrNull'), 'avgWeightedOrNull': ('avgWeighted', 'OrNull'), 'sequenceNextNodeOrNull': ('sequenceNextNode', 'OrNull'), 'avgOrNull': ('avg', 'OrNull'), 'uniqCombined64OrNull': ('uniqCombined64', 'OrNull'), 'quantileOrNull': ('quantile', 'OrNull'), 'mannWhitneyUTestOrNull': ('mannWhitneyUTest', 'OrNull'), 'groupUniqArrayOrNull': ('groupUniqArray', 'OrNull'), 'intervalLengthSumOrNull': ('intervalLengthSum', 'OrNull'), 'rankCorrOrNull': ('rankCorr', 'OrNull'), 'quantileExactWeightedOrNull': ('quantileExactWeighted', 'OrNull'), 'stochasticLinearRegressionOrNull': ('stochasticLinearRegression', 'OrNull'), 'groupBitmapOrOrNull': ('groupBitmapOr', 'OrNull'), 'groupArrayMovingAvgOrNull': ('groupArrayMovingAvg', 'OrNull'), 'cramersVOrNull': ('cramersV', 'OrNull'), 'maxOrNull': ('max', 'OrNull'), 'kurtPopOrNull': ('kurtPop', 'OrNull'), 'groupArrayOrNull': ('groupArray', 'OrNull'), 'uniqUpToOrNull': ('uniqUpTo', 'OrNull'), 'quantileExactLowOrNull': ('quantileExactLow', 'OrNull'), 'groupBitOrOrNull': ('groupBitOr', 'OrNull'), 'exponentialMovingAverageOrNull': ('exponentialMovingAverage', 'OrNull'), 'entropyOrNull': ('entropy', 'OrNull'), 'minOrNull': ('min', 'OrNull'), 'quantileExactOrNull': ('quantileExact', 'OrNull'), 'histogramOrNull': ('histogram', 'OrNull'), 'quantilesTimingWeightedOrNull': ('quantilesTimingWeighted', 'OrNull'), 'retentionOrNull': ('retention', 'OrNull'), 'maxMapOrNull': ('maxMap', 'OrNull'), 'boundingRatioOrNull': ('boundingRatio', 'OrNull'), 'sumCountOrNull': ('sumCount', 'OrNull'), 'deltaSumOrNull': ('deltaSum', 'OrNull'), 'quantilesTimingOrNull': ('quantilesTiming', 'OrNull'), 'sumKahanOrNull': ('sumKahan', 'OrNull'), 'maxIntersectionsOrNull': ('maxIntersections', 'OrNull'), 'quantilesInterpolatedWeightedOrNull': ('quantilesInterpolatedWeighted', 'OrNull'), 'quantileInterpolatedWeightedOrNull': ('quantileInterpolatedWeighted', 'OrNull'), 'uniqOrNull': ('uniq', 'OrNull'), 'quantileExactHighOrNull': ('quantileExactHigh', 'OrNull'), 'groupBitAndOrNull': ('groupBitAnd', 'OrNull'), 'covarSampOrNull': ('covarSamp', 'OrNull'), 'quantilesDeterministicOrNull': ('quantilesDeterministic', 'OrNull'), 'topKOrNull': ('topK', 'OrNull'), 'simpleLinearRegressionOrNull': ('simpleLinearRegression', 'OrNull'), 'medianOrNull': ('median', 'OrNull'), 'topKWeightedOrNull': ('topKWeighted', 'OrNull'), 'quantileBFloat16WeightedOrNull': ('quantileBFloat16Weighted', 'OrNull'), 'quantilesGKOrNull': ('quantilesGK', 'OrNull'), 'argMinOrNull': ('argMin', 'OrNull'), 'quantilesBFloat16WeightedOrNull': ('quantilesBFloat16Weighted', 'OrNull'), 'quantilesBFloat16OrNull': ('quantilesBFloat16', 'OrNull'), 'skewSampOrNull': ('skewSamp', 'OrNull'), 'varPopOrNull': ('varPop', 'OrNull'), 'quantilesExactLowOrNull': ('quantilesExactLow', 'OrNull'), 'categoricalInformationValueOrNull': ('categoricalInformationValue', 'OrNull'), 'quantileTimingOrNull': ('quantileTiming', 'OrNull'), 'deltaSumTimestampOrNull': ('deltaSumTimestamp', 'OrNull'), 'quantilesOrNull': ('quantiles', 'OrNull'), 'contingencyOrNull': ('contingency', 'OrNull'), 'quantilesTDigestWeightedOrNull': ('quantilesTDigestWeighted', 'OrNull'), 'argMaxOrNull': ('argMax', 'OrNull'), 'anyHeavyOrNull': ('anyHeavy', 'OrNull'), 'meanZTestOrNull': ('meanZTest', 'OrNull'), 'quantileGKOrNull': ('quantileGK', 'OrNull'), 'maxIntersectionsPositionOrNull': ('maxIntersectionsPosition', 'OrNull'), 'studentTTestOrNull': ('studentTTest', 'OrNull'), 'quantilesExactWeightedOrNull': ('quantilesExactWeighted', 'OrNull'), 'quantileTDigestOrNull': ('quantileTDigest', 'OrNull'), 'covarPopOrNull': ('covarPop', 'OrNull'), 'groupBitmapXorOrNull': ('groupBitmapXor', 'OrNull'), 'theilsUOrNull': ('theilsU', 'OrNull'), 'anyOrNull': ('any', 'OrNull'), 'last_valueOrNull': ('last_value', 'OrNull'), 'quantileTimingWeightedOrNull': ('quantileTimingWeighted', 'OrNull'), 'skewPopOrNull': ('skewPop', 'OrNull'), 'stochasticLogisticRegressionOrNull': ('stochasticLogisticRegression', 'OrNull'), 'sumWithOverflowOrNull': ('sumWithOverflow', 'OrNull'), 'cramersVBiasCorrectedOrNull': ('cramersVBiasCorrected', 'OrNull'), 'groupBitXorOrNull': ('groupBitXor', 'OrNull'), 'countOrNull': ('count', 'OrNull'), 'sumMapOrNull': ('sumMap', 'OrNull'), 'groupBitmapOrNull': ('groupBitmap', 'OrNull'), 'stddevSampOrNull': ('stddevSamp', 'OrNull'), 'uniqHLL12OrNull': ('uniqHLL12', 'OrNull'), 'largestTriangleThreeBucketsOrNull': ('largestTriangleThreeBuckets', 'OrNull'), 'minMapOrNull': ('minMap', 'OrNull'), 'sparkBarOrNull': ('sparkBar', 'OrNull'), 'stddevPopOrNull': ('stddevPop', 'OrNull'), 'sequenceMatchOrNull': ('sequenceMatch', 'OrNull'), 'kurtSampOrNull': ('kurtSamp', 'OrNull'), 'anyLastOrNull': ('anyLast', 'OrNull'), 'groupArrayInsertAtOrNull': ('groupArrayInsertAt', 'OrNull'), 'uniqCombinedOrNull': ('uniqCombined', 'OrNull'), 'uniqThetaOrNull': ('uniqTheta', 'OrNull'), 'welchTTestOrNull': ('welchTTest', 'OrNull'), 'groupBitmapAndOrNull': ('groupBitmapAnd', 'OrNull'), 'sumOrNull': ('sum', 'OrNull'), 'quantilesExactHighOrNull': ('quantilesExactHigh', 'OrNull'), 'first_valueOrNull': ('first_value', 'OrNull'), 'exponentialTimeDecayedAvgOrNull': ('exponentialTimeDecayedAvg', 'OrNull'), 'quantilesExactOrNull': ('quantilesExact', 'OrNull'), 'uniqExactOrNull': ('uniqExact', 'OrNull'), 'groupArraySampleOrNull': ('groupArraySample', 'OrNull'), 'quantileTDigestWeightedOrNull': ('quantileTDigestWeighted', 'OrNull'), 'windowFunnelOrNull': ('windowFunnel', 'OrNull'), 'quantileDeterministicOrNull': ('quantileDeterministic', 'OrNull'), 'sequenceCountOrNull': ('sequenceCount', 'OrNull'), 'quantilesTDigestOrNull': ('quantilesTDigest', 'OrNull'), 'groupArrayLastOrNull': ('groupArrayLast', 'OrNull'), 'groupArrayMovingSumOrNull': ('groupArrayMovingSum', 'OrNull'), 'kolmogorovSmirnovTestResample': ('kolmogorovSmirnovTest', 'Resample'), 'varSampResample': ('varSamp', 'Resample'), 'corrResample': ('corr', 'Resample'), 'quantileBFloat16Resample': ('quantileBFloat16', 'Resample'), 'avgWeightedResample': ('avgWeighted', 'Resample'), 'sequenceNextNodeResample': ('sequenceNextNode', 'Resample'), 'avgResample': ('avg', 'Resample'), 'uniqCombined64Resample': ('uniqCombined64', 'Resample'), 'quantileResample': ('quantile', 'Resample'), 'mannWhitneyUTestResample': ('mannWhitneyUTest', 'Resample'), 'groupUniqArrayResample': ('groupUniqArray', 'Resample'), 'intervalLengthSumResample': ('intervalLengthSum', 'Resample'), 'rankCorrResample': ('rankCorr', 'Resample'), 'quantileExactWeightedResample': ('quantileExactWeighted', 'Resample'), 'stochasticLinearRegressionResample': ('stochasticLinearRegression', 'Resample'), 'groupBitmapOrResample': ('groupBitmapOr', 'Resample'), 'groupArrayMovingAvgResample': ('groupArrayMovingAvg', 'Resample'), 'cramersVResample': ('cramersV', 'Resample'), 'maxResample': ('max', 'Resample'), 'kurtPopResample': ('kurtPop', 'Resample'), 'groupArrayResample': ('groupArray', 'Resample'), 'uniqUpToResample': ('uniqUpTo', 'Resample'), 'quantileExactLowResample': ('quantileExactLow', 'Resample'), 'groupBitOrResample': ('groupBitOr', 'Resample'), 'exponentialMovingAverageResample': ('exponentialMovingAverage', 'Resample'), 'entropyResample': ('entropy', 'Resample'), 'minResample': ('min', 'Resample'), 'quantileExactResample': ('quantileExact', 'Resample'), 'histogramResample': ('histogram', 'Resample'), 'quantilesTimingWeightedResample': ('quantilesTimingWeighted', 'Resample'), 'retentionResample': ('retention', 'Resample'), 'maxMapResample': ('maxMap', 'Resample'), 'boundingRatioResample': ('boundingRatio', 'Resample'), 'sumCountResample': ('sumCount', 'Resample'), 'deltaSumResample': ('deltaSum', 'Resample'), 'quantilesTimingResample': ('quantilesTiming', 'Resample'), 'sumKahanResample': ('sumKahan', 'Resample'), 'maxIntersectionsResample': ('maxIntersections', 'Resample'), 'quantilesInterpolatedWeightedResample': ('quantilesInterpolatedWeighted', 'Resample'), 'quantileInterpolatedWeightedResample': ('quantileInterpolatedWeighted', 'Resample'), 'uniqResample': ('uniq', 'Resample'), 'quantileExactHighResample': ('quantileExactHigh', 'Resample'), 'groupBitAndResample': ('groupBitAnd', 'Resample'), 'covarSampResample': ('covarSamp', 'Resample'), 'quantilesDeterministicResample': ('quantilesDeterministic', 'Resample'), 'topKResample': ('topK', 'Resample'), 'simpleLinearRegressionResample': ('simpleLinearRegression', 'Resample'), 'medianResample': ('median', 'Resample'), 'topKWeightedResample': ('topKWeighted', 'Resample'), 'quantileBFloat16WeightedResample': ('quantileBFloat16Weighted', 'Resample'), 'quantilesGKResample': ('quantilesGK', 'Resample'), 'argMinResample': ('argMin', 'Resample'), 'quantilesBFloat16WeightedResample': ('quantilesBFloat16Weighted', 'Resample'), 'quantilesBFloat16Resample': ('quantilesBFloat16', 'Resample'), 'skewSampResample': ('skewSamp', 'Resample'), 'varPopResample': ('varPop', 'Resample'), 'quantilesExactLowResample': ('quantilesExactLow', 'Resample'), 'categoricalInformationValueResample': ('categoricalInformationValue', 'Resample'), 'quantileTimingResample': ('quantileTiming', 'Resample'), 'deltaSumTimestampResample': ('deltaSumTimestamp', 'Resample'), 'quantilesResample': ('quantiles', 'Resample'), 'contingencyResample': ('contingency', 'Resample'), 'quantilesTDigestWeightedResample': ('quantilesTDigestWeighted', 'Resample'), 'argMaxResample': ('argMax', 'Resample'), 'anyHeavyResample': ('anyHeavy', 'Resample'), 'meanZTestResample': ('meanZTest', 'Resample'), 'quantileGKResample': ('quantileGK', 'Resample'), 'maxIntersectionsPositionResample': ('maxIntersectionsPosition', 'Resample'), 'studentTTestResample': ('studentTTest', 'Resample'), 'quantilesExactWeightedResample': ('quantilesExactWeighted', 'Resample'), 'quantileTDigestResample': ('quantileTDigest', 'Resample'), 'covarPopResample': ('covarPop', 'Resample'), 'groupBitmapXorResample': ('groupBitmapXor', 'Resample'), 'theilsUResample': ('theilsU', 'Resample'), 'anyResample': ('any', 'Resample'), 'last_valueResample': ('last_value', 'Resample'), 'quantileTimingWeightedResample': ('quantileTimingWeighted', 'Resample'), 'skewPopResample': ('skewPop', 'Resample'), 'stochasticLogisticRegressionResample': ('stochasticLogisticRegression', 'Resample'), 'sumWithOverflowResample': ('sumWithOverflow', 'Resample'), 'cramersVBiasCorrectedResample': ('cramersVBiasCorrected', 'Resample'), 'groupBitXorResample': ('groupBitXor', 'Resample'), 'countResample': ('count', 'Resample'), 'sumMapResample': ('sumMap', 'Resample'), 'groupBitmapResample': ('groupBitmap', 'Resample'), 'stddevSampResample': ('stddevSamp', 'Resample'), 'uniqHLL12Resample': ('uniqHLL12', 'Resample'), 'largestTriangleThreeBucketsResample': ('largestTriangleThreeBuckets', 'Resample'), 'minMapResample': ('minMap', 'Resample'), 'sparkBarResample': ('sparkBar', 'Resample'), 'stddevPopResample': ('stddevPop', 'Resample'), 'sequenceMatchResample': ('sequenceMatch', 'Resample'), 'kurtSampResample': ('kurtSamp', 'Resample'), 'anyLastResample': ('anyLast', 'Resample'), 'groupArrayInsertAtResample': ('groupArrayInsertAt', 'Resample'), 'uniqCombinedResample': ('uniqCombined', 'Resample'), 'uniqThetaResample': ('uniqTheta', 'Resample'), 'welchTTestResample': ('welchTTest', 'Resample'), 'groupBitmapAndResample': ('groupBitmapAnd', 'Resample'), 'sumResample': ('sum', 'Resample'), 'quantilesExactHighResample': ('quantilesExactHigh', 'Resample'), 'first_valueResample': ('first_value', 'Resample'), 'exponentialTimeDecayedAvgResample': ('exponentialTimeDecayedAvg', 'Resample'), 'quantilesExactResample': ('quantilesExact', 'Resample'), 'uniqExactResample': ('uniqExact', 'Resample'), 'groupArraySampleResample': ('groupArraySample', 'Resample'), 'quantileTDigestWeightedResample': ('quantileTDigestWeighted', 'Resample'), 'windowFunnelResample': ('windowFunnel', 'Resample'), 'quantileDeterministicResample': ('quantileDeterministic', 'Resample'), 'sequenceCountResample': ('sequenceCount', 'Resample'), 'quantilesTDigestResample': ('quantilesTDigest', 'Resample'), 'groupArrayLastResample': ('groupArrayLast', 'Resample'), 'groupArrayMovingSumResample': ('groupArrayMovingSum', 'Resample'), 'kolmogorovSmirnovTestArgMin': ('kolmogorovSmirnovTest', 'ArgMin'), 'varSampArgMin': ('varSamp', 'ArgMin'), 'corrArgMin': ('corr', 'ArgMin'), 'quantileBFloat16ArgMin': ('quantileBFloat16', 'ArgMin'), 'avgWeightedArgMin': ('avgWeighted', 'ArgMin'), 'sequenceNextNodeArgMin': ('sequenceNextNode', 'ArgMin'), 'avgArgMin': ('avg', 'ArgMin'), 'uniqCombined64ArgMin': ('uniqCombined64', 'ArgMin'), 'quantileArgMin': ('quantile', 'ArgMin'), 'mannWhitneyUTestArgMin': ('mannWhitneyUTest', 'ArgMin'), 'groupUniqArrayArgMin': ('groupUniqArray', 'ArgMin'), 'intervalLengthSumArgMin': ('intervalLengthSum', 'ArgMin'), 'rankCorrArgMin': ('rankCorr', 'ArgMin'), 'quantileExactWeightedArgMin': ('quantileExactWeighted', 'ArgMin'), 'stochasticLinearRegressionArgMin': ('stochasticLinearRegression', 'ArgMin'), 'groupBitmapOrArgMin': ('groupBitmapOr', 'ArgMin'), 'groupArrayMovingAvgArgMin': ('groupArrayMovingAvg', 'ArgMin'), 'cramersVArgMin': ('cramersV', 'ArgMin'), 'maxArgMin': ('max', 'ArgMin'), 'kurtPopArgMin': ('kurtPop', 'ArgMin'), 'groupArrayArgMin': ('groupArray', 'ArgMin'), 'uniqUpToArgMin': ('uniqUpTo', 'ArgMin'), 'quantileExactLowArgMin': ('quantileExactLow', 'ArgMin'), 'groupBitOrArgMin': ('groupBitOr', 'ArgMin'), 'exponentialMovingAverageArgMin': ('exponentialMovingAverage', 'ArgMin'), 'entropyArgMin': ('entropy', 'ArgMin'), 'minArgMin': ('min', 'ArgMin'), 'quantileExactArgMin': ('quantileExact', 'ArgMin'), 'histogramArgMin': ('histogram', 'ArgMin'), 'quantilesTimingWeightedArgMin': ('quantilesTimingWeighted', 'ArgMin'), 'retentionArgMin': ('retention', 'ArgMin'), 'maxMapArgMin': ('maxMap', 'ArgMin'), 'boundingRatioArgMin': ('boundingRatio', 'ArgMin'), 'sumCountArgMin': ('sumCount', 'ArgMin'), 'deltaSumArgMin': ('deltaSum', 'ArgMin'), 'quantilesTimingArgMin': ('quantilesTiming', 'ArgMin'), 'sumKahanArgMin': ('sumKahan', 'ArgMin'), 'maxIntersectionsArgMin': ('maxIntersections', 'ArgMin'), 'quantilesInterpolatedWeightedArgMin': ('quantilesInterpolatedWeighted', 'ArgMin'), 'quantileInterpolatedWeightedArgMin': ('quantileInterpolatedWeighted', 'ArgMin'), 'uniqArgMin': ('uniq', 'ArgMin'), 'quantileExactHighArgMin': ('quantileExactHigh', 'ArgMin'), 'groupBitAndArgMin': ('groupBitAnd', 'ArgMin'), 'covarSampArgMin': ('covarSamp', 'ArgMin'), 'quantilesDeterministicArgMin': ('quantilesDeterministic', 'ArgMin'), 'topKArgMin': ('topK', 'ArgMin'), 'simpleLinearRegressionArgMin': ('simpleLinearRegression', 'ArgMin'), 'medianArgMin': ('median', 'ArgMin'), 'topKWeightedArgMin': ('topKWeighted', 'ArgMin'), 'quantileBFloat16WeightedArgMin': ('quantileBFloat16Weighted', 'ArgMin'), 'quantilesGKArgMin': ('quantilesGK', 'ArgMin'), 'argMinArgMin': ('argMin', 'ArgMin'), 'quantilesBFloat16WeightedArgMin': ('quantilesBFloat16Weighted', 'ArgMin'), 'quantilesBFloat16ArgMin': ('quantilesBFloat16', 'ArgMin'), 'skewSampArgMin': ('skewSamp', 'ArgMin'), 'varPopArgMin': ('varPop', 'ArgMin'), 'quantilesExactLowArgMin': ('quantilesExactLow', 'ArgMin'), 'categoricalInformationValueArgMin': ('categoricalInformationValue', 'ArgMin'), 'quantileTimingArgMin': ('quantileTiming', 'ArgMin'), 'deltaSumTimestampArgMin': ('deltaSumTimestamp', 'ArgMin'), 'quantilesArgMin': ('quantiles', 'ArgMin'), 'contingencyArgMin': ('contingency', 'ArgMin'), 'quantilesTDigestWeightedArgMin': ('quantilesTDigestWeighted', 'ArgMin'), 'argMaxArgMin': ('argMax', 'ArgMin'), 'anyHeavyArgMin': ('anyHeavy', 'ArgMin'), 'meanZTestArgMin': ('meanZTest', 'ArgMin'), 'quantileGKArgMin': ('quantileGK', 'ArgMin'), 'maxIntersectionsPositionArgMin': ('maxIntersectionsPosition', 'ArgMin'), 'studentTTestArgMin': ('studentTTest', 'ArgMin'), 'quantilesExactWeightedArgMin': ('quantilesExactWeighted', 'ArgMin'), 'quantileTDigestArgMin': ('quantileTDigest', 'ArgMin'), 'covarPopArgMin': ('covarPop', 'ArgMin'), 'groupBitmapXorArgMin': ('groupBitmapXor', 'ArgMin'), 'theilsUArgMin': ('theilsU', 'ArgMin'), 'anyArgMin': ('any', 'ArgMin'), 'last_valueArgMin': ('last_value', 'ArgMin'), 'quantileTimingWeightedArgMin': ('quantileTimingWeighted', 'ArgMin'), 'skewPopArgMin': ('skewPop', 'ArgMin'), 'stochasticLogisticRegressionArgMin': ('stochasticLogisticRegression', 'ArgMin'), 'sumWithOverflowArgMin': ('sumWithOverflow', 'ArgMin'), 'cramersVBiasCorrectedArgMin': ('cramersVBiasCorrected', 'ArgMin'), 'groupBitXorArgMin': ('groupBitXor', 'ArgMin'), 'countArgMin': ('count', 'ArgMin'), 'sumMapArgMin': ('sumMap', 'ArgMin'), 'groupBitmapArgMin': ('groupBitmap', 'ArgMin'), 'stddevSampArgMin': ('stddevSamp', 'ArgMin'), 'uniqHLL12ArgMin': ('uniqHLL12', 'ArgMin'), 'largestTriangleThreeBucketsArgMin': ('largestTriangleThreeBuckets', 'ArgMin'), 'minMapArgMin': ('minMap', 'ArgMin'), 'sparkBarArgMin': ('sparkBar', 'ArgMin'), 'stddevPopArgMin': ('stddevPop', 'ArgMin'), 'sequenceMatchArgMin': ('sequenceMatch', 'ArgMin'), 'kurtSampArgMin': ('kurtSamp', 'ArgMin'), 'anyLastArgMin': ('anyLast', 'ArgMin'), 'groupArrayInsertAtArgMin': ('groupArrayInsertAt', 'ArgMin'), 'uniqCombinedArgMin': ('uniqCombined', 'ArgMin'), 'uniqThetaArgMin': ('uniqTheta', 'ArgMin'), 'welchTTestArgMin': ('welchTTest', 'ArgMin'), 'groupBitmapAndArgMin': ('groupBitmapAnd', 'ArgMin'), 'sumArgMin': ('sum', 'ArgMin'), 'quantilesExactHighArgMin': ('quantilesExactHigh', 'ArgMin'), 'first_valueArgMin': ('first_value', 'ArgMin'), 'exponentialTimeDecayedAvgArgMin': ('exponentialTimeDecayedAvg', 'ArgMin'), 'quantilesExactArgMin': ('quantilesExact', 'ArgMin'), 'uniqExactArgMin': ('uniqExact', 'ArgMin'), 'groupArraySampleArgMin': ('groupArraySample', 'ArgMin'), 'quantileTDigestWeightedArgMin': ('quantileTDigestWeighted', 'ArgMin'), 'windowFunnelArgMin': ('windowFunnel', 'ArgMin'), 'quantileDeterministicArgMin': ('quantileDeterministic', 'ArgMin'), 'sequenceCountArgMin': ('sequenceCount', 'ArgMin'), 'quantilesTDigestArgMin': ('quantilesTDigest', 'ArgMin'), 'groupArrayLastArgMin': ('groupArrayLast', 'ArgMin'), 'groupArrayMovingSumArgMin': ('groupArrayMovingSum', 'ArgMin'), 'kolmogorovSmirnovTestArgMax': ('kolmogorovSmirnovTest', 'ArgMax'), 'varSampArgMax': ('varSamp', 'ArgMax'), 'corrArgMax': ('corr', 'ArgMax'), 'quantileBFloat16ArgMax': ('quantileBFloat16', 'ArgMax'), 'avgWeightedArgMax': ('avgWeighted', 'ArgMax'), 'sequenceNextNodeArgMax': ('sequenceNextNode', 'ArgMax'), 'avgArgMax': ('avg', 'ArgMax'), 'uniqCombined64ArgMax': ('uniqCombined64', 'ArgMax'), 'quantileArgMax': ('quantile', 'ArgMax'), 'mannWhitneyUTestArgMax': ('mannWhitneyUTest', 'ArgMax'), 'groupUniqArrayArgMax': ('groupUniqArray', 'ArgMax'), 'intervalLengthSumArgMax': ('intervalLengthSum', 'ArgMax'), 'rankCorrArgMax': ('rankCorr', 'ArgMax'), 'quantileExactWeightedArgMax': ('quantileExactWeighted', 'ArgMax'), 'stochasticLinearRegressionArgMax': ('stochasticLinearRegression', 'ArgMax'), 'groupBitmapOrArgMax': ('groupBitmapOr', 'ArgMax'), 'groupArrayMovingAvgArgMax': ('groupArrayMovingAvg', 'ArgMax'), 'cramersVArgMax': ('cramersV', 'ArgMax'), 'maxArgMax': ('max', 'ArgMax'), 'kurtPopArgMax': ('kurtPop', 'ArgMax'), 'groupArrayArgMax': ('groupArray', 'ArgMax'), 'uniqUpToArgMax': ('uniqUpTo', 'ArgMax'), 'quantileExactLowArgMax': ('quantileExactLow', 'ArgMax'), 'groupBitOrArgMax': ('groupBitOr', 'ArgMax'), 'exponentialMovingAverageArgMax': ('exponentialMovingAverage', 'ArgMax'), 'entropyArgMax': ('entropy', 'ArgMax'), 'minArgMax': ('min', 'ArgMax'), 'quantileExactArgMax': ('quantileExact', 'ArgMax'), 'histogramArgMax': ('histogram', 'ArgMax'), 'quantilesTimingWeightedArgMax': ('quantilesTimingWeighted', 'ArgMax'), 'retentionArgMax': ('retention', 'ArgMax'), 'maxMapArgMax': ('maxMap', 'ArgMax'), 'boundingRatioArgMax': ('boundingRatio', 'ArgMax'), 'sumCountArgMax': ('sumCount', 'ArgMax'), 'deltaSumArgMax': ('deltaSum', 'ArgMax'), 'quantilesTimingArgMax': ('quantilesTiming', 'ArgMax'), 'sumKahanArgMax': ('sumKahan', 'ArgMax'), 'maxIntersectionsArgMax': ('maxIntersections', 'ArgMax'), 'quantilesInterpolatedWeightedArgMax': ('quantilesInterpolatedWeighted', 'ArgMax'), 'quantileInterpolatedWeightedArgMax': ('quantileInterpolatedWeighted', 'ArgMax'), 'uniqArgMax': ('uniq', 'ArgMax'), 'quantileExactHighArgMax': ('quantileExactHigh', 'ArgMax'), 'groupBitAndArgMax': ('groupBitAnd', 'ArgMax'), 'covarSampArgMax': ('covarSamp', 'ArgMax'), 'quantilesDeterministicArgMax': ('quantilesDeterministic', 'ArgMax'), 'topKArgMax': ('topK', 'ArgMax'), 'simpleLinearRegressionArgMax': ('simpleLinearRegression', 'ArgMax'), 'medianArgMax': ('median', 'ArgMax'), 'topKWeightedArgMax': ('topKWeighted', 'ArgMax'), 'quantileBFloat16WeightedArgMax': ('quantileBFloat16Weighted', 'ArgMax'), 'quantilesGKArgMax': ('quantilesGK', 'ArgMax'), 'argMinArgMax': ('argMin', 'ArgMax'), 'quantilesBFloat16WeightedArgMax': ('quantilesBFloat16Weighted', 'ArgMax'), 'quantilesBFloat16ArgMax': ('quantilesBFloat16', 'ArgMax'), 'skewSampArgMax': ('skewSamp', 'ArgMax'), 'varPopArgMax': ('varPop', 'ArgMax'), 'quantilesExactLowArgMax': ('quantilesExactLow', 'ArgMax'), 'categoricalInformationValueArgMax': ('categoricalInformationValue', 'ArgMax'), 'quantileTimingArgMax': ('quantileTiming', 'ArgMax'), 'deltaSumTimestampArgMax': ('deltaSumTimestamp', 'ArgMax'), 'quantilesArgMax': ('quantiles', 'ArgMax'), 'contingencyArgMax': ('contingency', 'ArgMax'), 'quantilesTDigestWeightedArgMax': ('quantilesTDigestWeighted', 'ArgMax'), 'argMaxArgMax': ('argMax', 'ArgMax'), 'anyHeavyArgMax': ('anyHeavy', 'ArgMax'), 'meanZTestArgMax': ('meanZTest', 'ArgMax'), 'quantileGKArgMax': ('quantileGK', 'ArgMax'), 'maxIntersectionsPositionArgMax': ('maxIntersectionsPosition', 'ArgMax'), 'studentTTestArgMax': ('studentTTest', 'ArgMax'), 'quantilesExactWeightedArgMax': ('quantilesExactWeighted', 'ArgMax'), 'quantileTDigestArgMax': ('quantileTDigest', 'ArgMax'), 'covarPopArgMax': ('covarPop', 'ArgMax'), 'groupBitmapXorArgMax': ('groupBitmapXor', 'ArgMax'), 'theilsUArgMax': ('theilsU', 'ArgMax'), 'anyArgMax': ('any', 'ArgMax'), 'last_valueArgMax': ('last_value', 'ArgMax'), 'quantileTimingWeightedArgMax': ('quantileTimingWeighted', 'ArgMax'), 'skewPopArgMax': ('skewPop', 'ArgMax'), 'stochasticLogisticRegressionArgMax': ('stochasticLogisticRegression', 'ArgMax'), 'sumWithOverflowArgMax': ('sumWithOverflow', 'ArgMax'), 'cramersVBiasCorrectedArgMax': ('cramersVBiasCorrected', 'ArgMax'), 'groupBitXorArgMax': ('groupBitXor', 'ArgMax'), 'countArgMax': ('count', 'ArgMax'), 'sumMapArgMax': ('sumMap', 'ArgMax'), 'groupBitmapArgMax': ('groupBitmap', 'ArgMax'), 'stddevSampArgMax': ('stddevSamp', 'ArgMax'), 'uniqHLL12ArgMax': ('uniqHLL12', 'ArgMax'), 'largestTriangleThreeBucketsArgMax': ('largestTriangleThreeBuckets', 'ArgMax'), 'minMapArgMax': ('minMap', 'ArgMax'), 'sparkBarArgMax': ('sparkBar', 'ArgMax'), 'stddevPopArgMax': ('stddevPop', 'ArgMax'), 'sequenceMatchArgMax': ('sequenceMatch', 'ArgMax'), 'kurtSampArgMax': ('kurtSamp', 'ArgMax'), 'anyLastArgMax': ('anyLast', 'ArgMax'), 'groupArrayInsertAtArgMax': ('groupArrayInsertAt', 'ArgMax'), 'uniqCombinedArgMax': ('uniqCombined', 'ArgMax'), 'uniqThetaArgMax': ('uniqTheta', 'ArgMax'), 'welchTTestArgMax': ('welchTTest', 'ArgMax'), 'groupBitmapAndArgMax': ('groupBitmapAnd', 'ArgMax'), 'sumArgMax': ('sum', 'ArgMax'), 'quantilesExactHighArgMax': ('quantilesExactHigh', 'ArgMax'), 'first_valueArgMax': ('first_value', 'ArgMax'), 'exponentialTimeDecayedAvgArgMax': ('exponentialTimeDecayedAvg', 'ArgMax'), 'quantilesExactArgMax': ('quantilesExact', 'ArgMax'), 'uniqExactArgMax': ('uniqExact', 'ArgMax'), 'groupArraySampleArgMax': ('groupArraySample', 'ArgMax'), 'quantileTDigestWeightedArgMax': ('quantileTDigestWeighted', 'ArgMax'), 'windowFunnelArgMax': ('windowFunnel', 'ArgMax'), 'quantileDeterministicArgMax': ('quantileDeterministic', 'ArgMax'), 'sequenceCountArgMax': ('sequenceCount', 'ArgMax'), 'quantilesTDigestArgMax': ('quantilesTDigest', 'ArgMax'), 'groupArrayLastArgMax': ('groupArrayLast', 'ArgMax'), 'groupArrayMovingSumArgMax': ('groupArrayMovingSum', 'ArgMax'), 'kolmogorovSmirnovTest': ('kolmogorovSmirnovTest', ''), 'varSamp': ('varSamp', ''), 'corr': ('corr', ''), 'quantileBFloat16': ('quantileBFloat16', ''), 'avgWeighted': ('avgWeighted', ''), 'sequenceNextNode': ('sequenceNextNode', ''), 'avg': ('avg', ''), 'uniqCombined64': ('uniqCombined64', ''), 'quantile': ('quantile', ''), 'mannWhitneyUTest': ('mannWhitneyUTest', ''), 'groupUniqArray': ('groupUniqArray', ''), 'intervalLengthSum': ('intervalLengthSum', ''), 'rankCorr': ('rankCorr', ''), 'quantileExactWeighted': ('quantileExactWeighted', ''), 'stochasticLinearRegression': ('stochasticLinearRegression', ''), 'groupBitmapOr': ('groupBitmapOr', ''), 'groupArrayMovingAvg': ('groupArrayMovingAvg', ''), 'cramersV': ('cramersV', ''), 'max': ('max', ''), 'kurtPop': ('kurtPop', ''), 'groupArray': ('groupArray', ''), 'uniqUpTo': ('uniqUpTo', ''), 'quantileExactLow': ('quantileExactLow', ''), 'groupBitOr': ('groupBitOr', ''), 'exponentialMovingAverage': ('exponentialMovingAverage', ''), 'entropy': ('entropy', ''), 'min': ('min', ''), 'quantileExact': ('quantileExact', ''), 'histogram': ('histogram', ''), 'quantilesTimingWeighted': ('quantilesTimingWeighted', ''), 'retention': ('retention', ''), 'boundingRatio': ('boundingRatio', ''), 'sumCount': ('sumCount', ''), 'deltaSum': ('deltaSum', ''), 'quantilesTiming': ('quantilesTiming', ''), 'sumKahan': ('sumKahan', ''), 'maxIntersections': ('maxIntersections', ''), 'quantilesInterpolatedWeighted': ('quantilesInterpolatedWeighted', ''), 'quantileInterpolatedWeighted': ('quantileInterpolatedWeighted', ''), 'uniq': ('uniq', ''), 'quantileExactHigh': ('quantileExactHigh', ''), 'groupBitAnd': ('groupBitAnd', ''), 'covarSamp': ('covarSamp', ''), 'quantilesDeterministic': ('quantilesDeterministic', ''), 'topK': ('topK', ''), 'simpleLinearRegression': ('simpleLinearRegression', ''), 'median': ('median', ''), 'topKWeighted': ('topKWeighted', ''), 'quantileBFloat16Weighted': ('quantileBFloat16Weighted', ''), 'quantilesGK': ('quantilesGK', ''), 'argMin': ('argMin', ''), 'quantilesBFloat16Weighted': ('quantilesBFloat16Weighted', ''), 'quantilesBFloat16': ('quantilesBFloat16', ''), 'skewSamp': ('skewSamp', ''), 'varPop': ('varPop', ''), 'quantilesExactLow': ('quantilesExactLow', ''), 'categoricalInformationValue': ('categoricalInformationValue', ''), 'quantileTiming': ('quantileTiming', ''), 'deltaSumTimestamp': ('deltaSumTimestamp', ''), 'quantiles': ('quantiles', ''), 'contingency': ('contingency', ''), 'quantilesTDigestWeighted': ('quantilesTDigestWeighted', ''), 'argMax': ('argMax', ''), 'anyHeavy': ('anyHeavy', ''), 'meanZTest': ('meanZTest', ''), 'quantileGK': ('quantileGK', ''), 'maxIntersectionsPosition': ('maxIntersectionsPosition', ''), 'studentTTest': ('studentTTest', ''), 'quantilesExactWeighted': ('quantilesExactWeighted', ''), 'quantileTDigest': ('quantileTDigest', ''), 'covarPop': ('covarPop', ''), 'groupBitmapXor': ('groupBitmapXor', ''), 'theilsU': ('theilsU', ''), 'any': ('any', ''), 'last_value': ('last_value', ''), 'quantileTimingWeighted': ('quantileTimingWeighted', ''), 'skewPop': ('skewPop', ''), 'stochasticLogisticRegression': ('stochasticLogisticRegression', ''), 'sumWithOverflow': ('sumWithOverflow', ''), 'cramersVBiasCorrected': ('cramersVBiasCorrected', ''), 'groupBitXor': ('groupBitXor', ''), 'count': ('count', ''), 'groupBitmap': ('groupBitmap', ''), 'stddevSamp': ('stddevSamp', ''), 'uniqHLL12': ('uniqHLL12', ''), 'largestTriangleThreeBuckets': ('largestTriangleThreeBuckets', ''), 'sparkBar': ('sparkBar', ''), 'stddevPop': ('stddevPop', ''), 'sequenceMatch': ('sequenceMatch', ''), 'kurtSamp': ('kurtSamp', ''), 'anyLast': ('anyLast', ''), 'groupArrayInsertAt': ('groupArrayInsertAt', ''), 'uniqCombined': ('uniqCombined', ''), 'uniqTheta': ('uniqTheta', ''), 'welchTTest': ('welchTTest', ''), 'groupBitmapAnd': ('groupBitmapAnd', ''), 'sum': ('sum', ''), 'quantilesExactHigh': ('quantilesExactHigh', ''), 'first_value': ('first_value', ''), 'exponentialTimeDecayedAvg': ('exponentialTimeDecayedAvg', ''), 'quantilesExact': ('quantilesExact', ''), 'uniqExact': ('uniqExact', ''), 'groupArraySample': ('groupArraySample', ''), 'quantileTDigestWeighted': ('quantileTDigestWeighted', ''), 'windowFunnel': ('windowFunnel', ''), 'quantileDeterministic': ('quantileDeterministic', ''), 'sequenceCount': ('sequenceCount', ''), 'quantilesTDigest': ('quantilesTDigest', ''), 'groupArrayLast': ('groupArrayLast', ''), 'groupArrayMovingSum': ('groupArrayMovingSum', '')}
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.ANY: 'ANY'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.ASOF: 'ASOF'>, <TokenType.ANTI: 'ANTI'>, <TokenType.INNER: 'INNER'>, <TokenType.CROSS: 'CROSS'>, <TokenType.STRAIGHT_JOIN: 'STRAIGHT_JOIN'>, <TokenType.OUTER: 'OUTER'>, <TokenType.SEMI: 'SEMI'>}
TABLE_ALIAS_TOKENS = {<TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.DELETE: 'DELETE'>, <TokenType.TIME: 'TIME'>, <TokenType.MONEY: 'MONEY'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.END: 'END'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.UINT128: 'UINT128'>, <TokenType.DESC: 'DESC'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.UUID: 'UUID'>, <TokenType.SOME: 'SOME'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.ROWS: 'ROWS'>, <TokenType.INET: 'INET'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.LIST: 'LIST'>, <TokenType.CACHE: 'CACHE'>, <TokenType.FILTER: 'FILTER'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.USE: 'USE'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.INT128: 'INT128'>, <TokenType.SET: 'SET'>, <TokenType.ORDINALITY: 'ORDINALITY'>, <TokenType.MODEL: 'MODEL'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.ROW: 'ROW'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.DATE32: 'DATE32'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.COPY: 'COPY'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.NESTED: 'NESTED'>, <TokenType.UINT256: 'UINT256'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.MAP: 'MAP'>, <TokenType.DATE: 'DATE'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.INT: 'INT'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.XML: 'XML'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.PROCEDURE: 'PROCEDURE'>, <TokenType.TRUE: 'TRUE'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.JSON: 'JSON'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.NEXT: 'NEXT'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.INDEX: 'INDEX'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.UNIQUE: 'UNIQUE'>, <TokenType.YEAR: 'YEAR'>, <TokenType.SUPER: 'SUPER'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.KILL: 'KILL'>, <TokenType.CASE: 'CASE'>, <TokenType.IPV6: 'IPV6'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.STREAMLIT: 'STREAMLIT'>, <TokenType.NULL: 'NULL'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.ENUM: 'ENUM'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.TOP: 'TOP'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.TEXT: 'TEXT'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.STORAGE_INTEGRATION: 'STORAGE_INTEGRATION'>, <TokenType.ROLLUP: 'ROLLUP'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.KEEP: 'KEEP'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.BINARY: 'BINARY'>, <TokenType.INT256: 'INT256'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.MERGE: 'MERGE'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.TABLE: 'TABLE'>, <TokenType.UNIQUEIDENTIFIER: 'UNIQUEIDENTIFIER'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.ALL: 'ALL'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.VAR: 'VAR'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.NAME: 'NAME'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.JSONB: 'JSONB'>, <TokenType.WAREHOUSE: 'WAREHOUSE'>, <TokenType.ASC: 'ASC'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.UINT: 'UINT'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.DIV: 'DIV'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.STRAIGHT_JOIN: 'STRAIGHT_JOIN'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.RANGE: 'RANGE'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.TAG: 'TAG'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.FALSE: 'FALSE'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.CHAR: 'CHAR'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.LOAD: 'LOAD'>, <TokenType.VIEW: 'VIEW'>, <TokenType.FIRST: 'FIRST'>, <TokenType.IS: 'IS'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.BIT: 'BIT'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.SHOW: 'SHOW'>, <TokenType.IPV4: 'IPV4'>, <TokenType.REFERENCES: 'REFERENCES'>}
ALIAS_TOKENS = {<TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.DELETE: 'DELETE'>, <TokenType.TIME: 'TIME'>, <TokenType.MONEY: 'MONEY'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.END: 'END'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.UINT128: 'UINT128'>, <TokenType.DESC: 'DESC'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.SEMI: 'SEMI'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.UUID: 'UUID'>, <TokenType.SOME: 'SOME'>, <TokenType.ASOF: 'ASOF'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.RIGHT: 'RIGHT'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.ANTI: 'ANTI'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.ROWS: 'ROWS'>, <TokenType.INET: 'INET'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.LIST: 'LIST'>, <TokenType.CACHE: 'CACHE'>, <TokenType.FILTER: 'FILTER'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.USE: 'USE'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.INT128: 'INT128'>, <TokenType.SET: 'SET'>, <TokenType.ORDINALITY: 'ORDINALITY'>, <TokenType.FULL: 'FULL'>, <TokenType.MODEL: 'MODEL'>, <TokenType.ANY: 'ANY'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.ROW: 'ROW'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.DATE32: 'DATE32'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.COPY: 'COPY'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.NESTED: 'NESTED'>, <TokenType.UINT256: 'UINT256'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.MAP: 'MAP'>, <TokenType.DATE: 'DATE'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.INT: 'INT'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.XML: 'XML'>, <TokenType.NATURAL: 'NATURAL'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.PROCEDURE: 'PROCEDURE'>, <TokenType.TRUE: 'TRUE'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.JSON: 'JSON'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.NEXT: 'NEXT'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.INDEX: 'INDEX'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.UNIQUE: 'UNIQUE'>, <TokenType.YEAR: 'YEAR'>, <TokenType.SUPER: 'SUPER'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.KILL: 'KILL'>, <TokenType.CASE: 'CASE'>, <TokenType.IPV6: 'IPV6'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.STREAMLIT: 'STREAMLIT'>, <TokenType.NULL: 'NULL'>, <TokenType.FINAL: 'FINAL'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.ENUM: 'ENUM'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.TOP: 'TOP'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.TEXT: 'TEXT'>, <TokenType.WINDOW: 'WINDOW'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.STORAGE_INTEGRATION: 'STORAGE_INTEGRATION'>, <TokenType.ROLLUP: 'ROLLUP'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.KEEP: 'KEEP'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.BINARY: 'BINARY'>, <TokenType.INT256: 'INT256'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.MERGE: 'MERGE'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.TABLE: 'TABLE'>, <TokenType.UNIQUEIDENTIFIER: 'UNIQUEIDENTIFIER'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.ALL: 'ALL'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.VAR: 'VAR'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.NAME: 'NAME'>, <TokenType.APPLY: 'APPLY'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.JSONB: 'JSONB'>, <TokenType.WAREHOUSE: 'WAREHOUSE'>, <TokenType.ASC: 'ASC'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.UINT: 'UINT'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.DIV: 'DIV'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.RANGE: 'RANGE'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.TAG: 'TAG'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.FALSE: 'FALSE'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.CHAR: 'CHAR'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.LOAD: 'LOAD'>, <TokenType.VIEW: 'VIEW'>, <TokenType.SETTINGS: 'SETTINGS'>, <TokenType.FIRST: 'FIRST'>, <TokenType.IS: 'IS'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.BIT: 'BIT'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.SHOW: 'SHOW'>, <TokenType.LEFT: 'LEFT'>, <TokenType.IPV4: 'IPV4'>, <TokenType.REFERENCES: 'REFERENCES'>}
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>>, 'REPLACE': <function ClickHouse.Parser.<lambda>>}
SCHEMA_UNNAMED_CONSTRAINTS = {'PERIOD', 'CHECK', 'INDEX', 'UNIQUE', 'LIKE', 'EXCLUDE', 'PRIMARY KEY', 'FOREIGN KEY'}
ID_VAR_TOKENS = {<TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.DELETE: 'DELETE'>, <TokenType.TIME: 'TIME'>, <TokenType.MONEY: 'MONEY'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.END: 'END'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.UINT128: 'UINT128'>, <TokenType.DESC: 'DESC'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.SEMI: 'SEMI'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.UUID: 'UUID'>, <TokenType.SOME: 'SOME'>, <TokenType.ASOF: 'ASOF'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.RIGHT: 'RIGHT'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.ANTI: 'ANTI'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.ROWS: 'ROWS'>, <TokenType.INET: 'INET'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.LIST: 'LIST'>, <TokenType.CACHE: 'CACHE'>, <TokenType.FILTER: 'FILTER'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.USE: 'USE'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.INT128: 'INT128'>, <TokenType.SET: 'SET'>, <TokenType.ORDINALITY: 'ORDINALITY'>, <TokenType.FULL: 'FULL'>, <TokenType.MODEL: 'MODEL'>, <TokenType.ANY: 'ANY'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.ROW: 'ROW'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.DATE32: 'DATE32'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.COPY: 'COPY'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.FORMAT: 'FORMAT'>, <TokenType.NESTED: 'NESTED'>, <TokenType.UINT256: 'UINT256'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.MAP: 'MAP'>, <TokenType.DATE: 'DATE'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.INT: 'INT'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.XML: 'XML'>, <TokenType.NATURAL: 'NATURAL'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.PROCEDURE: 'PROCEDURE'>, <TokenType.TRUE: 'TRUE'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.JSON: 'JSON'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.NEXT: 'NEXT'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.INDEX: 'INDEX'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.UNIQUE: 'UNIQUE'>, <TokenType.YEAR: 'YEAR'>, <TokenType.SUPER: 'SUPER'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.KILL: 'KILL'>, <TokenType.CASE: 'CASE'>, <TokenType.IPV6: 'IPV6'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.STREAMLIT: 'STREAMLIT'>, <TokenType.NULL: 'NULL'>, <TokenType.FINAL: 'FINAL'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.ENUM: 'ENUM'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.TOP: 'TOP'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.TEXT: 'TEXT'>, <TokenType.WINDOW: 'WINDOW'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.STORAGE_INTEGRATION: 'STORAGE_INTEGRATION'>, <TokenType.ROLLUP: 'ROLLUP'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.KEEP: 'KEEP'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.BINARY: 'BINARY'>, <TokenType.INT256: 'INT256'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.MERGE: 'MERGE'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.TABLE: 'TABLE'>, <TokenType.UNIQUEIDENTIFIER: 'UNIQUEIDENTIFIER'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.ALL: 'ALL'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.VAR: 'VAR'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.NAME: 'NAME'>, <TokenType.APPLY: 'APPLY'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.JSONB: 'JSONB'>, <TokenType.WAREHOUSE: 'WAREHOUSE'>, <TokenType.ASC: 'ASC'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.UINT: 'UINT'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.DIV: 'DIV'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.STRAIGHT_JOIN: 'STRAIGHT_JOIN'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.RANGE: 'RANGE'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.TAG: 'TAG'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.FALSE: 'FALSE'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.CHAR: 'CHAR'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.LOAD: 'LOAD'>, <TokenType.VIEW: 'VIEW'>, <TokenType.SETTINGS: 'SETTINGS'>, <TokenType.FIRST: 'FIRST'>, <TokenType.IS: 'IS'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.BIT: 'BIT'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.SHOW: 'SHOW'>, <TokenType.LEFT: 'LEFT'>, <TokenType.IPV4: 'IPV4'>, <TokenType.REFERENCES: 'REFERENCES'>}
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
  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
  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): View Source

    689    class Generator(generator.Generator):
    690        QUERY_HINTS = False
    691        STRUCT_DELIMITER = ("(", ")")
    692        NVL2_SUPPORTED = False
    693        TABLESAMPLE_REQUIRES_PARENS = False
    694        TABLESAMPLE_SIZE_IS_ROWS = False
    695        TABLESAMPLE_KEYWORDS = "SAMPLE"
    696        LAST_DAY_SUPPORTS_DATE_PART = False
    697        CAN_IMPLEMENT_ARRAY_ANY = True
    698        SUPPORTS_TO_NUMBER = False
    699        JOIN_HINTS = False
    700        TABLE_HINTS = False
    701        EXPLICIT_SET_OP = True
    702        GROUPINGS_SEP = ""
    703        SET_OP_MODIFIERS = False
    704        SUPPORTS_TABLE_ALIAS_COLUMNS = False
    705
    706        STRING_TYPE_MAPPING = {
    707            exp.DataType.Type.CHAR: "String",
    708            exp.DataType.Type.LONGBLOB: "String",
    709            exp.DataType.Type.LONGTEXT: "String",
    710            exp.DataType.Type.MEDIUMBLOB: "String",
    711            exp.DataType.Type.MEDIUMTEXT: "String",
    712            exp.DataType.Type.TINYBLOB: "String",
    713            exp.DataType.Type.TINYTEXT: "String",
    714            exp.DataType.Type.TEXT: "String",
    715            exp.DataType.Type.VARBINARY: "String",
    716            exp.DataType.Type.VARCHAR: "String",
    717        }
    718
    719        SUPPORTED_JSON_PATH_PARTS = {
    720            exp.JSONPathKey,
    721            exp.JSONPathRoot,
    722            exp.JSONPathSubscript,
    723        }
    724
    725        TYPE_MAPPING = {
    726            **generator.Generator.TYPE_MAPPING,
    727            **STRING_TYPE_MAPPING,
    728            exp.DataType.Type.ARRAY: "Array",
    729            exp.DataType.Type.BIGINT: "Int64",
    730            exp.DataType.Type.DATE32: "Date32",
    731            exp.DataType.Type.DATETIME64: "DateTime64",
    732            exp.DataType.Type.DOUBLE: "Float64",
    733            exp.DataType.Type.ENUM: "Enum",
    734            exp.DataType.Type.ENUM8: "Enum8",
    735            exp.DataType.Type.ENUM16: "Enum16",
    736            exp.DataType.Type.FIXEDSTRING: "FixedString",
    737            exp.DataType.Type.FLOAT: "Float32",
    738            exp.DataType.Type.INT: "Int32",
    739            exp.DataType.Type.MEDIUMINT: "Int32",
    740            exp.DataType.Type.INT128: "Int128",
    741            exp.DataType.Type.INT256: "Int256",
    742            exp.DataType.Type.LOWCARDINALITY: "LowCardinality",
    743            exp.DataType.Type.MAP: "Map",
    744            exp.DataType.Type.NESTED: "Nested",
    745            exp.DataType.Type.NULLABLE: "Nullable",
    746            exp.DataType.Type.SMALLINT: "Int16",
    747            exp.DataType.Type.STRUCT: "Tuple",
    748            exp.DataType.Type.TINYINT: "Int8",
    749            exp.DataType.Type.UBIGINT: "UInt64",
    750            exp.DataType.Type.UINT: "UInt32",
    751            exp.DataType.Type.UINT128: "UInt128",
    752            exp.DataType.Type.UINT256: "UInt256",
    753            exp.DataType.Type.USMALLINT: "UInt16",
    754            exp.DataType.Type.UTINYINT: "UInt8",
    755            exp.DataType.Type.IPV4: "IPv4",
    756            exp.DataType.Type.IPV6: "IPv6",
    757            exp.DataType.Type.AGGREGATEFUNCTION: "AggregateFunction",
    758            exp.DataType.Type.SIMPLEAGGREGATEFUNCTION: "SimpleAggregateFunction",
    759        }
    760
    761        TRANSFORMS = {
    762            **generator.Generator.TRANSFORMS,
    763            exp.AnyValue: rename_func("any"),
    764            exp.ApproxDistinct: rename_func("uniq"),
    765            exp.ArrayFilter: lambda self, e: self.func("arrayFilter", e.expression, e.this),
    766            exp.ArraySize: rename_func("LENGTH"),
    767            exp.ArraySum: rename_func("arraySum"),
    768            exp.ArgMax: arg_max_or_min_no_count("argMax"),
    769            exp.ArgMin: arg_max_or_min_no_count("argMin"),
    770            exp.Array: inline_array_sql,
    771            exp.CastToStrType: rename_func("CAST"),
    772            exp.CountIf: rename_func("countIf"),
    773            exp.CompressColumnConstraint: lambda self,
    774            e: f"CODEC({self.expressions(e, key='this', flat=True)})",
    775            exp.ComputedColumnConstraint: lambda self,
    776            e: f"{'MATERIALIZED' if e.args.get('persisted') else 'ALIAS'} {self.sql(e, 'this')}",
    777            exp.CurrentDate: lambda self, e: self.func("CURRENT_DATE"),
    778            exp.DateAdd: _datetime_delta_sql("DATE_ADD"),
    779            exp.DateDiff: _datetime_delta_sql("DATE_DIFF"),
    780            exp.DateSub: _datetime_delta_sql("DATE_SUB"),
    781            exp.Explode: rename_func("arrayJoin"),
    782            exp.Final: lambda self, e: f"{self.sql(e, 'this')} FINAL",
    783            exp.IsNan: rename_func("isNaN"),
    784            exp.JSONExtract: json_extract_segments("JSONExtractString", quoted_index=False),
    785            exp.JSONExtractScalar: json_extract_segments("JSONExtractString", quoted_index=False),
    786            exp.JSONPathKey: json_path_key_only_name,
    787            exp.JSONPathRoot: lambda *_: "",
    788            exp.Map: lambda self, e: _lower_func(var_map_sql(self, e)),
    789            exp.Nullif: rename_func("nullIf"),
    790            exp.PartitionedByProperty: lambda self, e: f"PARTITION BY {self.sql(e, 'this')}",
    791            exp.Pivot: no_pivot_sql,
    792            exp.Quantile: _quantile_sql,
    793            exp.RegexpLike: lambda self, e: self.func("match", e.this, e.expression),
    794            exp.Rand: rename_func("randCanonical"),
    795            exp.StartsWith: rename_func("startsWith"),
    796            exp.StrPosition: lambda self, e: self.func(
    797                "position", e.this, e.args.get("substr"), e.args.get("position")
    798            ),
    799            exp.TimeToStr: lambda self, e: self.func(
    800                "DATE_FORMAT", e.this, self.format_time(e), e.args.get("timezone")
    801            ),
    802            exp.TimestampAdd: _datetime_delta_sql("TIMESTAMP_ADD"),
    803            exp.TimestampSub: _datetime_delta_sql("TIMESTAMP_SUB"),
    804            exp.VarMap: lambda self, e: _lower_func(var_map_sql(self, e)),
    805            exp.Xor: lambda self, e: self.func("xor", e.this, e.expression, *e.expressions),
    806            exp.MD5Digest: rename_func("MD5"),
    807            exp.MD5: lambda self, e: self.func("LOWER", self.func("HEX", self.func("MD5", e.this))),
    808            exp.SHA: rename_func("SHA1"),
    809            exp.SHA2: sha256_sql,
    810            exp.UnixToTime: _unix_to_time_sql,
    811            exp.TimestampTrunc: timestamptrunc_sql(zone=True),
    812            exp.Variance: rename_func("varSamp"),
    813            exp.Stddev: rename_func("stddevSamp"),
    814        }
    815
    816        PROPERTIES_LOCATION = {
    817            **generator.Generator.PROPERTIES_LOCATION,
    818            exp.VolatileProperty: exp.Properties.Location.UNSUPPORTED,
    819            exp.PartitionedByProperty: exp.Properties.Location.POST_SCHEMA,
    820            exp.OnCluster: exp.Properties.Location.POST_NAME,
    821        }
    822
    823        # there's no list in docs, but it can be found in Clickhouse code
    824        # see `ClickHouse/src/Parsers/ParserCreate*.cpp`
    825        ON_CLUSTER_TARGETS = {
    826            "DATABASE",
    827            "TABLE",
    828            "VIEW",
    829            "DICTIONARY",
    830            "INDEX",
    831            "FUNCTION",
    832            "NAMED COLLECTION",
    833        }
    834
    835        def _jsonpathsubscript_sql(self, expression: exp.JSONPathSubscript) -> str:
    836            this = self.json_path_part(expression.this)
    837            return str(int(this) + 1) if is_int(this) else this
    838
    839        def likeproperty_sql(self, expression: exp.LikeProperty) -> str:
    840            return f"AS {self.sql(expression, 'this')}"
    841
    842        def _any_to_has(
    843            self,
    844            expression: exp.EQ | exp.NEQ,
    845            default: t.Callable[[t.Any], str],
    846            prefix: str = "",
    847        ) -> str:
    848            if isinstance(expression.left, exp.Any):
    849                arr = expression.left
    850                this = expression.right
    851            elif isinstance(expression.right, exp.Any):
    852                arr = expression.right
    853                this = expression.left
    854            else:
    855                return default(expression)
    856
    857            return prefix + self.func("has", arr.this.unnest(), this)
    858
    859        def eq_sql(self, expression: exp.EQ) -> str:
    860            return self._any_to_has(expression, super().eq_sql)
    861
    862        def neq_sql(self, expression: exp.NEQ) -> str:
    863            return self._any_to_has(expression, super().neq_sql, "NOT ")
    864
    865        def regexpilike_sql(self, expression: exp.RegexpILike) -> str:
    866            # Manually add a flag to make the search case-insensitive
    867            regex = self.func("CONCAT", "'(?i)'", expression.expression)
    868            return self.func("match", expression.this, regex)
    869
    870        def datatype_sql(self, expression: exp.DataType) -> str:
    871            # String is the standard ClickHouse type, every other variant is just an alias.
    872            # Additionally, any supplied length parameter will be ignored.
    873            #
    874            # https://clickhouse.com/docs/en/sql-reference/data-types/string
    875            if expression.this in self.STRING_TYPE_MAPPING:
    876                return "String"
    877
    878            return super().datatype_sql(expression)
    879
    880        def cte_sql(self, expression: exp.CTE) -> str:
    881            if expression.args.get("scalar"):
    882                this = self.sql(expression, "this")
    883                alias = self.sql(expression, "alias")
    884                return f"{this} AS {alias}"
    885
    886            return super().cte_sql(expression)
    887
    888        def after_limit_modifiers(self, expression: exp.Expression) -> t.List[str]:
    889            return super().after_limit_modifiers(expression) + [
    890                (
    891                    self.seg("SETTINGS ") + self.expressions(expression, key="settings", flat=True)
    892                    if expression.args.get("settings")
    893                    else ""
    894                ),
    895                (
    896                    self.seg("FORMAT ") + self.sql(expression, "format")
    897                    if expression.args.get("format")
    898                    else ""
    899                ),
    900            ]
    901
    902        def parameterizedagg_sql(self, expression: exp.ParameterizedAgg) -> str:
    903            params = self.expressions(expression, key="params", flat=True)
    904            return self.func(expression.name, *expression.expressions) + f"({params})"
    905
    906        def anonymousaggfunc_sql(self, expression: exp.AnonymousAggFunc) -> str:
    907            return self.func(expression.name, *expression.expressions)
    908
    909        def combinedaggfunc_sql(self, expression: exp.CombinedAggFunc) -> str:
    910            return self.anonymousaggfunc_sql(expression)
    911
    912        def combinedparameterizedagg_sql(self, expression: exp.CombinedParameterizedAgg) -> str:
    913            return self.parameterizedagg_sql(expression)
    914
    915        def placeholder_sql(self, expression: exp.Placeholder) -> str:
    916            return f"{{{expression.name}: {self.sql(expression, 'kind')}}}"
    917
    918        def oncluster_sql(self, expression: exp.OnCluster) -> str:
    919            return f"ON CLUSTER {self.sql(expression, 'this')}"
    920
    921        def createable_sql(self, expression: exp.Create, locations: t.DefaultDict) -> str:
    922            if expression.kind in self.ON_CLUSTER_TARGETS and locations.get(
    923                exp.Properties.Location.POST_NAME
    924            ):
    925                this_name = self.sql(expression.this, "this")
    926                this_properties = " ".join(
    927                    [self.sql(prop) for prop in locations[exp.Properties.Location.POST_NAME]]
    928                )
    929                this_schema = self.schema_columns_sql(expression.this)
    930                return f"{this_name}{self.sep()}{this_properties}{self.sep()}{this_schema}"
    931
    932            return super().createable_sql(expression, locations)
    933
    934        def prewhere_sql(self, expression: exp.PreWhere) -> str:
    935            this = self.indent(self.sql(expression, "this"))
    936            return f"{self.seg('PREWHERE')}{self.sep()}{this}"
    937
    938        def indexcolumnconstraint_sql(self, expression: exp.IndexColumnConstraint) -> str:
    939            this = self.sql(expression, "this")
    940            this = f" {this}" if this else ""
    941            expr = self.sql(expression, "expression")
    942            expr = f" {expr}" if expr else ""
    943            index_type = self.sql(expression, "index_type")
    944            index_type = f" TYPE {index_type}" if index_type else ""
    945            granularity = self.sql(expression, "granularity")
    946            granularity = f" GRANULARITY {granularity}" if granularity else ""
    947
    948            return f"INDEX{this}{expr}{index_type}{granularity}"
    949
    950        def partition_sql(self, expression: exp.Partition) -> str:
    951            return f"PARTITION {self.expressions(expression, flat=True)}"
    952
    953        def partitionid_sql(self, expression: exp.PartitionId) -> str:
    954            return f"ID {self.sql(expression.this)}"
    955
    956        def replacepartition_sql(self, expression: exp.ReplacePartition) -> str:
    957            return (
    958                f"REPLACE {self.sql(expression.expression)} FROM {self.sql(expression, 'source')}"
    959            )
    960
    961        def projectiondef_sql(self, expression: exp.ProjectionDef) -> str:
    962            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
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'}
SUPPORTED_JSON_PATH_PARTS = {<class 'sqlglot.expressions.JSONPathKey'>, <class 'sqlglot.expressions.JSONPathSubscript'>, <class 'sqlglot.expressions.JSONPathRoot'>}
TYPE_MAPPING = {<Type.NCHAR: 'NCHAR'>: 'CHAR', <Type.NVARCHAR: 'NVARCHAR'>: 'VARCHAR', <Type.MEDIUMTEXT: 'MEDIUMTEXT'>: 'String', <Type.LONGTEXT: 'LONGTEXT'>: 'String', <Type.TINYTEXT: 'TINYTEXT'>: 'String', <Type.MEDIUMBLOB: 'MEDIUMBLOB'>: 'String', <Type.LONGBLOB: 'LONGBLOB'>: 'String', <Type.TINYBLOB: 'TINYBLOB'>: 'String', <Type.INET: 'INET'>: 'INET', <Type.ROWVERSION: 'ROWVERSION'>: 'VARBINARY', <Type.CHAR: 'CHAR'>: 'String', <Type.TEXT: 'TEXT'>: 'String', <Type.VARBINARY: 'VARBINARY'>: 'String', <Type.VARCHAR: 'VARCHAR'>: 'String', <Type.ARRAY: 'ARRAY'>: 'Array', <Type.BIGINT: 'BIGINT'>: 'Int64', <Type.DATE32: 'DATE32'>: 'Date32', <Type.DATETIME64: 'DATETIME64'>: 'DateTime64', <Type.DOUBLE: 'DOUBLE'>: 'Float64', <Type.ENUM: 'ENUM'>: 'Enum', <Type.ENUM8: 'ENUM8'>: 'Enum8', <Type.ENUM16: 'ENUM16'>: 'Enum16', <Type.FIXEDSTRING: 'FIXEDSTRING'>: 'FixedString', <Type.FLOAT: 'FLOAT'>: 'Float32', <Type.INT: 'INT'>: 'Int32', <Type.MEDIUMINT: 'MEDIUMINT'>: 'Int32', <Type.INT128: 'INT128'>: 'Int128', <Type.INT256: 'INT256'>: 'Int256', <Type.LOWCARDINALITY: 'LOWCARDINALITY'>: 'LowCardinality', <Type.MAP: 'MAP'>: 'Map', <Type.NESTED: 'NESTED'>: 'Nested', <Type.NULLABLE: 'NULLABLE'>: 'Nullable', <Type.SMALLINT: 'SMALLINT'>: 'Int16', <Type.STRUCT: 'STRUCT'>: 'Tuple', <Type.TINYINT: 'TINYINT'>: 'Int8', <Type.UBIGINT: 'UBIGINT'>: 'UInt64', <Type.UINT: 'UINT'>: 'UInt32', <Type.UINT128: 'UINT128'>: 'UInt128', <Type.UINT256: 'UINT256'>: 'UInt256', <Type.USMALLINT: 'USMALLINT'>: 'UInt16', <Type.UTINYINT: 'UTINYINT'>: 'UInt8', <Type.IPV4: 'IPV4'>: 'IPv4', <Type.IPV6: 'IPV6'>: 'IPv6', <Type.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>: 'AggregateFunction', <Type.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>: 'SimpleAggregateFunction'}
TRANSFORMS = {<class 'sqlglot.expressions.JSONPathKey'>: <function json_path_key_only_name>, <class 'sqlglot.expressions.JSONPathRoot'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.JSONPathSubscript'>: <function <lambda>>, <class 'sqlglot.expressions.AllowedValuesProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.AutoRefreshProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.BackupProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CaseSpecificColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CharacterSetColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CharacterSetProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ClusteredColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CollateColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CommentColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ConnectByRoot'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CopyGrantsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.DateFormatColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.DefaultColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.DynamicProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.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.JSONExtract'>: <function json_extract_segments.<locals>._json_extract_segments>, <class 'sqlglot.expressions.JSONExtractScalar'>: <function json_extract_segments.<locals>._json_extract_segments>, <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.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.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.Timestamp'>: <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.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.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.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.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.StrictProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.TemporaryProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.ToTableProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.TransientProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.TransformModelProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.MergeTreeTTL'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.UnloggedProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.ViewAttributeProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.VolatileProperty'>: <Location.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.WithDataProperty'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.WithJournalTableProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.WithSchemaBindingProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.WithSystemVersioningProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.OnCluster'>: <Location.POST_NAME: 'POST_NAME'>}
ON_CLUSTER_TARGETS = {'INDEX', 'DICTIONARY', 'NAMED COLLECTION', 'FUNCTION', 'TABLE', 'DATABASE', 'VIEW'}
def likeproperty_sql(self, expression: sqlglot.expressions.LikeProperty) -> str: View Source

    839        def likeproperty_sql(self, expression: exp.LikeProperty) -> str:
    840            return f"AS {self.sql(expression, 'this')}"

def eq_sql(self, expression: sqlglot.expressions.EQ) -> str: View Source

    859        def eq_sql(self, expression: exp.EQ) -> str:
    860            return self._any_to_has(expression, super().eq_sql)

def neq_sql(self, expression: sqlglot.expressions.NEQ) -> str: View Source

    862        def neq_sql(self, expression: exp.NEQ) -> str:
    863            return self._any_to_has(expression, super().neq_sql, "NOT ")

def regexpilike_sql(self, expression: sqlglot.expressions.RegexpILike) -> str: View Source

    865        def regexpilike_sql(self, expression: exp.RegexpILike) -> str:
    866            # Manually add a flag to make the search case-insensitive
    867            regex = self.func("CONCAT", "'(?i)'", expression.expression)
    868            return self.func("match", expression.this, regex)

def datatype_sql(self, expression: sqlglot.expressions.DataType) -> str: View Source

    870        def datatype_sql(self, expression: exp.DataType) -> str:
    871            # String is the standard ClickHouse type, every other variant is just an alias.
    872            # Additionally, any supplied length parameter will be ignored.
    873            #
    874            # https://clickhouse.com/docs/en/sql-reference/data-types/string
    875            if expression.this in self.STRING_TYPE_MAPPING:
    876                return "String"
    877
    878            return super().datatype_sql(expression)

def cte_sql(self, expression: sqlglot.expressions.CTE) -> str: View Source

    880        def cte_sql(self, expression: exp.CTE) -> str:
    881            if expression.args.get("scalar"):
    882                this = self.sql(expression, "this")
    883                alias = self.sql(expression, "alias")
    884                return f"{this} AS {alias}"
    885
    886            return super().cte_sql(expression)

def after_limit_modifiers(self, expression: sqlglot.expressions.Expression) -> List[str]: View Source

    888        def after_limit_modifiers(self, expression: exp.Expression) -> t.List[str]:
    889            return super().after_limit_modifiers(expression) + [
    890                (
    891                    self.seg("SETTINGS ") + self.expressions(expression, key="settings", flat=True)
    892                    if expression.args.get("settings")
    893                    else ""
    894                ),
    895                (
    896                    self.seg("FORMAT ") + self.sql(expression, "format")
    897                    if expression.args.get("format")
    898                    else ""
    899                ),
    900            ]

def parameterizedagg_sql(self, expression: sqlglot.expressions.ParameterizedAgg) -> str: View Source

    902        def parameterizedagg_sql(self, expression: exp.ParameterizedAgg) -> str:
    903            params = self.expressions(expression, key="params", flat=True)
    904            return self.func(expression.name, *expression.expressions) + f"({params})"

def anonymousaggfunc_sql(self, expression: sqlglot.expressions.AnonymousAggFunc) -> str: View Source

    906        def anonymousaggfunc_sql(self, expression: exp.AnonymousAggFunc) -> str:
    907            return self.func(expression.name, *expression.expressions)

def combinedaggfunc_sql(self, expression: sqlglot.expressions.CombinedAggFunc) -> str: View Source

    909        def combinedaggfunc_sql(self, expression: exp.CombinedAggFunc) -> str:
    910            return self.anonymousaggfunc_sql(expression)

def combinedparameterizedagg_sql(self, expression: sqlglot.expressions.CombinedParameterizedAgg) -> str: View Source

    912        def combinedparameterizedagg_sql(self, expression: exp.CombinedParameterizedAgg) -> str:
    913            return self.parameterizedagg_sql(expression)

def placeholder_sql(self, expression: sqlglot.expressions.Placeholder) -> str: View Source

    915        def placeholder_sql(self, expression: exp.Placeholder) -> str:
    916            return f"{{{expression.name}: {self.sql(expression, 'kind')}}}"

def oncluster_sql(self, expression: sqlglot.expressions.OnCluster) -> str: View Source

    918        def oncluster_sql(self, expression: exp.OnCluster) -> str:
    919            return f"ON CLUSTER {self.sql(expression, 'this')}"

def createable_sql( self, expression: sqlglot.expressions.Create, locations: DefaultDict) -> str: View Source

    921        def createable_sql(self, expression: exp.Create, locations: t.DefaultDict) -> str:
    922            if expression.kind in self.ON_CLUSTER_TARGETS and locations.get(
    923                exp.Properties.Location.POST_NAME
    924            ):
    925                this_name = self.sql(expression.this, "this")
    926                this_properties = " ".join(
    927                    [self.sql(prop) for prop in locations[exp.Properties.Location.POST_NAME]]
    928                )
    929                this_schema = self.schema_columns_sql(expression.this)
    930                return f"{this_name}{self.sep()}{this_properties}{self.sep()}{this_schema}"
    931
    932            return super().createable_sql(expression, locations)

def prewhere_sql(self, expression: sqlglot.expressions.PreWhere) -> str: View Source

    934        def prewhere_sql(self, expression: exp.PreWhere) -> str:
    935            this = self.indent(self.sql(expression, "this"))
    936            return f"{self.seg('PREWHERE')}{self.sep()}{this}"

def indexcolumnconstraint_sql(self, expression: sqlglot.expressions.IndexColumnConstraint) -> str: View Source

    938        def indexcolumnconstraint_sql(self, expression: exp.IndexColumnConstraint) -> str:
    939            this = self.sql(expression, "this")
    940            this = f" {this}" if this else ""
    941            expr = self.sql(expression, "expression")
    942            expr = f" {expr}" if expr else ""
    943            index_type = self.sql(expression, "index_type")
    944            index_type = f" TYPE {index_type}" if index_type else ""
    945            granularity = self.sql(expression, "granularity")
    946            granularity = f" GRANULARITY {granularity}" if granularity else ""
    947
    948            return f"INDEX{this}{expr}{index_type}{granularity}"

def partition_sql(self, expression: sqlglot.expressions.Partition) -> str: View Source

    950        def partition_sql(self, expression: exp.Partition) -> str:
    951            return f"PARTITION {self.expressions(expression, flat=True)}"

def partitionid_sql(self, expression: sqlglot.expressions.PartitionId) -> str: View Source

    953        def partitionid_sql(self, expression: exp.PartitionId) -> str:
    954            return f"ID {self.sql(expression.this)}"

def replacepartition_sql(self, expression: sqlglot.expressions.ReplacePartition) -> str: View Source

    956        def replacepartition_sql(self, expression: exp.ReplacePartition) -> str:
    957            return (
    958                f"REPLACE {self.sql(expression.expression)} FROM {self.sql(expression, 'source')}"
    959            )

def projectiondef_sql(self, expression: sqlglot.expressions.ProjectionDef) -> str: View Source

    961        def projectiondef_sql(self, expression: exp.ProjectionDef) -> str:
    962            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
  VALUES_AS_TABLE
  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
  PARSE_JSON_NAME
  TIME_PART_SINGULARS
  TOKEN_MAPPING
  PARAMETER_TOKEN
  NAMED_PLACEHOLDER_TOKEN
  RESERVED_KEYWORDS
  WITH_SEPARATED_COMMENTS
  EXCLUDE_COMMENTS
  UNWRAPPED_INTERVAL_VALUES
  PARAMETERIZABLE_TEXT_TYPES
  EXPRESSIONS_WITHOUT_NESTED_CTES
  SENTINEL_LINE_BREAK
  pretty
  identify
  normalize
  pad
  unsupported_level
  max_unsupported
  leading_comma
  max_text_width
  comments
  dialect
  normalize_functions
  unsupported_messages
  generate
  preprocess
  unsupported
  sep
  seg
  pad_comment
  maybe_comment
  wrap
  no_identify
  normalize_func
  indent
  sql
  uncache_sql
  cache_sql
  characterset_sql
  column_parts
  column_sql
  columnposition_sql
  columndef_sql
  columnconstraint_sql
  computedcolumnconstraint_sql
  autoincrementcolumnconstraint_sql
  compresscolumnconstraint_sql
  generatedasidentitycolumnconstraint_sql
  generatedasrowcolumnconstraint_sql
  periodforsystemtimeconstraint_sql
  notnullcolumnconstraint_sql
  transformcolumnconstraint_sql
  primarykeycolumnconstraint_sql
  uniquecolumnconstraint_sql
  create_sql
  sequenceproperties_sql
  clone_sql
  describe_sql
  heredoc_sql
  prepend_ctes
  with_sql
  tablealias_sql
  bitstring_sql
  hexstring_sql
  bytestring_sql
  unicodestring_sql
  rawstring_sql
  datatypeparam_sql
  directory_sql
  delete_sql
  drop_sql
  except_sql
  except_op
  fetch_sql
  filter_sql
  hint_sql
  indexparameters_sql
  index_sql
  identifier_sql
  hex_sql
  lowerhex_sql
  inputoutputformat_sql
  national_sql
  properties_sql
  root_properties
  properties
  with_properties
  locate_properties
  property_name
  property_sql
  fallbackproperty_sql
  journalproperty_sql
  freespaceproperty_sql
  checksumproperty_sql
  mergeblockratioproperty_sql
  datablocksizeproperty_sql
  blockcompressionproperty_sql
  isolatedloadingproperty_sql
  partitionboundspec_sql
  partitionedofproperty_sql
  lockingproperty_sql
  withdataproperty_sql
  withsystemversioningproperty_sql
  insert_sql
  intersect_sql
  intersect_op
  introducer_sql
  kill_sql
  pseudotype_sql
  objectidentifier_sql
  onconflict_sql
  returning_sql
  rowformatdelimitedproperty_sql
  withtablehint_sql
  indextablehint_sql
  historicaldata_sql
  table_parts
  table_sql
  tablesample_sql
  pivot_sql
  version_sql
  tuple_sql
  update_sql
  values_sql
  var_sql
  into_sql
  from_sql
  group_sql
  having_sql
  connect_sql
  prior_sql
  join_sql
  lambda_sql
  lateral_op
  lateral_sql
  limit_sql
  offset_sql
  setitem_sql
  set_sql
  pragma_sql
  lock_sql
  literal_sql
  escape_str
  loaddata_sql
  null_sql
  boolean_sql
  order_sql
  withfill_sql
  cluster_sql
  distribute_sql
  sort_sql
  ordered_sql
  matchrecognizemeasure_sql
  matchrecognize_sql
  query_modifiers
  options_modifier
  queryoption_sql
  offset_limit_modifiers
  select_sql
  schema_sql
  schema_columns_sql
  star_sql
  parameter_sql
  sessionparameter_sql
  subquery_sql
  qualify_sql
  set_operations
  union_sql
  union_op
  unnest_sql
  where_sql
  window_sql
  partition_by_sql
  windowspec_sql
  withingroup_sql
  between_sql
  bracket_offset_expressions
  bracket_sql
  all_sql
  any_sql
  exists_sql
  case_sql
  constraint_sql
  nextvaluefor_sql
  extract_sql
  trim_sql
  convert_concat_args
  concat_sql
  concatws_sql
  check_sql
  foreignkey_sql
  primarykey_sql
  if_sql
  matchagainst_sql
  jsonkeyvalue_sql
  jsonpath_sql
  json_path_part
  formatjson_sql
  jsonobject_sql
  jsonobjectagg_sql
  jsonarray_sql
  jsonarrayagg_sql
  jsoncolumndef_sql
  jsonschema_sql
  jsontable_sql
  openjsoncolumndef_sql
  openjson_sql
  in_sql
  in_unnest_op
  interval_sql
  return_sql
  reference_sql
  anonymous_sql
  paren_sql
  neg_sql
  not_sql
  alias_sql
  pivotalias_sql
  aliases_sql
  atindex_sql
  attimezone_sql
  fromtimezone_sql
  add_sql
  and_sql
  or_sql
  xor_sql
  connector_sql
  bitwiseand_sql
  bitwiseleftshift_sql
  bitwisenot_sql
  bitwiseor_sql
  bitwiserightshift_sql
  bitwisexor_sql
  cast_sql
  currentdate_sql
  currenttimestamp_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
  altertable_sql
  add_column_sql
  droppartition_sql
  addconstraint_sql
  distinct_sql
  ignorenulls_sql
  respectnulls_sql
  havingmax_sql
  intdiv_sql
  dpipe_sql
  div_sql
  overlaps_sql
  distance_sql
  dot_sql
  propertyeq_sql
  escape_sql
  glob_sql
  gt_sql
  gte_sql
  ilike_sql
  ilikeany_sql
  is_sql
  like_sql
  likeany_sql
  similarto_sql
  lt_sql
  lte_sql
  mod_sql
  mul_sql
  nullsafeeq_sql
  nullsafeneq_sql
  slice_sql
  sub_sql
  trycast_sql
  try_sql
  log_sql
  use_sql
  binary
  function_fallback_sql
  func
  format_args
  too_wide
  format_time
  expressions
  op_expressions
  naked_property
  tag_sql
  token_sql
  userdefinedfunction_sql
  joinhint_sql
  kwarg_sql
  when_sql
  merge_sql
  tochar_sql
  tonumber_sql
  dictproperty_sql
  dictrange_sql
  dictsubproperty_sql
  clusteredbyproperty_sql
  anyvalue_sql
  querytransform_sql
  indexconstraintoption_sql
  checkcolumnconstraint_sql
  nvl2_sql
  comprehension_sql
  columnprefix_sql
  opclass_sql
  predict_sql
  forin_sql
  refresh_sql
  operator_sql
  toarray_sql
  tsordstotime_sql
  tsordstotimestamp_sql
  tsordstodate_sql
  unixdate_sql
  lastday_sql
  dateadd_sql
  arrayany_sql
  generateseries_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
  length_sql
  rand_sql
  strtodate_sql
  strtotime_sql
  changes_sql
  pad_sql