sqlglot.dialects.clickhouse API documentation

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

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 = {}
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
  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

    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
    152        SINGLE_TOKENS = {
    153            **tokens.Tokenizer.SINGLE_TOKENS,
    154            "$": TokenType.HEREDOC_STRING,
    155        }

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.HINT: 'HINT'>, '==': <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'>, '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
  WHITE_SPACE
  COMMANDS
  COMMAND_PREFIX_TOKENS
  NUMERIC_LITERALS
  dialect
  reset
  tokenize
  tokenize_rs
  size
  sql
  tokens

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

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

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

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

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

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

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

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

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

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

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

    849        def datatype_sql(self, expression: exp.DataType) -> str:
    850            # String is the standard ClickHouse type, every other variant is just an alias.
    851            # Additionally, any supplied length parameter will be ignored.
    852            #
    853            # https://clickhouse.com/docs/en/sql-reference/data-types/string
    854            if expression.this in self.STRING_TYPE_MAPPING:
    855                return "String"
    856
    857            return super().datatype_sql(expression)

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

    859        def cte_sql(self, expression: exp.CTE) -> str:
    860            if expression.args.get("scalar"):
    861                this = self.sql(expression, "this")
    862                alias = self.sql(expression, "alias")
    863                return f"{this} AS {alias}"
    864
    865            return super().cte_sql(expression)

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

    867        def after_limit_modifiers(self, expression: exp.Expression) -> t.List[str]:
    868            return super().after_limit_modifiers(expression) + [
    869                (
    870                    self.seg("SETTINGS ") + self.expressions(expression, key="settings", flat=True)
    871                    if expression.args.get("settings")
    872                    else ""
    873                ),
    874                (
    875                    self.seg("FORMAT ") + self.sql(expression, "format")
    876                    if expression.args.get("format")
    877                    else ""
    878                ),
    879            ]

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

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

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

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

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

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

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

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

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

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

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

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

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

    900        def createable_sql(self, expression: exp.Create, locations: t.DefaultDict) -> str:
    901            if expression.kind in self.ON_CLUSTER_TARGETS and locations.get(
    902                exp.Properties.Location.POST_NAME
    903            ):
    904                this_name = self.sql(expression.this, "this")
    905                this_properties = " ".join(
    906                    [self.sql(prop) for prop in locations[exp.Properties.Location.POST_NAME]]
    907                )
    908                this_schema = self.schema_columns_sql(expression.this)
    909                return f"{this_name}{self.sep()}{this_properties}{self.sep()}{this_schema}"
    910
    911            return super().createable_sql(expression, locations)

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

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

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

    917        def indexcolumnconstraint_sql(self, expression: exp.IndexColumnConstraint) -> str:
    918            this = self.sql(expression, "this")
    919            this = f" {this}" if this else ""
    920            expr = self.sql(expression, "expression")
    921            expr = f" {expr}" if expr else ""
    922            index_type = self.sql(expression, "index_type")
    923            index_type = f" TYPE {index_type}" if index_type else ""
    924            granularity = self.sql(expression, "granularity")
    925            granularity = f" GRANULARITY {granularity}" if granularity else ""
    926
    927            return f"INDEX{this}{expr}{index_type}{granularity}"

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

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

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

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

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

    935        def replacepartition_sql(self, expression: exp.ReplacePartition) -> str:
    936            return (
    937                f"REPLACE {self.sql(expression.expression)} FROM {self.sql(expression, 'source')}"
    938            )

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

    940        def projectiondef_sql(self, expression: exp.ProjectionDef) -> str:
    941            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 = {'qualify': <function Generator.<lambda>>, 'windows': <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
  SUPPORTS_TABLE_ALIAS_COLUMNS
  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
  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