Edit on GitHub

# sqlglot.dialects.clickhouse

View Source

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

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

     164class ClickHouse(Dialect):
     165    NORMALIZE_FUNCTIONS: bool | str = False
     166    NULL_ORDERING = "nulls_are_last"
     167    SUPPORTS_USER_DEFINED_TYPES = False
     168    SAFE_DIVISION = True
     169    LOG_BASE_FIRST: t.Optional[bool] = None
     170    FORCE_EARLY_ALIAS_REF_EXPANSION = True
     171    PRESERVE_ORIGINAL_NAMES = True
     172    NUMBERS_CAN_BE_UNDERSCORE_SEPARATED = True
     173    IDENTIFIERS_CAN_START_WITH_DIGIT = True
     174
     175    # https://github.com/ClickHouse/ClickHouse/issues/33935#issue-1112165779
     176    NORMALIZATION_STRATEGY = NormalizationStrategy.CASE_SENSITIVE
     177
     178    UNESCAPED_SEQUENCES = {
     179        "\\0": "\0",
     180    }
     181
     182    CREATABLE_KIND_MAPPING = {"DATABASE": "SCHEMA"}
     183
     184    SET_OP_DISTINCT_BY_DEFAULT: t.Dict[t.Type[exp.Expression], t.Optional[bool]] = {
     185        exp.Except: False,
     186        exp.Intersect: False,
     187        exp.Union: None,
     188    }
     189
     190    class Tokenizer(tokens.Tokenizer):
     191        COMMENTS = ["--", "#", "#!", ("/*", "*/")]
     192        IDENTIFIERS = ['"', "`"]
     193        IDENTIFIER_ESCAPES = ["\\"]
     194        STRING_ESCAPES = ["'", "\\"]
     195        BIT_STRINGS = [("0b", "")]
     196        HEX_STRINGS = [("0x", ""), ("0X", "")]
     197        HEREDOC_STRINGS = ["$"]
     198
     199        KEYWORDS = {
     200            **tokens.Tokenizer.KEYWORDS,
     201            "ATTACH": TokenType.COMMAND,
     202            "DATE32": TokenType.DATE32,
     203            "DATETIME64": TokenType.DATETIME64,
     204            "DICTIONARY": TokenType.DICTIONARY,
     205            "DYNAMIC": TokenType.DYNAMIC,
     206            "ENUM8": TokenType.ENUM8,
     207            "ENUM16": TokenType.ENUM16,
     208            "FINAL": TokenType.FINAL,
     209            "FIXEDSTRING": TokenType.FIXEDSTRING,
     210            "FLOAT32": TokenType.FLOAT,
     211            "FLOAT64": TokenType.DOUBLE,
     212            "GLOBAL": TokenType.GLOBAL,
     213            "INT256": TokenType.INT256,
     214            "LOWCARDINALITY": TokenType.LOWCARDINALITY,
     215            "MAP": TokenType.MAP,
     216            "NESTED": TokenType.NESTED,
     217            "SAMPLE": TokenType.TABLE_SAMPLE,
     218            "TUPLE": TokenType.STRUCT,
     219            "UINT128": TokenType.UINT128,
     220            "UINT16": TokenType.USMALLINT,
     221            "UINT256": TokenType.UINT256,
     222            "UINT32": TokenType.UINT,
     223            "UINT64": TokenType.UBIGINT,
     224            "UINT8": TokenType.UTINYINT,
     225            "IPV4": TokenType.IPV4,
     226            "IPV6": TokenType.IPV6,
     227            "POINT": TokenType.POINT,
     228            "RING": TokenType.RING,
     229            "LINESTRING": TokenType.LINESTRING,
     230            "MULTILINESTRING": TokenType.MULTILINESTRING,
     231            "POLYGON": TokenType.POLYGON,
     232            "MULTIPOLYGON": TokenType.MULTIPOLYGON,
     233            "AGGREGATEFUNCTION": TokenType.AGGREGATEFUNCTION,
     234            "SIMPLEAGGREGATEFUNCTION": TokenType.SIMPLEAGGREGATEFUNCTION,
     235            "SYSTEM": TokenType.COMMAND,
     236            "PREWHERE": TokenType.PREWHERE,
     237        }
     238        KEYWORDS.pop("/*+")
     239
     240        SINGLE_TOKENS = {
     241            **tokens.Tokenizer.SINGLE_TOKENS,
     242            "$": TokenType.HEREDOC_STRING,
     243        }
     244
     245    class Parser(parser.Parser):
     246        # Tested in ClickHouse's playground, it seems that the following two queries do the same thing
     247        # * select x from t1 union all select x from t2 limit 1;
     248        # * select x from t1 union all (select x from t2 limit 1);
     249        MODIFIERS_ATTACHED_TO_SET_OP = False
     250        INTERVAL_SPANS = False
     251        OPTIONAL_ALIAS_TOKEN_CTE = False
     252
     253        FUNCTIONS = {
     254            **parser.Parser.FUNCTIONS,
     255            "ANY": exp.AnyValue.from_arg_list,
     256            "ARRAYSUM": exp.ArraySum.from_arg_list,
     257            "COUNTIF": _build_count_if,
     258            "DATE_ADD": build_date_delta(exp.DateAdd, default_unit=None),
     259            "DATEADD": build_date_delta(exp.DateAdd, default_unit=None),
     260            "DATE_DIFF": build_date_delta(exp.DateDiff, default_unit=None),
     261            "DATEDIFF": build_date_delta(exp.DateDiff, default_unit=None),
     262            "DATE_FORMAT": _build_date_format,
     263            "DATE_SUB": build_date_delta(exp.DateSub, default_unit=None),
     264            "DATESUB": build_date_delta(exp.DateSub, default_unit=None),
     265            "FORMATDATETIME": _build_date_format,
     266            "JSONEXTRACTSTRING": build_json_extract_path(
     267                exp.JSONExtractScalar, zero_based_indexing=False
     268            ),
     269            "LENGTH": lambda args: exp.Length(this=seq_get(args, 0), binary=True),
     270            "MAP": parser.build_var_map,
     271            "MATCH": exp.RegexpLike.from_arg_list,
     272            "RANDCANONICAL": exp.Rand.from_arg_list,
     273            "STR_TO_DATE": _build_str_to_date,
     274            "TUPLE": exp.Struct.from_arg_list,
     275            "TIMESTAMP_SUB": build_date_delta(exp.TimestampSub, default_unit=None),
     276            "TIMESTAMPSUB": build_date_delta(exp.TimestampSub, default_unit=None),
     277            "TIMESTAMP_ADD": build_date_delta(exp.TimestampAdd, default_unit=None),
     278            "TIMESTAMPADD": build_date_delta(exp.TimestampAdd, default_unit=None),
     279            "UNIQ": exp.ApproxDistinct.from_arg_list,
     280            "XOR": lambda args: exp.Xor(expressions=args),
     281            "MD5": exp.MD5Digest.from_arg_list,
     282            "SHA256": lambda args: exp.SHA2(this=seq_get(args, 0), length=exp.Literal.number(256)),
     283            "SHA512": lambda args: exp.SHA2(this=seq_get(args, 0), length=exp.Literal.number(512)),
     284            "EDITDISTANCE": exp.Levenshtein.from_arg_list,
     285            "LEVENSHTEINDISTANCE": exp.Levenshtein.from_arg_list,
     286        }
     287        FUNCTIONS.pop("TRANSFORM")
     288
     289        AGG_FUNCTIONS = {
     290            "count",
     291            "min",
     292            "max",
     293            "sum",
     294            "avg",
     295            "any",
     296            "stddevPop",
     297            "stddevSamp",
     298            "varPop",
     299            "varSamp",
     300            "corr",
     301            "covarPop",
     302            "covarSamp",
     303            "entropy",
     304            "exponentialMovingAverage",
     305            "intervalLengthSum",
     306            "kolmogorovSmirnovTest",
     307            "mannWhitneyUTest",
     308            "median",
     309            "rankCorr",
     310            "sumKahan",
     311            "studentTTest",
     312            "welchTTest",
     313            "anyHeavy",
     314            "anyLast",
     315            "boundingRatio",
     316            "first_value",
     317            "last_value",
     318            "argMin",
     319            "argMax",
     320            "avgWeighted",
     321            "topK",
     322            "topKWeighted",
     323            "deltaSum",
     324            "deltaSumTimestamp",
     325            "groupArray",
     326            "groupArrayLast",
     327            "groupUniqArray",
     328            "groupArrayInsertAt",
     329            "groupArrayMovingAvg",
     330            "groupArrayMovingSum",
     331            "groupArraySample",
     332            "groupBitAnd",
     333            "groupBitOr",
     334            "groupBitXor",
     335            "groupBitmap",
     336            "groupBitmapAnd",
     337            "groupBitmapOr",
     338            "groupBitmapXor",
     339            "sumWithOverflow",
     340            "sumMap",
     341            "minMap",
     342            "maxMap",
     343            "skewSamp",
     344            "skewPop",
     345            "kurtSamp",
     346            "kurtPop",
     347            "uniq",
     348            "uniqExact",
     349            "uniqCombined",
     350            "uniqCombined64",
     351            "uniqHLL12",
     352            "uniqTheta",
     353            "quantile",
     354            "quantiles",
     355            "quantileExact",
     356            "quantilesExact",
     357            "quantileExactLow",
     358            "quantilesExactLow",
     359            "quantileExactHigh",
     360            "quantilesExactHigh",
     361            "quantileExactWeighted",
     362            "quantilesExactWeighted",
     363            "quantileTiming",
     364            "quantilesTiming",
     365            "quantileTimingWeighted",
     366            "quantilesTimingWeighted",
     367            "quantileDeterministic",
     368            "quantilesDeterministic",
     369            "quantileTDigest",
     370            "quantilesTDigest",
     371            "quantileTDigestWeighted",
     372            "quantilesTDigestWeighted",
     373            "quantileBFloat16",
     374            "quantilesBFloat16",
     375            "quantileBFloat16Weighted",
     376            "quantilesBFloat16Weighted",
     377            "simpleLinearRegression",
     378            "stochasticLinearRegression",
     379            "stochasticLogisticRegression",
     380            "categoricalInformationValue",
     381            "contingency",
     382            "cramersV",
     383            "cramersVBiasCorrected",
     384            "theilsU",
     385            "maxIntersections",
     386            "maxIntersectionsPosition",
     387            "meanZTest",
     388            "quantileInterpolatedWeighted",
     389            "quantilesInterpolatedWeighted",
     390            "quantileGK",
     391            "quantilesGK",
     392            "sparkBar",
     393            "sumCount",
     394            "largestTriangleThreeBuckets",
     395            "histogram",
     396            "sequenceMatch",
     397            "sequenceCount",
     398            "windowFunnel",
     399            "retention",
     400            "uniqUpTo",
     401            "sequenceNextNode",
     402            "exponentialTimeDecayedAvg",
     403        }
     404
     405        AGG_FUNCTIONS_SUFFIXES = [
     406            "If",
     407            "Array",
     408            "ArrayIf",
     409            "Map",
     410            "SimpleState",
     411            "State",
     412            "Merge",
     413            "MergeState",
     414            "ForEach",
     415            "Distinct",
     416            "OrDefault",
     417            "OrNull",
     418            "Resample",
     419            "ArgMin",
     420            "ArgMax",
     421        ]
     422
     423        FUNC_TOKENS = {
     424            *parser.Parser.FUNC_TOKENS,
     425            TokenType.SET,
     426        }
     427
     428        RESERVED_TOKENS = parser.Parser.RESERVED_TOKENS - {TokenType.SELECT}
     429
     430        ID_VAR_TOKENS = {
     431            *parser.Parser.ID_VAR_TOKENS,
     432            TokenType.LIKE,
     433        }
     434
     435        AGG_FUNC_MAPPING = (
     436            lambda functions, suffixes: {
     437                f"{f}{sfx}": (f, sfx) for sfx in (suffixes + [""]) for f in functions
     438            }
     439        )(AGG_FUNCTIONS, AGG_FUNCTIONS_SUFFIXES)
     440
     441        FUNCTIONS_WITH_ALIASED_ARGS = {*parser.Parser.FUNCTIONS_WITH_ALIASED_ARGS, "TUPLE"}
     442
     443        FUNCTION_PARSERS = {
     444            **parser.Parser.FUNCTION_PARSERS,
     445            "ARRAYJOIN": lambda self: self.expression(exp.Explode, this=self._parse_expression()),
     446            "QUANTILE": lambda self: self._parse_quantile(),
     447            "MEDIAN": lambda self: self._parse_quantile(),
     448            "COLUMNS": lambda self: self._parse_columns(),
     449        }
     450
     451        FUNCTION_PARSERS.pop("MATCH")
     452
     453        PROPERTY_PARSERS = parser.Parser.PROPERTY_PARSERS.copy()
     454        PROPERTY_PARSERS.pop("DYNAMIC")
     455
     456        NO_PAREN_FUNCTION_PARSERS = parser.Parser.NO_PAREN_FUNCTION_PARSERS.copy()
     457        NO_PAREN_FUNCTION_PARSERS.pop("ANY")
     458
     459        NO_PAREN_FUNCTIONS = parser.Parser.NO_PAREN_FUNCTIONS.copy()
     460        NO_PAREN_FUNCTIONS.pop(TokenType.CURRENT_TIMESTAMP)
     461
     462        RANGE_PARSERS = {
     463            **parser.Parser.RANGE_PARSERS,
     464            TokenType.GLOBAL: lambda self, this: self._match(TokenType.IN)
     465            and self._parse_in(this, is_global=True),
     466        }
     467
     468        # The PLACEHOLDER entry is popped because 1) it doesn't affect Clickhouse (it corresponds to
     469        # the postgres-specific JSONBContains parser) and 2) it makes parsing the ternary op simpler.
     470        COLUMN_OPERATORS = parser.Parser.COLUMN_OPERATORS.copy()
     471        COLUMN_OPERATORS.pop(TokenType.PLACEHOLDER)
     472
     473        JOIN_KINDS = {
     474            *parser.Parser.JOIN_KINDS,
     475            TokenType.ANY,
     476            TokenType.ASOF,
     477            TokenType.ARRAY,
     478        }
     479
     480        TABLE_ALIAS_TOKENS = parser.Parser.TABLE_ALIAS_TOKENS - {
     481            TokenType.ANY,
     482            TokenType.ARRAY,
     483            TokenType.FINAL,
     484            TokenType.FORMAT,
     485            TokenType.SETTINGS,
     486        }
     487
     488        ALIAS_TOKENS = parser.Parser.ALIAS_TOKENS - {
     489            TokenType.FORMAT,
     490        }
     491
     492        LOG_DEFAULTS_TO_LN = True
     493
     494        QUERY_MODIFIER_PARSERS = {
     495            **parser.Parser.QUERY_MODIFIER_PARSERS,
     496            TokenType.SETTINGS: lambda self: (
     497                "settings",
     498                self._advance() or self._parse_csv(self._parse_assignment),
     499            ),
     500            TokenType.FORMAT: lambda self: ("format", self._advance() or self._parse_id_var()),
     501        }
     502
     503        CONSTRAINT_PARSERS = {
     504            **parser.Parser.CONSTRAINT_PARSERS,
     505            "INDEX": lambda self: self._parse_index_constraint(),
     506            "CODEC": lambda self: self._parse_compress(),
     507        }
     508
     509        ALTER_PARSERS = {
     510            **parser.Parser.ALTER_PARSERS,
     511            "REPLACE": lambda self: self._parse_alter_table_replace(),
     512        }
     513
     514        SCHEMA_UNNAMED_CONSTRAINTS = {
     515            *parser.Parser.SCHEMA_UNNAMED_CONSTRAINTS,
     516            "INDEX",
     517        }
     518
     519        PLACEHOLDER_PARSERS = {
     520            **parser.Parser.PLACEHOLDER_PARSERS,
     521            TokenType.L_BRACE: lambda self: self._parse_query_parameter(),
     522        }
     523
     524        # https://clickhouse.com/docs/en/sql-reference/statements/create/function
     525        def _parse_user_defined_function_expression(self) -> t.Optional[exp.Expression]:
     526            return self._parse_lambda()
     527
     528        def _parse_types(
     529            self, check_func: bool = False, schema: bool = False, allow_identifiers: bool = True
     530        ) -> t.Optional[exp.Expression]:
     531            dtype = super()._parse_types(
     532                check_func=check_func, schema=schema, allow_identifiers=allow_identifiers
     533            )
     534            if isinstance(dtype, exp.DataType) and dtype.args.get("nullable") is not True:
     535                # Mark every type as non-nullable which is ClickHouse's default, unless it's
     536                # already marked as nullable. This marker helps us transpile types from other
     537                # dialects to ClickHouse, so that we can e.g. produce `CAST(x AS Nullable(String))`
     538                # from `CAST(x AS TEXT)`. If there is a `NULL` value in `x`, the former would
     539                # fail in ClickHouse without the `Nullable` type constructor.
     540                dtype.set("nullable", False)
     541
     542            return dtype
     543
     544        def _parse_extract(self) -> exp.Extract | exp.Anonymous:
     545            index = self._index
     546            this = self._parse_bitwise()
     547            if self._match(TokenType.FROM):
     548                self._retreat(index)
     549                return super()._parse_extract()
     550
     551            # We return Anonymous here because extract and regexpExtract have different semantics,
     552            # so parsing extract(foo, bar) into RegexpExtract can potentially break queries. E.g.,
     553            # `extract('foobar', 'b')` works, but ClickHouse crashes for `regexpExtract('foobar', 'b')`.
     554            #
     555            # TODO: can we somehow convert the former into an equivalent `regexpExtract` call?
     556            self._match(TokenType.COMMA)
     557            return self.expression(
     558                exp.Anonymous, this="extract", expressions=[this, self._parse_bitwise()]
     559            )
     560
     561        def _parse_assignment(self) -> t.Optional[exp.Expression]:
     562            this = super()._parse_assignment()
     563
     564            if self._match(TokenType.PLACEHOLDER):
     565                return self.expression(
     566                    exp.If,
     567                    this=this,
     568                    true=self._parse_assignment(),
     569                    false=self._match(TokenType.COLON) and self._parse_assignment(),
     570                )
     571
     572            return this
     573
     574        def _parse_query_parameter(self) -> t.Optional[exp.Expression]:
     575            """
     576            Parse a placeholder expression like SELECT {abc: UInt32} or FROM {table: Identifier}
     577            https://clickhouse.com/docs/en/sql-reference/syntax#defining-and-using-query-parameters
     578            """
     579            index = self._index
     580
     581            this = self._parse_id_var()
     582            self._match(TokenType.COLON)
     583            kind = self._parse_types(check_func=False, allow_identifiers=False) or (
     584                self._match_text_seq("IDENTIFIER") and "Identifier"
     585            )
     586
     587            if not kind:
     588                self._retreat(index)
     589                return None
     590            elif not self._match(TokenType.R_BRACE):
     591                self.raise_error("Expecting }")
     592
     593            return self.expression(exp.Placeholder, this=this, kind=kind)
     594
     595        def _parse_bracket(
     596            self, this: t.Optional[exp.Expression] = None
     597        ) -> t.Optional[exp.Expression]:
     598            l_brace = self._match(TokenType.L_BRACE, advance=False)
     599            bracket = super()._parse_bracket(this)
     600
     601            if l_brace and isinstance(bracket, exp.Struct):
     602                varmap = exp.VarMap(keys=exp.Array(), values=exp.Array())
     603                for expression in bracket.expressions:
     604                    if not isinstance(expression, exp.PropertyEQ):
     605                        break
     606
     607                    varmap.args["keys"].append("expressions", exp.Literal.string(expression.name))
     608                    varmap.args["values"].append("expressions", expression.expression)
     609
     610                return varmap
     611
     612            return bracket
     613
     614        def _parse_in(self, this: t.Optional[exp.Expression], is_global: bool = False) -> exp.In:
     615            this = super()._parse_in(this)
     616            this.set("is_global", is_global)
     617            return this
     618
     619        def _parse_table(
     620            self,
     621            schema: bool = False,
     622            joins: bool = False,
     623            alias_tokens: t.Optional[t.Collection[TokenType]] = None,
     624            parse_bracket: bool = False,
     625            is_db_reference: bool = False,
     626            parse_partition: bool = False,
     627        ) -> t.Optional[exp.Expression]:
     628            this = super()._parse_table(
     629                schema=schema,
     630                joins=joins,
     631                alias_tokens=alias_tokens,
     632                parse_bracket=parse_bracket,
     633                is_db_reference=is_db_reference,
     634            )
     635
     636            if self._match(TokenType.FINAL):
     637                this = self.expression(exp.Final, this=this)
     638
     639            return this
     640
     641        def _parse_position(self, haystack_first: bool = False) -> exp.StrPosition:
     642            return super()._parse_position(haystack_first=True)
     643
     644        # https://clickhouse.com/docs/en/sql-reference/statements/select/with/
     645        def _parse_cte(self) -> t.Optional[exp.CTE]:
     646            # WITH <identifier> AS <subquery expression>
     647            cte: t.Optional[exp.CTE] = self._try_parse(super()._parse_cte)
     648
     649            if not cte:
     650                # WITH <expression> AS <identifier>
     651                cte = self.expression(
     652                    exp.CTE,
     653                    this=self._parse_assignment(),
     654                    alias=self._parse_table_alias(),
     655                    scalar=True,
     656                )
     657
     658            return cte
     659
     660        def _parse_join_parts(
     661            self,
     662        ) -> t.Tuple[t.Optional[Token], t.Optional[Token], t.Optional[Token]]:
     663            is_global = self._match(TokenType.GLOBAL) and self._prev
     664            kind_pre = self._match_set(self.JOIN_KINDS, advance=False) and self._prev
     665
     666            if kind_pre:
     667                kind = self._match_set(self.JOIN_KINDS) and self._prev
     668                side = self._match_set(self.JOIN_SIDES) and self._prev
     669                return is_global, side, kind
     670
     671            return (
     672                is_global,
     673                self._match_set(self.JOIN_SIDES) and self._prev,
     674                self._match_set(self.JOIN_KINDS) and self._prev,
     675            )
     676
     677        def _parse_join(
     678            self, skip_join_token: bool = False, parse_bracket: bool = False
     679        ) -> t.Optional[exp.Join]:
     680            join = super()._parse_join(skip_join_token=skip_join_token, parse_bracket=True)
     681            if join:
     682                join.set("global", join.args.pop("method", None))
     683
     684                # tbl ARRAY JOIN arr <-- this should be a `Column` reference, not a `Table`
     685                # https://clickhouse.com/docs/en/sql-reference/statements/select/array-join
     686                if join.kind == "ARRAY":
     687                    for table in join.find_all(exp.Table):
     688                        table.replace(table.to_column())
     689
     690            return join
     691
     692        def _parse_function(
     693            self,
     694            functions: t.Optional[t.Dict[str, t.Callable]] = None,
     695            anonymous: bool = False,
     696            optional_parens: bool = True,
     697            any_token: bool = False,
     698        ) -> t.Optional[exp.Expression]:
     699            expr = super()._parse_function(
     700                functions=functions,
     701                anonymous=anonymous,
     702                optional_parens=optional_parens,
     703                any_token=any_token,
     704            )
     705
     706            func = expr.this if isinstance(expr, exp.Window) else expr
     707
     708            # Aggregate functions can be split in 2 parts: <func_name><suffix>
     709            parts = (
     710                self.AGG_FUNC_MAPPING.get(func.this) if isinstance(func, exp.Anonymous) else None
     711            )
     712
     713            if parts:
     714                anon_func: exp.Anonymous = t.cast(exp.Anonymous, func)
     715                params = self._parse_func_params(anon_func)
     716
     717                kwargs = {
     718                    "this": anon_func.this,
     719                    "expressions": anon_func.expressions,
     720                }
     721                if parts[1]:
     722                    kwargs["parts"] = parts
     723                    exp_class: t.Type[exp.Expression] = (
     724                        exp.CombinedParameterizedAgg if params else exp.CombinedAggFunc
     725                    )
     726                else:
     727                    exp_class = exp.ParameterizedAgg if params else exp.AnonymousAggFunc
     728
     729                kwargs["exp_class"] = exp_class
     730                if params:
     731                    kwargs["params"] = params
     732
     733                func = self.expression(**kwargs)
     734
     735                if isinstance(expr, exp.Window):
     736                    # The window's func was parsed as Anonymous in base parser, fix its
     737                    # type to be ClickHouse style CombinedAnonymousAggFunc / AnonymousAggFunc
     738                    expr.set("this", func)
     739                elif params:
     740                    # Params have blocked super()._parse_function() from parsing the following window
     741                    # (if that exists) as they're standing between the function call and the window spec
     742                    expr = self._parse_window(func)
     743                else:
     744                    expr = func
     745
     746            return expr
     747
     748        def _parse_func_params(
     749            self, this: t.Optional[exp.Func] = None
     750        ) -> t.Optional[t.List[exp.Expression]]:
     751            if self._match_pair(TokenType.R_PAREN, TokenType.L_PAREN):
     752                return self._parse_csv(self._parse_lambda)
     753
     754            if self._match(TokenType.L_PAREN):
     755                params = self._parse_csv(self._parse_lambda)
     756                self._match_r_paren(this)
     757                return params
     758
     759            return None
     760
     761        def _parse_quantile(self) -> exp.Quantile:
     762            this = self._parse_lambda()
     763            params = self._parse_func_params()
     764            if params:
     765                return self.expression(exp.Quantile, this=params[0], quantile=this)
     766            return self.expression(exp.Quantile, this=this, quantile=exp.Literal.number(0.5))
     767
     768        def _parse_wrapped_id_vars(self, optional: bool = False) -> t.List[exp.Expression]:
     769            return super()._parse_wrapped_id_vars(optional=True)
     770
     771        def _parse_primary_key(
     772            self, wrapped_optional: bool = False, in_props: bool = False
     773        ) -> exp.PrimaryKeyColumnConstraint | exp.PrimaryKey:
     774            return super()._parse_primary_key(
     775                wrapped_optional=wrapped_optional or in_props, in_props=in_props
     776            )
     777
     778        def _parse_on_property(self) -> t.Optional[exp.Expression]:
     779            index = self._index
     780            if self._match_text_seq("CLUSTER"):
     781                this = self._parse_id_var()
     782                if this:
     783                    return self.expression(exp.OnCluster, this=this)
     784                else:
     785                    self._retreat(index)
     786            return None
     787
     788        def _parse_index_constraint(
     789            self, kind: t.Optional[str] = None
     790        ) -> exp.IndexColumnConstraint:
     791            # INDEX name1 expr TYPE type1(args) GRANULARITY value
     792            this = self._parse_id_var()
     793            expression = self._parse_assignment()
     794
     795            index_type = self._match_text_seq("TYPE") and (
     796                self._parse_function() or self._parse_var()
     797            )
     798
     799            granularity = self._match_text_seq("GRANULARITY") and self._parse_term()
     800
     801            return self.expression(
     802                exp.IndexColumnConstraint,
     803                this=this,
     804                expression=expression,
     805                index_type=index_type,
     806                granularity=granularity,
     807            )
     808
     809        def _parse_partition(self) -> t.Optional[exp.Partition]:
     810            # https://clickhouse.com/docs/en/sql-reference/statements/alter/partition#how-to-set-partition-expression
     811            if not self._match(TokenType.PARTITION):
     812                return None
     813
     814            if self._match_text_seq("ID"):
     815                # Corresponds to the PARTITION ID <string_value> syntax
     816                expressions: t.List[exp.Expression] = [
     817                    self.expression(exp.PartitionId, this=self._parse_string())
     818                ]
     819            else:
     820                expressions = self._parse_expressions()
     821
     822            return self.expression(exp.Partition, expressions=expressions)
     823
     824        def _parse_alter_table_replace(self) -> t.Optional[exp.Expression]:
     825            partition = self._parse_partition()
     826
     827            if not partition or not self._match(TokenType.FROM):
     828                return None
     829
     830            return self.expression(
     831                exp.ReplacePartition, expression=partition, source=self._parse_table_parts()
     832            )
     833
     834        def _parse_projection_def(self) -> t.Optional[exp.ProjectionDef]:
     835            if not self._match_text_seq("PROJECTION"):
     836                return None
     837
     838            return self.expression(
     839                exp.ProjectionDef,
     840                this=self._parse_id_var(),
     841                expression=self._parse_wrapped(self._parse_statement),
     842            )
     843
     844        def _parse_constraint(self) -> t.Optional[exp.Expression]:
     845            return super()._parse_constraint() or self._parse_projection_def()
     846
     847        def _parse_alias(
     848            self, this: t.Optional[exp.Expression], explicit: bool = False
     849        ) -> t.Optional[exp.Expression]:
     850            # In clickhouse "SELECT <expr> APPLY(...)" is a query modifier,
     851            # so "APPLY" shouldn't be parsed as <expr>'s alias. However, "SELECT <expr> apply" is a valid alias
     852            if self._match_pair(TokenType.APPLY, TokenType.L_PAREN, advance=False):
     853                return this
     854
     855            return super()._parse_alias(this=this, explicit=explicit)
     856
     857        def _parse_expression(self) -> t.Optional[exp.Expression]:
     858            this = super()._parse_expression()
     859
     860            # Clickhouse allows "SELECT <expr> [APPLY(func)] [...]]" modifier
     861            while self._match_pair(TokenType.APPLY, TokenType.L_PAREN):
     862                this = exp.Apply(this=this, expression=self._parse_var(any_token=True))
     863                self._match(TokenType.R_PAREN)
     864
     865            return this
     866
     867        def _parse_columns(self) -> exp.Expression:
     868            this: exp.Expression = self.expression(exp.Columns, this=self._parse_lambda())
     869
     870            while self._next and self._match_text_seq(")", "APPLY", "("):
     871                self._match(TokenType.R_PAREN)
     872                this = exp.Apply(this=this, expression=self._parse_var(any_token=True))
     873            return this
     874
     875    class Generator(generator.Generator):
     876        QUERY_HINTS = False
     877        STRUCT_DELIMITER = ("(", ")")
     878        NVL2_SUPPORTED = False
     879        TABLESAMPLE_REQUIRES_PARENS = False
     880        TABLESAMPLE_SIZE_IS_ROWS = False
     881        TABLESAMPLE_KEYWORDS = "SAMPLE"
     882        LAST_DAY_SUPPORTS_DATE_PART = False
     883        CAN_IMPLEMENT_ARRAY_ANY = True
     884        SUPPORTS_TO_NUMBER = False
     885        JOIN_HINTS = False
     886        TABLE_HINTS = False
     887        GROUPINGS_SEP = ""
     888        SET_OP_MODIFIERS = False
     889        SUPPORTS_TABLE_ALIAS_COLUMNS = False
     890        VALUES_AS_TABLE = False
     891        ARRAY_SIZE_NAME = "LENGTH"
     892
     893        STRING_TYPE_MAPPING = {
     894            exp.DataType.Type.CHAR: "String",
     895            exp.DataType.Type.LONGBLOB: "String",
     896            exp.DataType.Type.LONGTEXT: "String",
     897            exp.DataType.Type.MEDIUMBLOB: "String",
     898            exp.DataType.Type.MEDIUMTEXT: "String",
     899            exp.DataType.Type.TINYBLOB: "String",
     900            exp.DataType.Type.TINYTEXT: "String",
     901            exp.DataType.Type.TEXT: "String",
     902            exp.DataType.Type.VARBINARY: "String",
     903            exp.DataType.Type.VARCHAR: "String",
     904        }
     905
     906        SUPPORTED_JSON_PATH_PARTS = {
     907            exp.JSONPathKey,
     908            exp.JSONPathRoot,
     909            exp.JSONPathSubscript,
     910        }
     911
     912        TYPE_MAPPING = {
     913            **generator.Generator.TYPE_MAPPING,
     914            **STRING_TYPE_MAPPING,
     915            exp.DataType.Type.ARRAY: "Array",
     916            exp.DataType.Type.BOOLEAN: "Bool",
     917            exp.DataType.Type.BIGINT: "Int64",
     918            exp.DataType.Type.DATE32: "Date32",
     919            exp.DataType.Type.DATETIME: "DateTime",
     920            exp.DataType.Type.DATETIME2: "DateTime",
     921            exp.DataType.Type.SMALLDATETIME: "DateTime",
     922            exp.DataType.Type.DATETIME64: "DateTime64",
     923            exp.DataType.Type.DECIMAL: "Decimal",
     924            exp.DataType.Type.DECIMAL32: "Decimal32",
     925            exp.DataType.Type.DECIMAL64: "Decimal64",
     926            exp.DataType.Type.DECIMAL128: "Decimal128",
     927            exp.DataType.Type.DECIMAL256: "Decimal256",
     928            exp.DataType.Type.TIMESTAMP: "DateTime",
     929            exp.DataType.Type.TIMESTAMPTZ: "DateTime",
     930            exp.DataType.Type.DOUBLE: "Float64",
     931            exp.DataType.Type.ENUM: "Enum",
     932            exp.DataType.Type.ENUM8: "Enum8",
     933            exp.DataType.Type.ENUM16: "Enum16",
     934            exp.DataType.Type.FIXEDSTRING: "FixedString",
     935            exp.DataType.Type.FLOAT: "Float32",
     936            exp.DataType.Type.INT: "Int32",
     937            exp.DataType.Type.MEDIUMINT: "Int32",
     938            exp.DataType.Type.INT128: "Int128",
     939            exp.DataType.Type.INT256: "Int256",
     940            exp.DataType.Type.LOWCARDINALITY: "LowCardinality",
     941            exp.DataType.Type.MAP: "Map",
     942            exp.DataType.Type.NESTED: "Nested",
     943            exp.DataType.Type.SMALLINT: "Int16",
     944            exp.DataType.Type.STRUCT: "Tuple",
     945            exp.DataType.Type.TINYINT: "Int8",
     946            exp.DataType.Type.UBIGINT: "UInt64",
     947            exp.DataType.Type.UINT: "UInt32",
     948            exp.DataType.Type.UINT128: "UInt128",
     949            exp.DataType.Type.UINT256: "UInt256",
     950            exp.DataType.Type.USMALLINT: "UInt16",
     951            exp.DataType.Type.UTINYINT: "UInt8",
     952            exp.DataType.Type.IPV4: "IPv4",
     953            exp.DataType.Type.IPV6: "IPv6",
     954            exp.DataType.Type.POINT: "Point",
     955            exp.DataType.Type.RING: "Ring",
     956            exp.DataType.Type.LINESTRING: "LineString",
     957            exp.DataType.Type.MULTILINESTRING: "MultiLineString",
     958            exp.DataType.Type.POLYGON: "Polygon",
     959            exp.DataType.Type.MULTIPOLYGON: "MultiPolygon",
     960            exp.DataType.Type.AGGREGATEFUNCTION: "AggregateFunction",
     961            exp.DataType.Type.SIMPLEAGGREGATEFUNCTION: "SimpleAggregateFunction",
     962            exp.DataType.Type.DYNAMIC: "Dynamic",
     963        }
     964
     965        TRANSFORMS = {
     966            **generator.Generator.TRANSFORMS,
     967            exp.AnyValue: rename_func("any"),
     968            exp.ApproxDistinct: rename_func("uniq"),
     969            exp.ArrayFilter: lambda self, e: self.func("arrayFilter", e.expression, e.this),
     970            exp.ArraySum: rename_func("arraySum"),
     971            exp.ArgMax: arg_max_or_min_no_count("argMax"),
     972            exp.ArgMin: arg_max_or_min_no_count("argMin"),
     973            exp.Array: inline_array_sql,
     974            exp.CastToStrType: rename_func("CAST"),
     975            exp.CountIf: rename_func("countIf"),
     976            exp.CompressColumnConstraint: lambda self,
     977            e: f"CODEC({self.expressions(e, key='this', flat=True)})",
     978            exp.ComputedColumnConstraint: lambda self,
     979            e: f"{'MATERIALIZED' if e.args.get('persisted') else 'ALIAS'} {self.sql(e, 'this')}",
     980            exp.CurrentDate: lambda self, e: self.func("CURRENT_DATE"),
     981            exp.DateAdd: _datetime_delta_sql("DATE_ADD"),
     982            exp.DateDiff: _datetime_delta_sql("DATE_DIFF"),
     983            exp.DateStrToDate: rename_func("toDate"),
     984            exp.DateSub: _datetime_delta_sql("DATE_SUB"),
     985            exp.Explode: rename_func("arrayJoin"),
     986            exp.Final: lambda self, e: f"{self.sql(e, 'this')} FINAL",
     987            exp.IsNan: rename_func("isNaN"),
     988            exp.JSONExtract: json_extract_segments("JSONExtractString", quoted_index=False),
     989            exp.JSONExtractScalar: json_extract_segments("JSONExtractString", quoted_index=False),
     990            exp.JSONPathKey: json_path_key_only_name,
     991            exp.JSONPathRoot: lambda *_: "",
     992            exp.Length: length_or_char_length_sql,
     993            exp.Map: lambda self, e: _lower_func(var_map_sql(self, e)),
     994            exp.Median: rename_func("median"),
     995            exp.Nullif: rename_func("nullIf"),
     996            exp.PartitionedByProperty: lambda self, e: f"PARTITION BY {self.sql(e, 'this')}",
     997            exp.Pivot: no_pivot_sql,
     998            exp.Quantile: _quantile_sql,
     999            exp.RegexpLike: lambda self, e: self.func("match", e.this, e.expression),
    1000            exp.Rand: rename_func("randCanonical"),
    1001            exp.StartsWith: rename_func("startsWith"),
    1002            exp.StrPosition: lambda self, e: strposition_sql(
    1003                self,
    1004                e,
    1005                func_name="POSITION",
    1006                supports_position=True,
    1007                use_ansi_position=False,
    1008            ),
    1009            exp.TimeToStr: lambda self, e: self.func(
    1010                "formatDateTime", e.this, self.format_time(e), e.args.get("zone")
    1011            ),
    1012            exp.TimeStrToTime: _timestrtotime_sql,
    1013            exp.TimestampAdd: _datetime_delta_sql("TIMESTAMP_ADD"),
    1014            exp.TimestampSub: _datetime_delta_sql("TIMESTAMP_SUB"),
    1015            exp.VarMap: lambda self, e: _lower_func(var_map_sql(self, e)),
    1016            exp.Xor: lambda self, e: self.func("xor", e.this, e.expression, *e.expressions),
    1017            exp.MD5Digest: rename_func("MD5"),
    1018            exp.MD5: lambda self, e: self.func("LOWER", self.func("HEX", self.func("MD5", e.this))),
    1019            exp.SHA: rename_func("SHA1"),
    1020            exp.SHA2: sha256_sql,
    1021            exp.UnixToTime: _unix_to_time_sql,
    1022            exp.TimestampTrunc: timestamptrunc_sql(zone=True),
    1023            exp.Trim: trim_sql,
    1024            exp.Variance: rename_func("varSamp"),
    1025            exp.SchemaCommentProperty: lambda self, e: self.naked_property(e),
    1026            exp.Stddev: rename_func("stddevSamp"),
    1027            exp.Chr: rename_func("CHAR"),
    1028            exp.Lag: lambda self, e: self.func(
    1029                "lagInFrame", e.this, e.args.get("offset"), e.args.get("default")
    1030            ),
    1031            exp.Lead: lambda self, e: self.func(
    1032                "leadInFrame", e.this, e.args.get("offset"), e.args.get("default")
    1033            ),
    1034            exp.Levenshtein: unsupported_args("ins_cost", "del_cost", "sub_cost", "max_dist")(
    1035                rename_func("editDistance")
    1036            ),
    1037        }
    1038
    1039        PROPERTIES_LOCATION = {
    1040            **generator.Generator.PROPERTIES_LOCATION,
    1041            exp.OnCluster: exp.Properties.Location.POST_NAME,
    1042            exp.PartitionedByProperty: exp.Properties.Location.POST_SCHEMA,
    1043            exp.ToTableProperty: exp.Properties.Location.POST_NAME,
    1044            exp.VolatileProperty: exp.Properties.Location.UNSUPPORTED,
    1045        }
    1046
    1047        # There's no list in docs, but it can be found in Clickhouse code
    1048        # see `ClickHouse/src/Parsers/ParserCreate*.cpp`
    1049        ON_CLUSTER_TARGETS = {
    1050            "SCHEMA",  # Transpiled CREATE SCHEMA may have OnCluster property set
    1051            "DATABASE",
    1052            "TABLE",
    1053            "VIEW",
    1054            "DICTIONARY",
    1055            "INDEX",
    1056            "FUNCTION",
    1057            "NAMED COLLECTION",
    1058        }
    1059
    1060        # https://clickhouse.com/docs/en/sql-reference/data-types/nullable
    1061        NON_NULLABLE_TYPES = {
    1062            exp.DataType.Type.ARRAY,
    1063            exp.DataType.Type.MAP,
    1064            exp.DataType.Type.STRUCT,
    1065            exp.DataType.Type.POINT,
    1066            exp.DataType.Type.RING,
    1067            exp.DataType.Type.LINESTRING,
    1068            exp.DataType.Type.MULTILINESTRING,
    1069            exp.DataType.Type.POLYGON,
    1070            exp.DataType.Type.MULTIPOLYGON,
    1071        }
    1072
    1073        def strtodate_sql(self, expression: exp.StrToDate) -> str:
    1074            strtodate_sql = self.function_fallback_sql(expression)
    1075
    1076            if not isinstance(expression.parent, exp.Cast):
    1077                # StrToDate returns DATEs in other dialects (eg. postgres), so
    1078                # this branch aims to improve the transpilation to clickhouse
    1079                return f"CAST({strtodate_sql} AS DATE)"
    1080
    1081            return strtodate_sql
    1082
    1083        def cast_sql(self, expression: exp.Cast, safe_prefix: t.Optional[str] = None) -> str:
    1084            this = expression.this
    1085
    1086            if isinstance(this, exp.StrToDate) and expression.to == exp.DataType.build("datetime"):
    1087                return self.sql(this)
    1088
    1089            return super().cast_sql(expression, safe_prefix=safe_prefix)
    1090
    1091        def trycast_sql(self, expression: exp.TryCast) -> str:
    1092            dtype = expression.to
    1093            if not dtype.is_type(*self.NON_NULLABLE_TYPES, check_nullable=True):
    1094                # Casting x into Nullable(T) appears to behave similarly to TRY_CAST(x AS T)
    1095                dtype.set("nullable", True)
    1096
    1097            return super().cast_sql(expression)
    1098
    1099        def _jsonpathsubscript_sql(self, expression: exp.JSONPathSubscript) -> str:
    1100            this = self.json_path_part(expression.this)
    1101            return str(int(this) + 1) if is_int(this) else this
    1102
    1103        def likeproperty_sql(self, expression: exp.LikeProperty) -> str:
    1104            return f"AS {self.sql(expression, 'this')}"
    1105
    1106        def _any_to_has(
    1107            self,
    1108            expression: exp.EQ | exp.NEQ,
    1109            default: t.Callable[[t.Any], str],
    1110            prefix: str = "",
    1111        ) -> str:
    1112            if isinstance(expression.left, exp.Any):
    1113                arr = expression.left
    1114                this = expression.right
    1115            elif isinstance(expression.right, exp.Any):
    1116                arr = expression.right
    1117                this = expression.left
    1118            else:
    1119                return default(expression)
    1120
    1121            return prefix + self.func("has", arr.this.unnest(), this)
    1122
    1123        def eq_sql(self, expression: exp.EQ) -> str:
    1124            return self._any_to_has(expression, super().eq_sql)
    1125
    1126        def neq_sql(self, expression: exp.NEQ) -> str:
    1127            return self._any_to_has(expression, super().neq_sql, "NOT ")
    1128
    1129        def regexpilike_sql(self, expression: exp.RegexpILike) -> str:
    1130            # Manually add a flag to make the search case-insensitive
    1131            regex = self.func("CONCAT", "'(?i)'", expression.expression)
    1132            return self.func("match", expression.this, regex)
    1133
    1134        def datatype_sql(self, expression: exp.DataType) -> str:
    1135            # String is the standard ClickHouse type, every other variant is just an alias.
    1136            # Additionally, any supplied length parameter will be ignored.
    1137            #
    1138            # https://clickhouse.com/docs/en/sql-reference/data-types/string
    1139            if expression.this in self.STRING_TYPE_MAPPING:
    1140                dtype = "String"
    1141            else:
    1142                dtype = super().datatype_sql(expression)
    1143
    1144            # This section changes the type to `Nullable(...)` if the following conditions hold:
    1145            # - It's marked as nullable - this ensures we won't wrap ClickHouse types with `Nullable`
    1146            #   and change their semantics
    1147            # - It's not the key type of a `Map`. This is because ClickHouse enforces the following
    1148            #   constraint: "Type of Map key must be a type, that can be represented by integer or
    1149            #   String or FixedString (possibly LowCardinality) or UUID or IPv6"
    1150            # - It's not a composite type, e.g. `Nullable(Array(...))` is not a valid type
    1151            parent = expression.parent
    1152            nullable = expression.args.get("nullable")
    1153            if nullable is True or (
    1154                nullable is None
    1155                and not (
    1156                    isinstance(parent, exp.DataType)
    1157                    and parent.is_type(exp.DataType.Type.MAP, check_nullable=True)
    1158                    and expression.index in (None, 0)
    1159                )
    1160                and not expression.is_type(*self.NON_NULLABLE_TYPES, check_nullable=True)
    1161            ):
    1162                dtype = f"Nullable({dtype})"
    1163
    1164            return dtype
    1165
    1166        def cte_sql(self, expression: exp.CTE) -> str:
    1167            if expression.args.get("scalar"):
    1168                this = self.sql(expression, "this")
    1169                alias = self.sql(expression, "alias")
    1170                return f"{this} AS {alias}"
    1171
    1172            return super().cte_sql(expression)
    1173
    1174        def after_limit_modifiers(self, expression: exp.Expression) -> t.List[str]:
    1175            return super().after_limit_modifiers(expression) + [
    1176                (
    1177                    self.seg("SETTINGS ") + self.expressions(expression, key="settings", flat=True)
    1178                    if expression.args.get("settings")
    1179                    else ""
    1180                ),
    1181                (
    1182                    self.seg("FORMAT ") + self.sql(expression, "format")
    1183                    if expression.args.get("format")
    1184                    else ""
    1185                ),
    1186            ]
    1187
    1188        def parameterizedagg_sql(self, expression: exp.ParameterizedAgg) -> str:
    1189            params = self.expressions(expression, key="params", flat=True)
    1190            return self.func(expression.name, *expression.expressions) + f"({params})"
    1191
    1192        def anonymousaggfunc_sql(self, expression: exp.AnonymousAggFunc) -> str:
    1193            return self.func(expression.name, *expression.expressions)
    1194
    1195        def combinedaggfunc_sql(self, expression: exp.CombinedAggFunc) -> str:
    1196            return self.anonymousaggfunc_sql(expression)
    1197
    1198        def combinedparameterizedagg_sql(self, expression: exp.CombinedParameterizedAgg) -> str:
    1199            return self.parameterizedagg_sql(expression)
    1200
    1201        def placeholder_sql(self, expression: exp.Placeholder) -> str:
    1202            return f"{{{expression.name}: {self.sql(expression, 'kind')}}}"
    1203
    1204        def oncluster_sql(self, expression: exp.OnCluster) -> str:
    1205            return f"ON CLUSTER {self.sql(expression, 'this')}"
    1206
    1207        def createable_sql(self, expression: exp.Create, locations: t.DefaultDict) -> str:
    1208            if expression.kind in self.ON_CLUSTER_TARGETS and locations.get(
    1209                exp.Properties.Location.POST_NAME
    1210            ):
    1211                this_name = self.sql(
    1212                    expression.this if isinstance(expression.this, exp.Schema) else expression,
    1213                    "this",
    1214                )
    1215                this_properties = " ".join(
    1216                    [self.sql(prop) for prop in locations[exp.Properties.Location.POST_NAME]]
    1217                )
    1218                this_schema = self.schema_columns_sql(expression.this)
    1219                this_schema = f"{self.sep()}{this_schema}" if this_schema else ""
    1220
    1221                return f"{this_name}{self.sep()}{this_properties}{this_schema}"
    1222
    1223            return super().createable_sql(expression, locations)
    1224
    1225        def create_sql(self, expression: exp.Create) -> str:
    1226            # The comment property comes last in CTAS statements, i.e. after the query
    1227            query = expression.expression
    1228            if isinstance(query, exp.Query):
    1229                comment_prop = expression.find(exp.SchemaCommentProperty)
    1230                if comment_prop:
    1231                    comment_prop.pop()
    1232                    query.replace(exp.paren(query))
    1233            else:
    1234                comment_prop = None
    1235
    1236            create_sql = super().create_sql(expression)
    1237
    1238            comment_sql = self.sql(comment_prop)
    1239            comment_sql = f" {comment_sql}" if comment_sql else ""
    1240
    1241            return f"{create_sql}{comment_sql}"
    1242
    1243        def prewhere_sql(self, expression: exp.PreWhere) -> str:
    1244            this = self.indent(self.sql(expression, "this"))
    1245            return f"{self.seg('PREWHERE')}{self.sep()}{this}"
    1246
    1247        def indexcolumnconstraint_sql(self, expression: exp.IndexColumnConstraint) -> str:
    1248            this = self.sql(expression, "this")
    1249            this = f" {this}" if this else ""
    1250            expr = self.sql(expression, "expression")
    1251            expr = f" {expr}" if expr else ""
    1252            index_type = self.sql(expression, "index_type")
    1253            index_type = f" TYPE {index_type}" if index_type else ""
    1254            granularity = self.sql(expression, "granularity")
    1255            granularity = f" GRANULARITY {granularity}" if granularity else ""
    1256
    1257            return f"INDEX{this}{expr}{index_type}{granularity}"
    1258
    1259        def partition_sql(self, expression: exp.Partition) -> str:
    1260            return f"PARTITION {self.expressions(expression, flat=True)}"
    1261
    1262        def partitionid_sql(self, expression: exp.PartitionId) -> str:
    1263            return f"ID {self.sql(expression.this)}"
    1264
    1265        def replacepartition_sql(self, expression: exp.ReplacePartition) -> str:
    1266            return (
    1267                f"REPLACE {self.sql(expression.expression)} FROM {self.sql(expression, 'source')}"
    1268            )
    1269
    1270        def projectiondef_sql(self, expression: exp.ProjectionDef) -> str:
    1271            return f"PROJECTION {self.sql(expression.this)} {self.wrap(expression.expression)}"
    1272
    1273        def is_sql(self, expression: exp.Is) -> str:
    1274            is_sql = super().is_sql(expression)
    1275
    1276            if isinstance(expression.parent, exp.Not):
    1277                # value IS NOT NULL -> NOT (value IS NULL)
    1278                is_sql = self.wrap(is_sql)
    1279
    1280            return is_sql

NORMALIZE_FUNCTIONS: bool | str = False

Determines how function names are going to be normalized.

###### Possible values:

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

NULL_ORDERING = 'nulls_are_last'

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

SUPPORTS_USER_DEFINED_TYPES = False

Whether user-defined data types are supported.

SAFE_DIVISION = True

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

LOG_BASE_FIRST: Optional[bool] = None

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

FORCE_EARLY_ALIAS_REF_EXPANSION = True

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

###### For example:

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

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

PRESERVE_ORIGINAL_NAMES = True

Whether the name of the function should be preserved inside the node's metadata, can be useful for roundtripping deprecated vs new functions that share an AST node e.g JSON_VALUE vs JSON_EXTRACT_SCALAR in BigQuery

NUMBERS_CAN_BE_UNDERSCORE_SEPARATED = True

Whether number literals can include underscores for better readability

IDENTIFIERS_CAN_START_WITH_DIGIT = True

Whether an unquoted identifier can start with a digit.

NORMALIZATION_STRATEGY = <NormalizationStrategy.CASE_SENSITIVE: 'CASE_SENSITIVE'>

Specifies the strategy according to which identifiers should be normalized.

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

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

CREATABLE_KIND_MAPPING = {'DATABASE': 'SCHEMA'}

Helper for dialects that use a different name for the same creatable kind. For example, the Clickhouse equivalent of CREATE SCHEMA is CREATE DATABASE.

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

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

SUPPORTS_COLUMN_JOIN_MARKS = False

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

tokenizer_class = <class 'ClickHouse.Tokenizer'>
jsonpath_tokenizer_class = <class 'sqlglot.tokens.JSONPathTokenizer'>
parser_class = <class 'ClickHouse.Parser'>
generator_class = <class 'ClickHouse.Generator'>
TIME_TRIE: Dict = {}
FORMAT_TRIE: Dict = {}
INVERSE_TIME_MAPPING: Dict[str, str] = {}
INVERSE_TIME_TRIE: Dict = {}
INVERSE_FORMAT_MAPPING: Dict[str, str] = {}
INVERSE_FORMAT_TRIE: Dict = {}
INVERSE_CREATABLE_KIND_MAPPING: dict[str, str] = {'SCHEMA': 'DATABASE'}
ESCAPED_SEQUENCES: Dict[str, str] = {'\x07': '\\a', '\x08': '\\b', '\x0c': '\\f', '\n': '\\n', '\r': '\\r', '\t': '\\t', '\x0b': '\\v', '\\': '\\\\', '\x00': '\\0'}
QUOTE_START = "'"
QUOTE_END = "'"
IDENTIFIER_START = '"'
IDENTIFIER_END = '"'
BIT_START: Optional[str] = '0b'
BIT_END: Optional[str] = ''
HEX_START: Optional[str] = '0x'
HEX_END: Optional[str] = ''
BYTE_START: Optional[str] = None
BYTE_END: Optional[str] = None
UNICODE_START: Optional[str] = None
UNICODE_END: Optional[str] = None

##### Inherited Members

sqlglot.dialects.dialect.Dialect
  Dialect
  INDEX_OFFSET
  WEEK_OFFSET
  UNNEST_COLUMN_ONLY
  ALIAS_POST_TABLESAMPLE
  TABLESAMPLE_SIZE_IS_PERCENT
  DPIPE_IS_STRING_CONCAT
  STRICT_STRING_CONCAT
  SUPPORTS_SEMI_ANTI_JOIN
  COPY_PARAMS_ARE_CSV
  TYPED_DIVISION
  CONCAT_COALESCE
  HEX_LOWERCASE
  DATE_FORMAT
  DATEINT_FORMAT
  TIME_FORMAT
  TIME_MAPPING
  FORMAT_MAPPING
  PSEUDOCOLUMNS
  PREFER_CTE_ALIAS_COLUMN
  EXPAND_ALIAS_REFS_EARLY_ONLY_IN_GROUP_BY
  SUPPORTS_ORDER_BY_ALL
  HAS_DISTINCT_ARRAY_CONSTRUCTORS
  SUPPORTS_FIXED_SIZE_ARRAYS
  STRICT_JSON_PATH_SYNTAX
  ON_CONDITION_EMPTY_BEFORE_ERROR
  ARRAY_AGG_INCLUDES_NULLS
  PROMOTE_TO_INFERRED_DATETIME_TYPE
  SUPPORTS_VALUES_DEFAULT
  REGEXP_EXTRACT_DEFAULT_GROUP
  DATE_PART_MAPPING
  TYPE_TO_EXPRESSIONS
  ANNOTATORS
  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

    190    class Tokenizer(tokens.Tokenizer):
    191        COMMENTS = ["--", "#", "#!", ("/*", "*/")]
    192        IDENTIFIERS = ['"', "`"]
    193        IDENTIFIER_ESCAPES = ["\\"]
    194        STRING_ESCAPES = ["'", "\\"]
    195        BIT_STRINGS = [("0b", "")]
    196        HEX_STRINGS = [("0x", ""), ("0X", "")]
    197        HEREDOC_STRINGS = ["$"]
    198
    199        KEYWORDS = {
    200            **tokens.Tokenizer.KEYWORDS,
    201            "ATTACH": TokenType.COMMAND,
    202            "DATE32": TokenType.DATE32,
    203            "DATETIME64": TokenType.DATETIME64,
    204            "DICTIONARY": TokenType.DICTIONARY,
    205            "DYNAMIC": TokenType.DYNAMIC,
    206            "ENUM8": TokenType.ENUM8,
    207            "ENUM16": TokenType.ENUM16,
    208            "FINAL": TokenType.FINAL,
    209            "FIXEDSTRING": TokenType.FIXEDSTRING,
    210            "FLOAT32": TokenType.FLOAT,
    211            "FLOAT64": TokenType.DOUBLE,
    212            "GLOBAL": TokenType.GLOBAL,
    213            "INT256": TokenType.INT256,
    214            "LOWCARDINALITY": TokenType.LOWCARDINALITY,
    215            "MAP": TokenType.MAP,
    216            "NESTED": TokenType.NESTED,
    217            "SAMPLE": TokenType.TABLE_SAMPLE,
    218            "TUPLE": TokenType.STRUCT,
    219            "UINT128": TokenType.UINT128,
    220            "UINT16": TokenType.USMALLINT,
    221            "UINT256": TokenType.UINT256,
    222            "UINT32": TokenType.UINT,
    223            "UINT64": TokenType.UBIGINT,
    224            "UINT8": TokenType.UTINYINT,
    225            "IPV4": TokenType.IPV4,
    226            "IPV6": TokenType.IPV6,
    227            "POINT": TokenType.POINT,
    228            "RING": TokenType.RING,
    229            "LINESTRING": TokenType.LINESTRING,
    230            "MULTILINESTRING": TokenType.MULTILINESTRING,
    231            "POLYGON": TokenType.POLYGON,
    232            "MULTIPOLYGON": TokenType.MULTIPOLYGON,
    233            "AGGREGATEFUNCTION": TokenType.AGGREGATEFUNCTION,
    234            "SIMPLEAGGREGATEFUNCTION": TokenType.SIMPLEAGGREGATEFUNCTION,
    235            "SYSTEM": TokenType.COMMAND,
    236            "PREWHERE": TokenType.PREWHERE,
    237        }
    238        KEYWORDS.pop("/*+")
    239
    240        SINGLE_TOKENS = {
    241            **tokens.Tokenizer.SINGLE_TOKENS,
    242            "$": TokenType.HEREDOC_STRING,
    243        }

COMMENTS = ['--', '#', '#!', ('/*', '*/')]
IDENTIFIERS = ['"', '`']
IDENTIFIER_ESCAPES = ['\\']
STRING_ESCAPES = ["'", '\\']
BIT_STRINGS = [('0b', '')]
HEX_STRINGS = [('0x', ''), ('0X', '')]
HEREDOC_STRINGS = ['$']
KEYWORDS = {'{%': <TokenType.BLOCK_START: 'BLOCK_START'>, '{%+': <TokenType.BLOCK_START: 'BLOCK_START'>, '{%-': <TokenType.BLOCK_START: 'BLOCK_START'>, '%}': <TokenType.BLOCK_END: 'BLOCK_END'>, '+%}': <TokenType.BLOCK_END: 'BLOCK_END'>, '-%}': <TokenType.BLOCK_END: 'BLOCK_END'>, '{{+': <TokenType.BLOCK_START: 'BLOCK_START'>, '{{-': <TokenType.BLOCK_START: 'BLOCK_START'>, '+}}': <TokenType.BLOCK_END: 'BLOCK_END'>, '-}}': <TokenType.BLOCK_END: 'BLOCK_END'>, '==': <TokenType.EQ: 'EQ'>, '::': <TokenType.DCOLON: 'DCOLON'>, '||': <TokenType.DPIPE: 'DPIPE'>, '>=': <TokenType.GTE: 'GTE'>, '<=': <TokenType.LTE: 'LTE'>, '<>': <TokenType.NEQ: 'NEQ'>, '!=': <TokenType.NEQ: 'NEQ'>, ':=': <TokenType.COLON_EQ: 'COLON_EQ'>, '<=>': <TokenType.NULLSAFE_EQ: 'NULLSAFE_EQ'>, '->': <TokenType.ARROW: 'ARROW'>, '->>': <TokenType.DARROW: 'DARROW'>, '=>': <TokenType.FARROW: 'FARROW'>, '#>': <TokenType.HASH_ARROW: 'HASH_ARROW'>, '#>>': <TokenType.DHASH_ARROW: 'DHASH_ARROW'>, '<->': <TokenType.LR_ARROW: 'LR_ARROW'>, '&&': <TokenType.DAMP: 'DAMP'>, '??': <TokenType.DQMARK: 'DQMARK'>, '~~~': <TokenType.GLOB: 'GLOB'>, '~~': <TokenType.LIKE: 'LIKE'>, '~~*': <TokenType.ILIKE: 'ILIKE'>, '~*': <TokenType.IRLIKE: 'IRLIKE'>, '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'>, 'NAMESPACE': <TokenType.NAMESPACE: 'NAMESPACE'>, 'NATURAL': <TokenType.NATURAL: 'NATURAL'>, 'NEXT': <TokenType.NEXT: 'NEXT'>, 'NOT': <TokenType.NOT: 'NOT'>, 'NOTNULL': <TokenType.NOTNULL: 'NOTNULL'>, 'NULL': <TokenType.NULL: 'NULL'>, 'OBJECT': <TokenType.OBJECT: 'OBJECT'>, 'OFFSET': <TokenType.OFFSET: 'OFFSET'>, 'ON': <TokenType.ON: 'ON'>, 'OR': <TokenType.OR: 'OR'>, 'XOR': <TokenType.XOR: 'XOR'>, 'ORDER BY': <TokenType.ORDER_BY: 'ORDER_BY'>, 'ORDINALITY': <TokenType.ORDINALITY: 'ORDINALITY'>, 'OUTER': <TokenType.OUTER: 'OUTER'>, 'OVER': <TokenType.OVER: 'OVER'>, 'OVERLAPS': <TokenType.OVERLAPS: 'OVERLAPS'>, 'OVERWRITE': <TokenType.OVERWRITE: 'OVERWRITE'>, 'PARTITION': <TokenType.PARTITION: 'PARTITION'>, 'PARTITION BY': <TokenType.PARTITION_BY: 'PARTITION_BY'>, 'PARTITIONED BY': <TokenType.PARTITION_BY: 'PARTITION_BY'>, 'PARTITIONED_BY': <TokenType.PARTITION_BY: 'PARTITION_BY'>, 'PERCENT': <TokenType.PERCENT: 'PERCENT'>, 'PIVOT': <TokenType.PIVOT: 'PIVOT'>, 'PRAGMA': <TokenType.PRAGMA: 'PRAGMA'>, 'PRIMARY KEY': <TokenType.PRIMARY_KEY: 'PRIMARY_KEY'>, 'PROCEDURE': <TokenType.PROCEDURE: 'PROCEDURE'>, 'QUALIFY': <TokenType.QUALIFY: 'QUALIFY'>, 'RANGE': <TokenType.RANGE: 'RANGE'>, 'RECURSIVE': <TokenType.RECURSIVE: 'RECURSIVE'>, 'REGEXP': <TokenType.RLIKE: 'RLIKE'>, 'RENAME': <TokenType.RENAME: 'RENAME'>, 'REPLACE': <TokenType.REPLACE: 'REPLACE'>, 'RETURNING': <TokenType.RETURNING: 'RETURNING'>, 'REFERENCES': <TokenType.REFERENCES: 'REFERENCES'>, 'RIGHT': <TokenType.RIGHT: 'RIGHT'>, 'RLIKE': <TokenType.RLIKE: 'RLIKE'>, 'ROLLBACK': <TokenType.ROLLBACK: 'ROLLBACK'>, 'ROLLUP': <TokenType.ROLLUP: 'ROLLUP'>, 'ROW': <TokenType.ROW: 'ROW'>, 'ROWS': <TokenType.ROWS: 'ROWS'>, 'SCHEMA': <TokenType.SCHEMA: 'SCHEMA'>, 'SELECT': <TokenType.SELECT: 'SELECT'>, 'SEMI': <TokenType.SEMI: 'SEMI'>, 'SET': <TokenType.SET: 'SET'>, 'SETTINGS': <TokenType.SETTINGS: 'SETTINGS'>, 'SHOW': <TokenType.SHOW: 'SHOW'>, 'SIMILAR TO': <TokenType.SIMILAR_TO: 'SIMILAR_TO'>, 'SOME': <TokenType.SOME: 'SOME'>, 'SORT BY': <TokenType.SORT_BY: 'SORT_BY'>, 'START WITH': <TokenType.START_WITH: 'START_WITH'>, 'STRAIGHT_JOIN': <TokenType.STRAIGHT_JOIN: 'STRAIGHT_JOIN'>, 'TABLE': <TokenType.TABLE: 'TABLE'>, 'TABLESAMPLE': <TokenType.TABLE_SAMPLE: 'TABLE_SAMPLE'>, 'TEMP': <TokenType.TEMPORARY: 'TEMPORARY'>, 'TEMPORARY': <TokenType.TEMPORARY: 'TEMPORARY'>, 'THEN': <TokenType.THEN: 'THEN'>, 'TRUE': <TokenType.TRUE: 'TRUE'>, 'TRUNCATE': <TokenType.TRUNCATE: 'TRUNCATE'>, 'UNION': <TokenType.UNION: 'UNION'>, 'UNKNOWN': <TokenType.UNKNOWN: 'UNKNOWN'>, 'UNNEST': <TokenType.UNNEST: 'UNNEST'>, 'UNPIVOT': <TokenType.UNPIVOT: 'UNPIVOT'>, 'UPDATE': <TokenType.UPDATE: 'UPDATE'>, 'USE': <TokenType.USE: 'USE'>, 'USING': <TokenType.USING: 'USING'>, 'UUID': <TokenType.UUID: 'UUID'>, 'VALUES': <TokenType.VALUES: 'VALUES'>, 'VIEW': <TokenType.VIEW: 'VIEW'>, 'VOLATILE': <TokenType.VOLATILE: 'VOLATILE'>, 'WHEN': <TokenType.WHEN: 'WHEN'>, 'WHERE': <TokenType.WHERE: 'WHERE'>, 'WINDOW': <TokenType.WINDOW: 'WINDOW'>, 'WITH': <TokenType.WITH: 'WITH'>, 'APPLY': <TokenType.APPLY: 'APPLY'>, 'ARRAY': <TokenType.ARRAY: 'ARRAY'>, 'BIT': <TokenType.BIT: 'BIT'>, 'BOOL': <TokenType.BOOLEAN: 'BOOLEAN'>, 'BOOLEAN': <TokenType.BOOLEAN: 'BOOLEAN'>, 'BYTE': <TokenType.TINYINT: 'TINYINT'>, 'MEDIUMINT': <TokenType.MEDIUMINT: 'MEDIUMINT'>, 'INT1': <TokenType.TINYINT: 'TINYINT'>, 'TINYINT': <TokenType.TINYINT: 'TINYINT'>, 'INT16': <TokenType.SMALLINT: 'SMALLINT'>, 'SHORT': <TokenType.SMALLINT: 'SMALLINT'>, 'SMALLINT': <TokenType.SMALLINT: 'SMALLINT'>, 'INT128': <TokenType.INT128: 'INT128'>, 'HUGEINT': <TokenType.INT128: 'INT128'>, 'UHUGEINT': <TokenType.UINT128: 'UINT128'>, 'INT2': <TokenType.SMALLINT: 'SMALLINT'>, 'INTEGER': <TokenType.INT: 'INT'>, 'INT': <TokenType.INT: 'INT'>, 'INT4': <TokenType.INT: 'INT'>, 'INT32': <TokenType.INT: 'INT'>, 'INT64': <TokenType.BIGINT: 'BIGINT'>, 'LONG': <TokenType.BIGINT: 'BIGINT'>, 'BIGINT': <TokenType.BIGINT: 'BIGINT'>, 'INT8': <TokenType.TINYINT: 'TINYINT'>, 'UINT': <TokenType.UINT: 'UINT'>, 'DEC': <TokenType.DECIMAL: 'DECIMAL'>, 'DECIMAL': <TokenType.DECIMAL: 'DECIMAL'>, 'DECIMAL32': <TokenType.DECIMAL32: 'DECIMAL32'>, 'DECIMAL64': <TokenType.DECIMAL64: 'DECIMAL64'>, 'DECIMAL128': <TokenType.DECIMAL128: 'DECIMAL128'>, 'DECIMAL256': <TokenType.DECIMAL256: 'DECIMAL256'>, 'BIGDECIMAL': <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, 'BIGNUMERIC': <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, 'LIST': <TokenType.LIST: 'LIST'>, 'MAP': <TokenType.MAP: 'MAP'>, 'NULLABLE': <TokenType.NULLABLE: 'NULLABLE'>, 'NUMBER': <TokenType.DECIMAL: 'DECIMAL'>, 'NUMERIC': <TokenType.DECIMAL: 'DECIMAL'>, 'FIXED': <TokenType.DECIMAL: 'DECIMAL'>, 'REAL': <TokenType.FLOAT: 'FLOAT'>, 'FLOAT': <TokenType.FLOAT: 'FLOAT'>, 'FLOAT4': <TokenType.FLOAT: 'FLOAT'>, 'FLOAT8': <TokenType.DOUBLE: 'DOUBLE'>, 'DOUBLE': <TokenType.DOUBLE: 'DOUBLE'>, 'DOUBLE PRECISION': <TokenType.DOUBLE: 'DOUBLE'>, 'JSON': <TokenType.JSON: 'JSON'>, 'JSONB': <TokenType.JSONB: 'JSONB'>, 'CHAR': <TokenType.CHAR: 'CHAR'>, 'CHARACTER': <TokenType.CHAR: 'CHAR'>, 'NCHAR': <TokenType.NCHAR: 'NCHAR'>, 'VARCHAR': <TokenType.VARCHAR: 'VARCHAR'>, 'VARCHAR2': <TokenType.VARCHAR: 'VARCHAR'>, 'NVARCHAR': <TokenType.NVARCHAR: 'NVARCHAR'>, 'NVARCHAR2': <TokenType.NVARCHAR: 'NVARCHAR'>, 'BPCHAR': <TokenType.BPCHAR: 'BPCHAR'>, 'STR': <TokenType.TEXT: 'TEXT'>, 'STRING': <TokenType.TEXT: 'TEXT'>, 'TEXT': <TokenType.TEXT: 'TEXT'>, 'LONGTEXT': <TokenType.LONGTEXT: 'LONGTEXT'>, 'MEDIUMTEXT': <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, 'TINYTEXT': <TokenType.TINYTEXT: 'TINYTEXT'>, 'CLOB': <TokenType.TEXT: 'TEXT'>, 'LONGVARCHAR': <TokenType.TEXT: 'TEXT'>, 'BINARY': <TokenType.BINARY: 'BINARY'>, 'BLOB': <TokenType.VARBINARY: 'VARBINARY'>, 'LONGBLOB': <TokenType.LONGBLOB: 'LONGBLOB'>, 'MEDIUMBLOB': <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, 'TINYBLOB': <TokenType.TINYBLOB: 'TINYBLOB'>, 'BYTEA': <TokenType.VARBINARY: 'VARBINARY'>, 'VARBINARY': <TokenType.VARBINARY: 'VARBINARY'>, 'TIME': <TokenType.TIME: 'TIME'>, 'TIMETZ': <TokenType.TIMETZ: 'TIMETZ'>, 'TIMESTAMP': <TokenType.TIMESTAMP: 'TIMESTAMP'>, 'TIMESTAMPTZ': <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, 'TIMESTAMPLTZ': <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, 'TIMESTAMP_LTZ': <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, 'TIMESTAMPNTZ': <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, 'TIMESTAMP_NTZ': <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, 'DATE': <TokenType.DATE: 'DATE'>, 'DATETIME': <TokenType.DATETIME: 'DATETIME'>, 'INT4RANGE': <TokenType.INT4RANGE: 'INT4RANGE'>, 'INT4MULTIRANGE': <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, 'INT8RANGE': <TokenType.INT8RANGE: 'INT8RANGE'>, 'INT8MULTIRANGE': <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, 'NUMRANGE': <TokenType.NUMRANGE: 'NUMRANGE'>, 'NUMMULTIRANGE': <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, 'TSRANGE': <TokenType.TSRANGE: 'TSRANGE'>, 'TSMULTIRANGE': <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, 'TSTZRANGE': <TokenType.TSTZRANGE: 'TSTZRANGE'>, 'TSTZMULTIRANGE': <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, 'DATERANGE': <TokenType.DATERANGE: 'DATERANGE'>, 'DATEMULTIRANGE': <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, 'UNIQUE': <TokenType.UNIQUE: 'UNIQUE'>, 'VECTOR': <TokenType.VECTOR: 'VECTOR'>, 'STRUCT': <TokenType.STRUCT: 'STRUCT'>, 'SEQUENCE': <TokenType.SEQUENCE: 'SEQUENCE'>, 'VARIANT': <TokenType.VARIANT: 'VARIANT'>, 'ALTER': <TokenType.ALTER: 'ALTER'>, 'ANALYZE': <TokenType.ANALYZE: 'ANALYZE'>, 'CALL': <TokenType.COMMAND: 'COMMAND'>, 'COMMENT': <TokenType.COMMENT: 'COMMENT'>, 'EXPLAIN': <TokenType.COMMAND: 'COMMAND'>, 'GRANT': <TokenType.GRANT: 'GRANT'>, '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'>, 'DYNAMIC': <TokenType.DYNAMIC: 'DYNAMIC'>, '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'>, 'POINT': <TokenType.POINT: 'POINT'>, 'RING': <TokenType.RING: 'RING'>, 'LINESTRING': <TokenType.LINESTRING: 'LINESTRING'>, 'MULTILINESTRING': <TokenType.MULTILINESTRING: 'MULTILINESTRING'>, 'POLYGON': <TokenType.POLYGON: 'POLYGON'>, 'MULTIPOLYGON': <TokenType.MULTIPOLYGON: 'MULTIPOLYGON'>, '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
  QUOTES
  VAR_SINGLE_TOKENS
  HEREDOC_TAG_IS_IDENTIFIER
  HEREDOC_STRING_ALTERNATIVE
  STRING_ESCAPES_ALLOWED_IN_RAW_STRINGS
  NESTED_COMMENTS
  HINT_START
  TOKENS_PRECEDING_HINT
  WHITE_SPACE
  COMMANDS
  COMMAND_PREFIX_TOKENS
  NUMERIC_LITERALS
  dialect
  use_rs_tokenizer
  reset
  tokenize
  tokenize_rs
  size
  sql
  tokens

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

    245    class Parser(parser.Parser):
    246        # Tested in ClickHouse's playground, it seems that the following two queries do the same thing
    247        # * select x from t1 union all select x from t2 limit 1;
    248        # * select x from t1 union all (select x from t2 limit 1);
    249        MODIFIERS_ATTACHED_TO_SET_OP = False
    250        INTERVAL_SPANS = False
    251        OPTIONAL_ALIAS_TOKEN_CTE = False
    252
    253        FUNCTIONS = {
    254            **parser.Parser.FUNCTIONS,
    255            "ANY": exp.AnyValue.from_arg_list,
    256            "ARRAYSUM": exp.ArraySum.from_arg_list,
    257            "COUNTIF": _build_count_if,
    258            "DATE_ADD": build_date_delta(exp.DateAdd, default_unit=None),
    259            "DATEADD": build_date_delta(exp.DateAdd, default_unit=None),
    260            "DATE_DIFF": build_date_delta(exp.DateDiff, default_unit=None),
    261            "DATEDIFF": build_date_delta(exp.DateDiff, default_unit=None),
    262            "DATE_FORMAT": _build_date_format,
    263            "DATE_SUB": build_date_delta(exp.DateSub, default_unit=None),
    264            "DATESUB": build_date_delta(exp.DateSub, default_unit=None),
    265            "FORMATDATETIME": _build_date_format,
    266            "JSONEXTRACTSTRING": build_json_extract_path(
    267                exp.JSONExtractScalar, zero_based_indexing=False
    268            ),
    269            "LENGTH": lambda args: exp.Length(this=seq_get(args, 0), binary=True),
    270            "MAP": parser.build_var_map,
    271            "MATCH": exp.RegexpLike.from_arg_list,
    272            "RANDCANONICAL": exp.Rand.from_arg_list,
    273            "STR_TO_DATE": _build_str_to_date,
    274            "TUPLE": exp.Struct.from_arg_list,
    275            "TIMESTAMP_SUB": build_date_delta(exp.TimestampSub, default_unit=None),
    276            "TIMESTAMPSUB": build_date_delta(exp.TimestampSub, default_unit=None),
    277            "TIMESTAMP_ADD": build_date_delta(exp.TimestampAdd, default_unit=None),
    278            "TIMESTAMPADD": build_date_delta(exp.TimestampAdd, default_unit=None),
    279            "UNIQ": exp.ApproxDistinct.from_arg_list,
    280            "XOR": lambda args: exp.Xor(expressions=args),
    281            "MD5": exp.MD5Digest.from_arg_list,
    282            "SHA256": lambda args: exp.SHA2(this=seq_get(args, 0), length=exp.Literal.number(256)),
    283            "SHA512": lambda args: exp.SHA2(this=seq_get(args, 0), length=exp.Literal.number(512)),
    284            "EDITDISTANCE": exp.Levenshtein.from_arg_list,
    285            "LEVENSHTEINDISTANCE": exp.Levenshtein.from_arg_list,
    286        }
    287        FUNCTIONS.pop("TRANSFORM")
    288
    289        AGG_FUNCTIONS = {
    290            "count",
    291            "min",
    292            "max",
    293            "sum",
    294            "avg",
    295            "any",
    296            "stddevPop",
    297            "stddevSamp",
    298            "varPop",
    299            "varSamp",
    300            "corr",
    301            "covarPop",
    302            "covarSamp",
    303            "entropy",
    304            "exponentialMovingAverage",
    305            "intervalLengthSum",
    306            "kolmogorovSmirnovTest",
    307            "mannWhitneyUTest",
    308            "median",
    309            "rankCorr",
    310            "sumKahan",
    311            "studentTTest",
    312            "welchTTest",
    313            "anyHeavy",
    314            "anyLast",
    315            "boundingRatio",
    316            "first_value",
    317            "last_value",
    318            "argMin",
    319            "argMax",
    320            "avgWeighted",
    321            "topK",
    322            "topKWeighted",
    323            "deltaSum",
    324            "deltaSumTimestamp",
    325            "groupArray",
    326            "groupArrayLast",
    327            "groupUniqArray",
    328            "groupArrayInsertAt",
    329            "groupArrayMovingAvg",
    330            "groupArrayMovingSum",
    331            "groupArraySample",
    332            "groupBitAnd",
    333            "groupBitOr",
    334            "groupBitXor",
    335            "groupBitmap",
    336            "groupBitmapAnd",
    337            "groupBitmapOr",
    338            "groupBitmapXor",
    339            "sumWithOverflow",
    340            "sumMap",
    341            "minMap",
    342            "maxMap",
    343            "skewSamp",
    344            "skewPop",
    345            "kurtSamp",
    346            "kurtPop",
    347            "uniq",
    348            "uniqExact",
    349            "uniqCombined",
    350            "uniqCombined64",
    351            "uniqHLL12",
    352            "uniqTheta",
    353            "quantile",
    354            "quantiles",
    355            "quantileExact",
    356            "quantilesExact",
    357            "quantileExactLow",
    358            "quantilesExactLow",
    359            "quantileExactHigh",
    360            "quantilesExactHigh",
    361            "quantileExactWeighted",
    362            "quantilesExactWeighted",
    363            "quantileTiming",
    364            "quantilesTiming",
    365            "quantileTimingWeighted",
    366            "quantilesTimingWeighted",
    367            "quantileDeterministic",
    368            "quantilesDeterministic",
    369            "quantileTDigest",
    370            "quantilesTDigest",
    371            "quantileTDigestWeighted",
    372            "quantilesTDigestWeighted",
    373            "quantileBFloat16",
    374            "quantilesBFloat16",
    375            "quantileBFloat16Weighted",
    376            "quantilesBFloat16Weighted",
    377            "simpleLinearRegression",
    378            "stochasticLinearRegression",
    379            "stochasticLogisticRegression",
    380            "categoricalInformationValue",
    381            "contingency",
    382            "cramersV",
    383            "cramersVBiasCorrected",
    384            "theilsU",
    385            "maxIntersections",
    386            "maxIntersectionsPosition",
    387            "meanZTest",
    388            "quantileInterpolatedWeighted",
    389            "quantilesInterpolatedWeighted",
    390            "quantileGK",
    391            "quantilesGK",
    392            "sparkBar",
    393            "sumCount",
    394            "largestTriangleThreeBuckets",
    395            "histogram",
    396            "sequenceMatch",
    397            "sequenceCount",
    398            "windowFunnel",
    399            "retention",
    400            "uniqUpTo",
    401            "sequenceNextNode",
    402            "exponentialTimeDecayedAvg",
    403        }
    404
    405        AGG_FUNCTIONS_SUFFIXES = [
    406            "If",
    407            "Array",
    408            "ArrayIf",
    409            "Map",
    410            "SimpleState",
    411            "State",
    412            "Merge",
    413            "MergeState",
    414            "ForEach",
    415            "Distinct",
    416            "OrDefault",
    417            "OrNull",
    418            "Resample",
    419            "ArgMin",
    420            "ArgMax",
    421        ]
    422
    423        FUNC_TOKENS = {
    424            *parser.Parser.FUNC_TOKENS,
    425            TokenType.SET,
    426        }
    427
    428        RESERVED_TOKENS = parser.Parser.RESERVED_TOKENS - {TokenType.SELECT}
    429
    430        ID_VAR_TOKENS = {
    431            *parser.Parser.ID_VAR_TOKENS,
    432            TokenType.LIKE,
    433        }
    434
    435        AGG_FUNC_MAPPING = (
    436            lambda functions, suffixes: {
    437                f"{f}{sfx}": (f, sfx) for sfx in (suffixes + [""]) for f in functions
    438            }
    439        )(AGG_FUNCTIONS, AGG_FUNCTIONS_SUFFIXES)
    440
    441        FUNCTIONS_WITH_ALIASED_ARGS = {*parser.Parser.FUNCTIONS_WITH_ALIASED_ARGS, "TUPLE"}
    442
    443        FUNCTION_PARSERS = {
    444            **parser.Parser.FUNCTION_PARSERS,
    445            "ARRAYJOIN": lambda self: self.expression(exp.Explode, this=self._parse_expression()),
    446            "QUANTILE": lambda self: self._parse_quantile(),
    447            "MEDIAN": lambda self: self._parse_quantile(),
    448            "COLUMNS": lambda self: self._parse_columns(),
    449        }
    450
    451        FUNCTION_PARSERS.pop("MATCH")
    452
    453        PROPERTY_PARSERS = parser.Parser.PROPERTY_PARSERS.copy()
    454        PROPERTY_PARSERS.pop("DYNAMIC")
    455
    456        NO_PAREN_FUNCTION_PARSERS = parser.Parser.NO_PAREN_FUNCTION_PARSERS.copy()
    457        NO_PAREN_FUNCTION_PARSERS.pop("ANY")
    458
    459        NO_PAREN_FUNCTIONS = parser.Parser.NO_PAREN_FUNCTIONS.copy()
    460        NO_PAREN_FUNCTIONS.pop(TokenType.CURRENT_TIMESTAMP)
    461
    462        RANGE_PARSERS = {
    463            **parser.Parser.RANGE_PARSERS,
    464            TokenType.GLOBAL: lambda self, this: self._match(TokenType.IN)
    465            and self._parse_in(this, is_global=True),
    466        }
    467
    468        # The PLACEHOLDER entry is popped because 1) it doesn't affect Clickhouse (it corresponds to
    469        # the postgres-specific JSONBContains parser) and 2) it makes parsing the ternary op simpler.
    470        COLUMN_OPERATORS = parser.Parser.COLUMN_OPERATORS.copy()
    471        COLUMN_OPERATORS.pop(TokenType.PLACEHOLDER)
    472
    473        JOIN_KINDS = {
    474            *parser.Parser.JOIN_KINDS,
    475            TokenType.ANY,
    476            TokenType.ASOF,
    477            TokenType.ARRAY,
    478        }
    479
    480        TABLE_ALIAS_TOKENS = parser.Parser.TABLE_ALIAS_TOKENS - {
    481            TokenType.ANY,
    482            TokenType.ARRAY,
    483            TokenType.FINAL,
    484            TokenType.FORMAT,
    485            TokenType.SETTINGS,
    486        }
    487
    488        ALIAS_TOKENS = parser.Parser.ALIAS_TOKENS - {
    489            TokenType.FORMAT,
    490        }
    491
    492        LOG_DEFAULTS_TO_LN = True
    493
    494        QUERY_MODIFIER_PARSERS = {
    495            **parser.Parser.QUERY_MODIFIER_PARSERS,
    496            TokenType.SETTINGS: lambda self: (
    497                "settings",
    498                self._advance() or self._parse_csv(self._parse_assignment),
    499            ),
    500            TokenType.FORMAT: lambda self: ("format", self._advance() or self._parse_id_var()),
    501        }
    502
    503        CONSTRAINT_PARSERS = {
    504            **parser.Parser.CONSTRAINT_PARSERS,
    505            "INDEX": lambda self: self._parse_index_constraint(),
    506            "CODEC": lambda self: self._parse_compress(),
    507        }
    508
    509        ALTER_PARSERS = {
    510            **parser.Parser.ALTER_PARSERS,
    511            "REPLACE": lambda self: self._parse_alter_table_replace(),
    512        }
    513
    514        SCHEMA_UNNAMED_CONSTRAINTS = {
    515            *parser.Parser.SCHEMA_UNNAMED_CONSTRAINTS,
    516            "INDEX",
    517        }
    518
    519        PLACEHOLDER_PARSERS = {
    520            **parser.Parser.PLACEHOLDER_PARSERS,
    521            TokenType.L_BRACE: lambda self: self._parse_query_parameter(),
    522        }
    523
    524        # https://clickhouse.com/docs/en/sql-reference/statements/create/function
    525        def _parse_user_defined_function_expression(self) -> t.Optional[exp.Expression]:
    526            return self._parse_lambda()
    527
    528        def _parse_types(
    529            self, check_func: bool = False, schema: bool = False, allow_identifiers: bool = True
    530        ) -> t.Optional[exp.Expression]:
    531            dtype = super()._parse_types(
    532                check_func=check_func, schema=schema, allow_identifiers=allow_identifiers
    533            )
    534            if isinstance(dtype, exp.DataType) and dtype.args.get("nullable") is not True:
    535                # Mark every type as non-nullable which is ClickHouse's default, unless it's
    536                # already marked as nullable. This marker helps us transpile types from other
    537                # dialects to ClickHouse, so that we can e.g. produce `CAST(x AS Nullable(String))`
    538                # from `CAST(x AS TEXT)`. If there is a `NULL` value in `x`, the former would
    539                # fail in ClickHouse without the `Nullable` type constructor.
    540                dtype.set("nullable", False)
    541
    542            return dtype
    543
    544        def _parse_extract(self) -> exp.Extract | exp.Anonymous:
    545            index = self._index
    546            this = self._parse_bitwise()
    547            if self._match(TokenType.FROM):
    548                self._retreat(index)
    549                return super()._parse_extract()
    550
    551            # We return Anonymous here because extract and regexpExtract have different semantics,
    552            # so parsing extract(foo, bar) into RegexpExtract can potentially break queries. E.g.,
    553            # `extract('foobar', 'b')` works, but ClickHouse crashes for `regexpExtract('foobar', 'b')`.
    554            #
    555            # TODO: can we somehow convert the former into an equivalent `regexpExtract` call?
    556            self._match(TokenType.COMMA)
    557            return self.expression(
    558                exp.Anonymous, this="extract", expressions=[this, self._parse_bitwise()]
    559            )
    560
    561        def _parse_assignment(self) -> t.Optional[exp.Expression]:
    562            this = super()._parse_assignment()
    563
    564            if self._match(TokenType.PLACEHOLDER):
    565                return self.expression(
    566                    exp.If,
    567                    this=this,
    568                    true=self._parse_assignment(),
    569                    false=self._match(TokenType.COLON) and self._parse_assignment(),
    570                )
    571
    572            return this
    573
    574        def _parse_query_parameter(self) -> t.Optional[exp.Expression]:
    575            """
    576            Parse a placeholder expression like SELECT {abc: UInt32} or FROM {table: Identifier}
    577            https://clickhouse.com/docs/en/sql-reference/syntax#defining-and-using-query-parameters
    578            """
    579            index = self._index
    580
    581            this = self._parse_id_var()
    582            self._match(TokenType.COLON)
    583            kind = self._parse_types(check_func=False, allow_identifiers=False) or (
    584                self._match_text_seq("IDENTIFIER") and "Identifier"
    585            )
    586
    587            if not kind:
    588                self._retreat(index)
    589                return None
    590            elif not self._match(TokenType.R_BRACE):
    591                self.raise_error("Expecting }")
    592
    593            return self.expression(exp.Placeholder, this=this, kind=kind)
    594
    595        def _parse_bracket(
    596            self, this: t.Optional[exp.Expression] = None
    597        ) -> t.Optional[exp.Expression]:
    598            l_brace = self._match(TokenType.L_BRACE, advance=False)
    599            bracket = super()._parse_bracket(this)
    600
    601            if l_brace and isinstance(bracket, exp.Struct):
    602                varmap = exp.VarMap(keys=exp.Array(), values=exp.Array())
    603                for expression in bracket.expressions:
    604                    if not isinstance(expression, exp.PropertyEQ):
    605                        break
    606
    607                    varmap.args["keys"].append("expressions", exp.Literal.string(expression.name))
    608                    varmap.args["values"].append("expressions", expression.expression)
    609
    610                return varmap
    611
    612            return bracket
    613
    614        def _parse_in(self, this: t.Optional[exp.Expression], is_global: bool = False) -> exp.In:
    615            this = super()._parse_in(this)
    616            this.set("is_global", is_global)
    617            return this
    618
    619        def _parse_table(
    620            self,
    621            schema: bool = False,
    622            joins: bool = False,
    623            alias_tokens: t.Optional[t.Collection[TokenType]] = None,
    624            parse_bracket: bool = False,
    625            is_db_reference: bool = False,
    626            parse_partition: bool = False,
    627        ) -> t.Optional[exp.Expression]:
    628            this = super()._parse_table(
    629                schema=schema,
    630                joins=joins,
    631                alias_tokens=alias_tokens,
    632                parse_bracket=parse_bracket,
    633                is_db_reference=is_db_reference,
    634            )
    635
    636            if self._match(TokenType.FINAL):
    637                this = self.expression(exp.Final, this=this)
    638
    639            return this
    640
    641        def _parse_position(self, haystack_first: bool = False) -> exp.StrPosition:
    642            return super()._parse_position(haystack_first=True)
    643
    644        # https://clickhouse.com/docs/en/sql-reference/statements/select/with/
    645        def _parse_cte(self) -> t.Optional[exp.CTE]:
    646            # WITH <identifier> AS <subquery expression>
    647            cte: t.Optional[exp.CTE] = self._try_parse(super()._parse_cte)
    648
    649            if not cte:
    650                # WITH <expression> AS <identifier>
    651                cte = self.expression(
    652                    exp.CTE,
    653                    this=self._parse_assignment(),
    654                    alias=self._parse_table_alias(),
    655                    scalar=True,
    656                )
    657
    658            return cte
    659
    660        def _parse_join_parts(
    661            self,
    662        ) -> t.Tuple[t.Optional[Token], t.Optional[Token], t.Optional[Token]]:
    663            is_global = self._match(TokenType.GLOBAL) and self._prev
    664            kind_pre = self._match_set(self.JOIN_KINDS, advance=False) and self._prev
    665
    666            if kind_pre:
    667                kind = self._match_set(self.JOIN_KINDS) and self._prev
    668                side = self._match_set(self.JOIN_SIDES) and self._prev
    669                return is_global, side, kind
    670
    671            return (
    672                is_global,
    673                self._match_set(self.JOIN_SIDES) and self._prev,
    674                self._match_set(self.JOIN_KINDS) and self._prev,
    675            )
    676
    677        def _parse_join(
    678            self, skip_join_token: bool = False, parse_bracket: bool = False
    679        ) -> t.Optional[exp.Join]:
    680            join = super()._parse_join(skip_join_token=skip_join_token, parse_bracket=True)
    681            if join:
    682                join.set("global", join.args.pop("method", None))
    683
    684                # tbl ARRAY JOIN arr <-- this should be a `Column` reference, not a `Table`
    685                # https://clickhouse.com/docs/en/sql-reference/statements/select/array-join
    686                if join.kind == "ARRAY":
    687                    for table in join.find_all(exp.Table):
    688                        table.replace(table.to_column())
    689
    690            return join
    691
    692        def _parse_function(
    693            self,
    694            functions: t.Optional[t.Dict[str, t.Callable]] = None,
    695            anonymous: bool = False,
    696            optional_parens: bool = True,
    697            any_token: bool = False,
    698        ) -> t.Optional[exp.Expression]:
    699            expr = super()._parse_function(
    700                functions=functions,
    701                anonymous=anonymous,
    702                optional_parens=optional_parens,
    703                any_token=any_token,
    704            )
    705
    706            func = expr.this if isinstance(expr, exp.Window) else expr
    707
    708            # Aggregate functions can be split in 2 parts: <func_name><suffix>
    709            parts = (
    710                self.AGG_FUNC_MAPPING.get(func.this) if isinstance(func, exp.Anonymous) else None
    711            )
    712
    713            if parts:
    714                anon_func: exp.Anonymous = t.cast(exp.Anonymous, func)
    715                params = self._parse_func_params(anon_func)
    716
    717                kwargs = {
    718                    "this": anon_func.this,
    719                    "expressions": anon_func.expressions,
    720                }
    721                if parts[1]:
    722                    kwargs["parts"] = parts
    723                    exp_class: t.Type[exp.Expression] = (
    724                        exp.CombinedParameterizedAgg if params else exp.CombinedAggFunc
    725                    )
    726                else:
    727                    exp_class = exp.ParameterizedAgg if params else exp.AnonymousAggFunc
    728
    729                kwargs["exp_class"] = exp_class
    730                if params:
    731                    kwargs["params"] = params
    732
    733                func = self.expression(**kwargs)
    734
    735                if isinstance(expr, exp.Window):
    736                    # The window's func was parsed as Anonymous in base parser, fix its
    737                    # type to be ClickHouse style CombinedAnonymousAggFunc / AnonymousAggFunc
    738                    expr.set("this", func)
    739                elif params:
    740                    # Params have blocked super()._parse_function() from parsing the following window
    741                    # (if that exists) as they're standing between the function call and the window spec
    742                    expr = self._parse_window(func)
    743                else:
    744                    expr = func
    745
    746            return expr
    747
    748        def _parse_func_params(
    749            self, this: t.Optional[exp.Func] = None
    750        ) -> t.Optional[t.List[exp.Expression]]:
    751            if self._match_pair(TokenType.R_PAREN, TokenType.L_PAREN):
    752                return self._parse_csv(self._parse_lambda)
    753
    754            if self._match(TokenType.L_PAREN):
    755                params = self._parse_csv(self._parse_lambda)
    756                self._match_r_paren(this)
    757                return params
    758
    759            return None
    760
    761        def _parse_quantile(self) -> exp.Quantile:
    762            this = self._parse_lambda()
    763            params = self._parse_func_params()
    764            if params:
    765                return self.expression(exp.Quantile, this=params[0], quantile=this)
    766            return self.expression(exp.Quantile, this=this, quantile=exp.Literal.number(0.5))
    767
    768        def _parse_wrapped_id_vars(self, optional: bool = False) -> t.List[exp.Expression]:
    769            return super()._parse_wrapped_id_vars(optional=True)
    770
    771        def _parse_primary_key(
    772            self, wrapped_optional: bool = False, in_props: bool = False
    773        ) -> exp.PrimaryKeyColumnConstraint | exp.PrimaryKey:
    774            return super()._parse_primary_key(
    775                wrapped_optional=wrapped_optional or in_props, in_props=in_props
    776            )
    777
    778        def _parse_on_property(self) -> t.Optional[exp.Expression]:
    779            index = self._index
    780            if self._match_text_seq("CLUSTER"):
    781                this = self._parse_id_var()
    782                if this:
    783                    return self.expression(exp.OnCluster, this=this)
    784                else:
    785                    self._retreat(index)
    786            return None
    787
    788        def _parse_index_constraint(
    789            self, kind: t.Optional[str] = None
    790        ) -> exp.IndexColumnConstraint:
    791            # INDEX name1 expr TYPE type1(args) GRANULARITY value
    792            this = self._parse_id_var()
    793            expression = self._parse_assignment()
    794
    795            index_type = self._match_text_seq("TYPE") and (
    796                self._parse_function() or self._parse_var()
    797            )
    798
    799            granularity = self._match_text_seq("GRANULARITY") and self._parse_term()
    800
    801            return self.expression(
    802                exp.IndexColumnConstraint,
    803                this=this,
    804                expression=expression,
    805                index_type=index_type,
    806                granularity=granularity,
    807            )
    808
    809        def _parse_partition(self) -> t.Optional[exp.Partition]:
    810            # https://clickhouse.com/docs/en/sql-reference/statements/alter/partition#how-to-set-partition-expression
    811            if not self._match(TokenType.PARTITION):
    812                return None
    813
    814            if self._match_text_seq("ID"):
    815                # Corresponds to the PARTITION ID <string_value> syntax
    816                expressions: t.List[exp.Expression] = [
    817                    self.expression(exp.PartitionId, this=self._parse_string())
    818                ]
    819            else:
    820                expressions = self._parse_expressions()
    821
    822            return self.expression(exp.Partition, expressions=expressions)
    823
    824        def _parse_alter_table_replace(self) -> t.Optional[exp.Expression]:
    825            partition = self._parse_partition()
    826
    827            if not partition or not self._match(TokenType.FROM):
    828                return None
    829
    830            return self.expression(
    831                exp.ReplacePartition, expression=partition, source=self._parse_table_parts()
    832            )
    833
    834        def _parse_projection_def(self) -> t.Optional[exp.ProjectionDef]:
    835            if not self._match_text_seq("PROJECTION"):
    836                return None
    837
    838            return self.expression(
    839                exp.ProjectionDef,
    840                this=self._parse_id_var(),
    841                expression=self._parse_wrapped(self._parse_statement),
    842            )
    843
    844        def _parse_constraint(self) -> t.Optional[exp.Expression]:
    845            return super()._parse_constraint() or self._parse_projection_def()
    846
    847        def _parse_alias(
    848            self, this: t.Optional[exp.Expression], explicit: bool = False
    849        ) -> t.Optional[exp.Expression]:
    850            # In clickhouse "SELECT <expr> APPLY(...)" is a query modifier,
    851            # so "APPLY" shouldn't be parsed as <expr>'s alias. However, "SELECT <expr> apply" is a valid alias
    852            if self._match_pair(TokenType.APPLY, TokenType.L_PAREN, advance=False):
    853                return this
    854
    855            return super()._parse_alias(this=this, explicit=explicit)
    856
    857        def _parse_expression(self) -> t.Optional[exp.Expression]:
    858            this = super()._parse_expression()
    859
    860            # Clickhouse allows "SELECT <expr> [APPLY(func)] [...]]" modifier
    861            while self._match_pair(TokenType.APPLY, TokenType.L_PAREN):
    862                this = exp.Apply(this=this, expression=self._parse_var(any_token=True))
    863                self._match(TokenType.R_PAREN)
    864
    865            return this
    866
    867        def _parse_columns(self) -> exp.Expression:
    868            this: exp.Expression = self.expression(exp.Columns, this=self._parse_lambda())
    869
    870            while self._next and self._match_text_seq(")", "APPLY", "("):
    871                self._match(TokenType.R_PAREN)
    872                this = exp.Apply(this=this, expression=self._parse_var(any_token=True))
    873            return this

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
OPTIONAL_ALIAS_TOKEN_CTE = 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'>>, 'APPLY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Apply'>>, 'APPROX_DISTINCT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxDistinct'>>, 'APPROX_COUNT_DISTINCT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxDistinct'>>, 'APPROX_QUANTILE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxQuantile'>>, 'APPROX_TOP_K': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxTopK'>>, 'ARG_MAX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMax'>>, 'ARGMAX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMax'>>, 'MAX_BY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMax'>>, 'ARG_MIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMin'>>, 'ARGMIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMin'>>, 'MIN_BY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMin'>>, 'ARRAY': <function Parser.<lambda>>, 'ARRAY_AGG': <function Parser.<lambda>>, 'ARRAY_ALL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayAll'>>, 'ARRAY_ANY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayAny'>>, 'ARRAY_CONCAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayConcat'>>, 'ARRAY_CAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayConcat'>>, 'ARRAY_CONSTRUCT_COMPACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayConstructCompact'>>, 'ARRAY_CONTAINS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayContains'>>, 'ARRAY_HAS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayContains'>>, 'ARRAY_CONTAINS_ALL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayContainsAll'>>, 'ARRAY_HAS_ALL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayContainsAll'>>, 'FILTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayFilter'>>, 'ARRAY_FILTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayFilter'>>, 'ARRAY_OVERLAPS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayOverlaps'>>, 'ARRAY_SIZE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySize'>>, 'ARRAY_LENGTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySize'>>, 'ARRAY_SORT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySort'>>, 'ARRAY_SUM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySum'>>, 'ARRAY_TO_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayToString'>>, 'ARRAY_JOIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayToString'>>, 'ARRAY_UNION_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayUnionAgg'>>, 'ARRAY_UNIQUE_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayUniqueAgg'>>, 'AVG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Avg'>>, 'CASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Case'>>, 'CAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Cast'>>, 'CAST_TO_STR_TYPE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CastToStrType'>>, 'CBRT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Cbrt'>>, 'CEIL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Ceil'>>, 'CEILING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Ceil'>>, 'CHR': <function Parser.<lambda>>, 'CHAR': <function Parser.<lambda>>, 'COALESCE': <function build_coalesce>, 'IFNULL': <function build_coalesce>, 'NVL': <function build_coalesce>, 'COLLATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Collate'>>, 'COLUMNS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Columns'>>, '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'>>, 'CONTAINS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Contains'>>, 'CONVERT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Convert'>>, 'CONVERT_TIMEZONE': <function build_convert_timezone>, 'CORR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Corr'>>, 'COUNT': <function Parser.<lambda>>, 'COUNT_IF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CountIf'>>, 'COUNTIF': <function _build_count_if>, 'COVAR_POP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CovarPop'>>, 'COVAR_SAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CovarSamp'>>, 'CURRENT_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentDate'>>, 'CURRENT_DATETIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentDatetime'>>, 'CURRENT_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentTime'>>, 'CURRENT_TIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentTimestamp'>>, 'CURRENT_USER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentUser'>>, 'DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Date'>>, 'DATE_ADD': <function build_date_delta.<locals>._builder>, 'DATEDIFF': <function build_date_delta.<locals>._builder>, 'DATE_DIFF': <function build_date_delta.<locals>._builder>, 'DATE_FROM_PARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateFromParts'>>, 'DATEFROMPARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateFromParts'>>, 'DATE_STR_TO_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateStrToDate'>>, 'DATE_SUB': <function build_date_delta.<locals>._builder>, 'DATE_TO_DATE_STR': <function Parser.<lambda>>, 'DATE_TO_DI': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateToDi'>>, 'DATE_TRUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateTrunc'>>, 'DATETIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Datetime'>>, 'DATETIME_ADD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DatetimeAdd'>>, 'DATETIME_DIFF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DatetimeDiff'>>, 'DATETIME_SUB': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DatetimeSub'>>, 'DATETIME_TRUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DatetimeTrunc'>>, 'DAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Day'>>, 'DAY_OF_MONTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfMonth'>>, 'DAYOFMONTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfMonth'>>, 'DAY_OF_WEEK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfWeek'>>, 'DAYOFWEEK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfWeek'>>, 'DAYOFWEEK_ISO': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfWeekIso'>>, 'ISODOW': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfWeekIso'>>, 'DAY_OF_YEAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfYear'>>, 'DAYOFYEAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfYear'>>, 'DECODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Decode'>>, 'DI_TO_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DiToDate'>>, 'ENCODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Encode'>>, 'EXISTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Exists'>>, 'EXP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Exp'>>, 'EXPLODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Explode'>>, 'EXPLODE_OUTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ExplodeOuter'>>, 'EXPLODING_GENERATE_SERIES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ExplodingGenerateSeries'>>, 'EXTRACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Extract'>>, 'FEATURES_AT_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FeaturesAtTime'>>, 'FIRST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.First'>>, 'FIRST_VALUE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FirstValue'>>, 'FLATTEN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Flatten'>>, 'FLOOR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Floor'>>, 'FROM_BASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FromBase'>>, 'FROM_BASE64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FromBase64'>>, 'FROM_ISO8601_TIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FromISO8601Timestamp'>>, 'GAP_FILL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GapFill'>>, 'GENERATE_DATE_ARRAY': <function Parser.<lambda>>, 'GENERATE_SERIES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GenerateSeries'>>, 'GENERATE_TIMESTAMP_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GenerateTimestampArray'>>, 'GREATEST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Greatest'>>, 'GROUP_CONCAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GroupConcat'>>, 'HEX': <function build_hex>, 'HLL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Hll'>>, 'IF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.If'>>, 'IIF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.If'>>, 'INITCAP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Initcap'>>, 'INLINE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Inline'>>, 'INT64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Int64'>>, 'IS_ASCII': <bound method Func.from_arg_list of <class 'sqlglot.expressions.IsAscii'>>, '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_EXISTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBExists'>>, 'JSONB_EXTRACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBExtract'>>, 'JSONB_EXTRACT_SCALAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBExtractScalar'>>, 'J_S_O_N_EXISTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONExists'>>, 'JSON_EXTRACT': <function build_extract_json_with_path.<locals>._builder>, 'JSON_EXTRACT_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONExtractArray'>>, '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'>>, 'J_S_O_N_VALUE_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONValueArray'>>, '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': <function ClickHouse.Parser.<lambda>>, 'LEN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Length'>>, 'CHAR_LENGTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Length'>>, 'CHARACTER_LENGTH': <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'>>, 'MAKE_INTERVAL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MakeInterval'>>, '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'>>, 'MEDIAN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Median'>>, 'MIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Min'>>, 'MONTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Month'>>, 'MONTHS_BETWEEN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MonthsBetween'>>, 'NEXT_VALUE_FOR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.NextValueFor'>>, 'NORMALIZE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Normalize'>>, 'NTH_VALUE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.NthValue'>>, 'NULLIF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Nullif'>>, 'NUMBER_TO_STR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.NumberToStr'>>, 'NVL2': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Nvl2'>>, 'OBJECT_INSERT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ObjectInsert'>>, 'OPEN_J_S_O_N': <bound method Func.from_arg_list of <class 'sqlglot.expressions.OpenJSON'>>, 'OVERLAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Overlay'>>, 'PAD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Pad'>>, 'PARAMETERIZED_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParameterizedAgg'>>, 'PARSE_JSON': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseJSON'>>, 'JSON_PARSE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseJSON'>>, 'PERCENTILE_CONT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.PercentileCont'>>, 'PERCENTILE_DISC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.PercentileDisc'>>, 'POSEXPLODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Posexplode'>>, 'POSEXPLODE_OUTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.PosexplodeOuter'>>, 'POWER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Pow'>>, 'POW': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Pow'>>, 'PREDICT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Predict'>>, 'QUANTILE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Quantile'>>, 'QUARTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Quarter'>>, 'RAND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Rand'>>, 'RANDOM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Rand'>>, 'RANDN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Randn'>>, 'RANGE_N': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RangeN'>>, 'READ_CSV': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ReadCSV'>>, 'REDUCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Reduce'>>, 'REGEXP_EXTRACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpExtract'>>, 'REGEXP_EXTRACT_ALL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpExtractAll'>>, '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'>>, 'SPLIT_PART': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SplitPart'>>, 'SQRT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sqrt'>>, 'STANDARD_HASH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StandardHash'>>, 'STAR_MAP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StarMap'>>, 'STARTS_WITH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StartsWith'>>, 'STARTSWITH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StartsWith'>>, 'STDDEV': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Stddev'>>, 'STDEV': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Stddev'>>, 'STDDEV_POP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StddevPop'>>, 'STDDEV_SAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StddevSamp'>>, 'STR_POSITION': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrPosition'>>, 'STR_TO_DATE': <function _build_str_to_date>, 'STR_TO_MAP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrToMap'>>, 'STR_TO_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrToTime'>>, 'STR_TO_UNIX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrToUnix'>>, 'STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.String'>>, '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'>>, 'SUBSTR': <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_DOUBLE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToDouble'>>, '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'>>, '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_DATETIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsToDatetime'>>, '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'>>, 'UNICODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Unicode'>>, 'UNIX_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixDate'>>, 'UNIX_SECONDS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixSeconds'>>, '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'>>, 'UUID': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Uuid'>>, 'GEN_RANDOM_UUID': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Uuid'>>, 'GENERATE_UUID': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Uuid'>>, 'UUID_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Uuid'>>, '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'>>, 'XMLELEMENT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.XMLElement'>>, 'X_M_L_TABLE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.XMLTable'>>, 'XOR': <function ClickHouse.Parser.<lambda>>, 'YEAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Year'>>, 'ARRAYAGG': <function Parser.<lambda>>, 'GLOB': <function Parser.<lambda>>, 'JSON_EXTRACT_PATH_TEXT': <function build_extract_json_with_path.<locals>._builder>, 'LIKE': <function build_like>, 'LOG2': <function Parser.<lambda>>, 'LOG10': <function Parser.<lambda>>, 'LPAD': <function Parser.<lambda>>, 'LEFTPAD': <function Parser.<lambda>>, 'LTRIM': <function Parser.<lambda>>, 'MOD': <function build_mod>, 'RIGHTPAD': <function Parser.<lambda>>, 'RPAD': <function Parser.<lambda>>, 'RTRIM': <function Parser.<lambda>>, 'SCOPE_RESOLUTION': <function Parser.<lambda>>, 'STRPOS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrPosition'>>, 'CHARINDEX': <function Parser.<lambda>>, 'INSTR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrPosition'>>, 'LOCATE': <function Parser.<lambda>>, 'TO_HEX': <function build_hex>, 'ANY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.AnyValue'>>, 'ARRAYSUM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySum'>>, 'DATEADD': <function build_date_delta.<locals>._builder>, 'DATE_FORMAT': <function _build_date_format>, 'DATESUB': <function build_date_delta.<locals>._builder>, 'FORMATDATETIME': <function _build_date_format>, 'JSONEXTRACTSTRING': <function build_json_extract_path.<locals>._builder>, 'MATCH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpLike'>>, 'RANDCANONICAL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Rand'>>, 'TUPLE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Struct'>>, 'TIMESTAMPSUB': <function build_date_delta.<locals>._builder>, 'TIMESTAMPADD': <function build_date_delta.<locals>._builder>, 'UNIQ': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxDistinct'>>, 'SHA256': <function ClickHouse.Parser.<lambda>>, 'SHA512': <function ClickHouse.Parser.<lambda>>, 'EDITDISTANCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Levenshtein'>>, 'LEVENSHTEINDISTANCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Levenshtein'>>}
AGG_FUNCTIONS = {'argMax', 'quantileExact', 'quantilesDeterministic', 'first_value', 'stochasticLogisticRegression', 'kurtSamp', 'cramersV', 'quantilesGK', 'uniqCombined', 'maxIntersections', 'quantilesTimingWeighted', 'sum', 'sumCount', 'quantileGK', 'covarPop', 'covarSamp', 'sequenceNextNode', 'uniqCombined64', 'quantileTimingWeighted', 'maxMap', 'entropy', 'quantilesExactLow', 'deltaSum', 'quantileDeterministic', 'groupUniqArray', 'categoricalInformationValue', 'deltaSumTimestamp', 'quantilesExactHigh', 'uniqUpTo', 'theilsU', 'simpleLinearRegression', 'anyLast', 'anyHeavy', 'topKWeighted', 'exponentialTimeDecayedAvg', 'meanZTest', 'largestTriangleThreeBuckets', 'groupArray', 'groupBitmapAnd', 'groupArrayInsertAt', 'varPop', 'exponentialMovingAverage', 'quantilesExactWeighted', 'maxIntersectionsPosition', 'uniq', 'contingency', 'studentTTest', 'quantileTiming', 'quantileBFloat16', 'quantilesInterpolatedWeighted', 'min', 'groupBitmap', 'groupBitXor', 'intervalLengthSum', 'uniqHLL12', 'quantilesBFloat16', 'kurtPop', 'quantilesTDigest', 'sumKahan', 'sumMap', 'median', 'welchTTest', 'sparkBar', 'retention', 'last_value', 'corr', 'skewSamp', 'sumWithOverflow', 'kolmogorovSmirnovTest', 'quantileExactLow', 'count', 'groupBitmapOr', 'minMap', 'rankCorr', 'stddevSamp', 'cramersVBiasCorrected', 'groupBitAnd', 'groupArrayMovingAvg', 'groupBitOr', 'quantileExactHigh', 'sequenceMatch', 'uniqExact', 'groupArrayLast', 'quantileExactWeighted', 'quantileInterpolatedWeighted', 'quantilesTDigestWeighted', 'avgWeighted', 'quantiles', 'quantileTDigest', 'stochasticLinearRegression', 'groupBitmapXor', 'quantilesExact', 'quantilesBFloat16Weighted', 'histogram', 'uniqTheta', 'stddevPop', 'any', 'sequenceCount', 'argMin', 'max', 'windowFunnel', 'varSamp', 'groupArraySample', 'boundingRatio', 'groupArrayMovingSum', 'mannWhitneyUTest', 'quantilesTiming', 'skewPop', 'topK', 'quantileTDigestWeighted', 'quantileBFloat16Weighted', 'avg', 'quantile'}
AGG_FUNCTIONS_SUFFIXES = ['If', 'Array', 'ArrayIf', 'Map', 'SimpleState', 'State', 'Merge', 'MergeState', 'ForEach', 'Distinct', 'OrDefault', 'OrNull', 'Resample', 'ArgMin', 'ArgMax']
FUNC_TOKENS = {<TokenType.OBJECT: 'OBJECT'>, <TokenType.LEFT: 'LEFT'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.LIST: 'LIST'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.SET: 'SET'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.POINT: 'POINT'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.NEXT: 'NEXT'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.RLIKE: 'RLIKE'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.MULTILINESTRING: 'MULTILINESTRING'>, <TokenType.BINARY: 'BINARY'>, <TokenType.WINDOW: 'WINDOW'>, <TokenType.NAME: 'NAME'>, <TokenType.INT: 'INT'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.DECIMAL32: 'DECIMAL32'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.UINT: 'UINT'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.IPV6: 'IPV6'>, <TokenType.INDEX: 'INDEX'>, <TokenType.ILIKE: 'ILIKE'>, <TokenType.DYNAMIC: 'DYNAMIC'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.NESTED: 'NESTED'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.XML: 'XML'>, <TokenType.DECIMAL128: 'DECIMAL128'>, <TokenType.JSON: 'JSON'>, <TokenType.NULL: 'NULL'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.JSONB: 'JSONB'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.RING: 'RING'>, <TokenType.GLOB: 'GLOB'>, <TokenType.MAP: 'MAP'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.MERGE: 'MERGE'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.UUID: 'UUID'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.POLYGON: 'POLYGON'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.SUPER: 'SUPER'>, <TokenType.FILTER: 'FILTER'>, <TokenType.FORMAT: 'FORMAT'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.UNION: 'UNION'>, <TokenType.INET: 'INET'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.CHAR: 'CHAR'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.DATETIME2: 'DATETIME2'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.INT256: 'INT256'>, <TokenType.INSERT: 'INSERT'>, <TokenType.DATE32: 'DATE32'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.ALL: 'ALL'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.MULTIPOLYGON: 'MULTIPOLYGON'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.UINT256: 'UINT256'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.DECIMAL64: 'DECIMAL64'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.XOR: 'XOR'>, <TokenType.DATE: 'DATE'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.ENUM: 'ENUM'>, <TokenType.PRIMARY_KEY: 'PRIMARY_KEY'>, <TokenType.TABLE: 'TABLE'>, <TokenType.BIT: 'BIT'>, <TokenType.LIKE: 'LIKE'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.DECIMAL256: 'DECIMAL256'>, <TokenType.UINT128: 'UINT128'>, <TokenType.SOME: 'SOME'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.SMALLDATETIME: 'SMALLDATETIME'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.LINESTRING: 'LINESTRING'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.VAR: 'VAR'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.ROW: 'ROW'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.RIGHT: 'RIGHT'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.TIME: 'TIME'>, <TokenType.TEXT: 'TEXT'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.YEAR: 'YEAR'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.MONEY: 'MONEY'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.IPV4: 'IPV4'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.ANY: 'ANY'>, <TokenType.FIRST: 'FIRST'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.INT128: 'INT128'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.UNIQUEIDENTIFIER: 'UNIQUEIDENTIFIER'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.RANGE: 'RANGE'>}
RESERVED_TOKENS = {<TokenType.HASH: 'HASH'>, <TokenType.EQ: 'EQ'>, <TokenType.COMMA: 'COMMA'>, <TokenType.PLACEHOLDER: 'PLACEHOLDER'>, <TokenType.PLUS: 'PLUS'>, <TokenType.L_BRACKET: 'L_BRACKET'>, <TokenType.R_BRACKET: 'R_BRACKET'>, <TokenType.DOT: 'DOT'>, <TokenType.GT: 'GT'>, <TokenType.PARAMETER: 'PARAMETER'>, <TokenType.LT: 'LT'>, <TokenType.TILDA: 'TILDA'>, <TokenType.L_BRACE: 'L_BRACE'>, <TokenType.MOD: 'MOD'>, <TokenType.SEMICOLON: 'SEMICOLON'>, <TokenType.CARET: 'CARET'>, <TokenType.R_BRACE: 'R_BRACE'>, <TokenType.PIPE: 'PIPE'>, <TokenType.L_PAREN: 'L_PAREN'>, <TokenType.BACKSLASH: 'BACKSLASH'>, <TokenType.STAR: 'STAR'>, <TokenType.COLON: 'COLON'>, <TokenType.R_PAREN: 'R_PAREN'>, <TokenType.DASH: 'DASH'>, <TokenType.SLASH: 'SLASH'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.NOT: 'NOT'>, <TokenType.AMP: 'AMP'>}
ID_VAR_TOKENS = {<TokenType.OBJECT: 'OBJECT'>, <TokenType.LEFT: 'LEFT'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.ANTI: 'ANTI'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.WAREHOUSE: 'WAREHOUSE'>, <TokenType.FINAL: 'FINAL'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.LIST: 'LIST'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.LIMIT: 'LIMIT'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.SET: 'SET'>, <TokenType.LOAD: 'LOAD'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.END: 'END'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.USE: 'USE'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.NATURAL: 'NATURAL'>, <TokenType.POINT: 'POINT'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.STRAIGHT_JOIN: 'STRAIGHT_JOIN'>, <TokenType.MODEL: 'MODEL'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.NAMESPACE: 'NAMESPACE'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.NEXT: 'NEXT'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.FALSE: 'FALSE'>, <TokenType.ASC: 'ASC'>, <TokenType.APPLY: 'APPLY'>, <TokenType.FULL: 'FULL'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.DELETE: 'DELETE'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.RENAME: 'RENAME'>, <TokenType.MULTILINESTRING: 'MULTILINESTRING'>, <TokenType.BINARY: 'BINARY'>, <TokenType.WINDOW: 'WINDOW'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.NAME: 'NAME'>, <TokenType.INT: 'INT'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.DECIMAL32: 'DECIMAL32'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.UINT: 'UINT'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.IPV6: 'IPV6'>, <TokenType.INDEX: 'INDEX'>, <TokenType.DYNAMIC: 'DYNAMIC'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.TOP: 'TOP'>, <TokenType.NESTED: 'NESTED'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.STREAMLIT: 'STREAMLIT'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.XML: 'XML'>, <TokenType.DECIMAL128: 'DECIMAL128'>, <TokenType.JSON: 'JSON'>, <TokenType.NULL: 'NULL'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.JSONB: 'JSONB'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.RING: 'RING'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.MAP: 'MAP'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.SETTINGS: 'SETTINGS'>, <TokenType.MERGE: 'MERGE'>, <TokenType.CASE: 'CASE'>, <TokenType.ROLLUP: 'ROLLUP'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.ASOF: 'ASOF'>, <TokenType.SINK: 'SINK'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.UUID: 'UUID'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.ROWS: 'ROWS'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.POLYGON: 'POLYGON'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.SUPER: 'SUPER'>, <TokenType.FILTER: 'FILTER'>, <TokenType.FORMAT: 'FORMAT'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.ATTACH: 'ATTACH'>, <TokenType.INET: 'INET'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.CHAR: 'CHAR'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.DATETIME2: 'DATETIME2'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.INT256: 'INT256'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.PROCEDURE: 'PROCEDURE'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.DATE32: 'DATE32'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.SEMI: 'SEMI'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.ALL: 'ALL'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.MULTIPOLYGON: 'MULTIPOLYGON'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.UINT256: 'UINT256'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.STORAGE_INTEGRATION: 'STORAGE_INTEGRATION'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.VIEW: 'VIEW'>, <TokenType.DECIMAL64: 'DECIMAL64'>, <TokenType.ORDINALITY: 'ORDINALITY'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.KILL: 'KILL'>, <TokenType.CACHE: 'CACHE'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.DATE: 'DATE'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.ENUM: 'ENUM'>, <TokenType.TAG: 'TAG'>, <TokenType.KEEP: 'KEEP'>, <TokenType.TABLE: 'TABLE'>, <TokenType.CUBE: 'CUBE'>, <TokenType.BIT: 'BIT'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.IS: 'IS'>, <TokenType.LIKE: 'LIKE'>, <TokenType.COPY: 'COPY'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.DECIMAL256: 'DECIMAL256'>, <TokenType.UINT128: 'UINT128'>, <TokenType.SOME: 'SOME'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.SMALLDATETIME: 'SMALLDATETIME'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.REFERENCES: 'REFERENCES'>, <TokenType.UNIQUE: 'UNIQUE'>, <TokenType.DETACH: 'DETACH'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.DESC: 'DESC'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.DIV: 'DIV'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.LINESTRING: 'LINESTRING'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.VAR: 'VAR'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.SOURCE: 'SOURCE'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.ROW: 'ROW'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.RIGHT: 'RIGHT'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.TIME: 'TIME'>, <TokenType.TRUE: 'TRUE'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.TEXT: 'TEXT'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.YEAR: 'YEAR'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.MONEY: 'MONEY'>, <TokenType.SHOW: 'SHOW'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.IPV4: 'IPV4'>, <TokenType.ANY: 'ANY'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.FIRST: 'FIRST'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.INT128: 'INT128'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.UNIQUEIDENTIFIER: 'UNIQUEIDENTIFIER'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.RANGE: 'RANGE'>}
AGG_FUNC_MAPPING = {'argMaxIf': ('argMax', 'If'), 'quantileExactIf': ('quantileExact', 'If'), 'quantilesDeterministicIf': ('quantilesDeterministic', 'If'), 'first_valueIf': ('first_value', 'If'), 'stochasticLogisticRegressionIf': ('stochasticLogisticRegression', 'If'), 'kurtSampIf': ('kurtSamp', 'If'), 'cramersVIf': ('cramersV', 'If'), 'quantilesGKIf': ('quantilesGK', 'If'), 'uniqCombinedIf': ('uniqCombined', 'If'), 'maxIntersectionsIf': ('maxIntersections', 'If'), 'quantilesTimingWeightedIf': ('quantilesTimingWeighted', 'If'), 'sumIf': ('sum', 'If'), 'sumCountIf': ('sumCount', 'If'), 'quantileGKIf': ('quantileGK', 'If'), 'covarPopIf': ('covarPop', 'If'), 'covarSampIf': ('covarSamp', 'If'), 'sequenceNextNodeIf': ('sequenceNextNode', 'If'), 'uniqCombined64If': ('uniqCombined64', 'If'), 'quantileTimingWeightedIf': ('quantileTimingWeighted', 'If'), 'maxMapIf': ('maxMap', 'If'), 'entropyIf': ('entropy', 'If'), 'quantilesExactLowIf': ('quantilesExactLow', 'If'), 'deltaSumIf': ('deltaSum', 'If'), 'quantileDeterministicIf': ('quantileDeterministic', 'If'), 'groupUniqArrayIf': ('groupUniqArray', 'If'), 'categoricalInformationValueIf': ('categoricalInformationValue', 'If'), 'deltaSumTimestampIf': ('deltaSumTimestamp', 'If'), 'quantilesExactHighIf': ('quantilesExactHigh', 'If'), 'uniqUpToIf': ('uniqUpTo', 'If'), 'theilsUIf': ('theilsU', 'If'), 'simpleLinearRegressionIf': ('simpleLinearRegression', 'If'), 'anyLastIf': ('anyLast', 'If'), 'anyHeavyIf': ('anyHeavy', 'If'), 'topKWeightedIf': ('topKWeighted', 'If'), 'exponentialTimeDecayedAvgIf': ('exponentialTimeDecayedAvg', 'If'), 'meanZTestIf': ('meanZTest', 'If'), 'largestTriangleThreeBucketsIf': ('largestTriangleThreeBuckets', 'If'), 'groupArrayIf': ('groupArray', 'If'), 'groupBitmapAndIf': ('groupBitmapAnd', 'If'), 'groupArrayInsertAtIf': ('groupArrayInsertAt', 'If'), 'varPopIf': ('varPop', 'If'), 'exponentialMovingAverageIf': ('exponentialMovingAverage', 'If'), 'quantilesExactWeightedIf': ('quantilesExactWeighted', 'If'), 'maxIntersectionsPositionIf': ('maxIntersectionsPosition', 'If'), 'uniqIf': ('uniq', 'If'), 'contingencyIf': ('contingency', 'If'), 'studentTTestIf': ('studentTTest', 'If'), 'quantileTimingIf': ('quantileTiming', 'If'), 'quantileBFloat16If': ('quantileBFloat16', 'If'), 'quantilesInterpolatedWeightedIf': ('quantilesInterpolatedWeighted', 'If'), 'minIf': ('min', 'If'), 'groupBitmapIf': ('groupBitmap', 'If'), 'groupBitXorIf': ('groupBitXor', 'If'), 'intervalLengthSumIf': ('intervalLengthSum', 'If'), 'uniqHLL12If': ('uniqHLL12', 'If'), 'quantilesBFloat16If': ('quantilesBFloat16', 'If'), 'kurtPopIf': ('kurtPop', 'If'), 'quantilesTDigestIf': ('quantilesTDigest', 'If'), 'sumKahanIf': ('sumKahan', 'If'), 'sumMapIf': ('sumMap', 'If'), 'medianIf': ('median', 'If'), 'welchTTestIf': ('welchTTest', 'If'), 'sparkBarIf': ('sparkBar', 'If'), 'retentionIf': ('retention', 'If'), 'last_valueIf': ('last_value', 'If'), 'corrIf': ('corr', 'If'), 'skewSampIf': ('skewSamp', 'If'), 'sumWithOverflowIf': ('sumWithOverflow', 'If'), 'kolmogorovSmirnovTestIf': ('kolmogorovSmirnovTest', 'If'), 'quantileExactLowIf': ('quantileExactLow', 'If'), 'countIf': ('count', 'If'), 'groupBitmapOrIf': ('groupBitmapOr', 'If'), 'minMapIf': ('minMap', 'If'), 'rankCorrIf': ('rankCorr', 'If'), 'stddevSampIf': ('stddevSamp', 'If'), 'cramersVBiasCorrectedIf': ('cramersVBiasCorrected', 'If'), 'groupBitAndIf': ('groupBitAnd', 'If'), 'groupArrayMovingAvgIf': ('groupArrayMovingAvg', 'If'), 'groupBitOrIf': ('groupBitOr', 'If'), 'quantileExactHighIf': ('quantileExactHigh', 'If'), 'sequenceMatchIf': ('sequenceMatch', 'If'), 'uniqExactIf': ('uniqExact', 'If'), 'groupArrayLastIf': ('groupArrayLast', 'If'), 'quantileExactWeightedIf': ('quantileExactWeighted', 'If'), 'quantileInterpolatedWeightedIf': ('quantileInterpolatedWeighted', 'If'), 'quantilesTDigestWeightedIf': ('quantilesTDigestWeighted', 'If'), 'avgWeightedIf': ('avgWeighted', 'If'), 'quantilesIf': ('quantiles', 'If'), 'quantileTDigestIf': ('quantileTDigest', 'If'), 'stochasticLinearRegressionIf': ('stochasticLinearRegression', 'If'), 'groupBitmapXorIf': ('groupBitmapXor', 'If'), 'quantilesExactIf': ('quantilesExact', 'If'), 'quantilesBFloat16WeightedIf': ('quantilesBFloat16Weighted', 'If'), 'histogramIf': ('histogram', 'If'), 'uniqThetaIf': ('uniqTheta', 'If'), 'stddevPopIf': ('stddevPop', 'If'), 'anyIf': ('any', 'If'), 'sequenceCountIf': ('sequenceCount', 'If'), 'argMinIf': ('argMin', 'If'), 'maxIf': ('max', 'If'), 'windowFunnelIf': ('windowFunnel', 'If'), 'varSampIf': ('varSamp', 'If'), 'groupArraySampleIf': ('groupArraySample', 'If'), 'boundingRatioIf': ('boundingRatio', 'If'), 'groupArrayMovingSumIf': ('groupArrayMovingSum', 'If'), 'mannWhitneyUTestIf': ('mannWhitneyUTest', 'If'), 'quantilesTimingIf': ('quantilesTiming', 'If'), 'skewPopIf': ('skewPop', 'If'), 'topKIf': ('topK', 'If'), 'quantileTDigestWeightedIf': ('quantileTDigestWeighted', 'If'), 'quantileBFloat16WeightedIf': ('quantileBFloat16Weighted', 'If'), 'avgIf': ('avg', 'If'), 'quantileIf': ('quantile', 'If'), 'argMaxArray': ('argMax', 'Array'), 'quantileExactArray': ('quantileExact', 'Array'), 'quantilesDeterministicArray': ('quantilesDeterministic', 'Array'), 'first_valueArray': ('first_value', 'Array'), 'stochasticLogisticRegressionArray': ('stochasticLogisticRegression', 'Array'), 'kurtSampArray': ('kurtSamp', 'Array'), 'cramersVArray': ('cramersV', 'Array'), 'quantilesGKArray': ('quantilesGK', 'Array'), 'uniqCombinedArray': ('uniqCombined', 'Array'), 'maxIntersectionsArray': ('maxIntersections', 'Array'), 'quantilesTimingWeightedArray': ('quantilesTimingWeighted', 'Array'), 'sumArray': ('sum', 'Array'), 'sumCountArray': ('sumCount', 'Array'), 'quantileGKArray': ('quantileGK', 'Array'), 'covarPopArray': ('covarPop', 'Array'), 'covarSampArray': ('covarSamp', 'Array'), 'sequenceNextNodeArray': ('sequenceNextNode', 'Array'), 'uniqCombined64Array': ('uniqCombined64', 'Array'), 'quantileTimingWeightedArray': ('quantileTimingWeighted', 'Array'), 'maxMapArray': ('maxMap', 'Array'), 'entropyArray': ('entropy', 'Array'), 'quantilesExactLowArray': ('quantilesExactLow', 'Array'), 'deltaSumArray': ('deltaSum', 'Array'), 'quantileDeterministicArray': ('quantileDeterministic', 'Array'), 'groupUniqArrayArray': ('groupUniqArray', 'Array'), 'categoricalInformationValueArray': ('categoricalInformationValue', 'Array'), 'deltaSumTimestampArray': ('deltaSumTimestamp', 'Array'), 'quantilesExactHighArray': ('quantilesExactHigh', 'Array'), 'uniqUpToArray': ('uniqUpTo', 'Array'), 'theilsUArray': ('theilsU', 'Array'), 'simpleLinearRegressionArray': ('simpleLinearRegression', 'Array'), 'anyLastArray': ('anyLast', 'Array'), 'anyHeavyArray': ('anyHeavy', 'Array'), 'topKWeightedArray': ('topKWeighted', 'Array'), 'exponentialTimeDecayedAvgArray': ('exponentialTimeDecayedAvg', 'Array'), 'meanZTestArray': ('meanZTest', 'Array'), 'largestTriangleThreeBucketsArray': ('largestTriangleThreeBuckets', 'Array'), 'groupArrayArray': ('groupArray', 'Array'), 'groupBitmapAndArray': ('groupBitmapAnd', 'Array'), 'groupArrayInsertAtArray': ('groupArrayInsertAt', 'Array'), 'varPopArray': ('varPop', 'Array'), 'exponentialMovingAverageArray': ('exponentialMovingAverage', 'Array'), 'quantilesExactWeightedArray': ('quantilesExactWeighted', 'Array'), 'maxIntersectionsPositionArray': ('maxIntersectionsPosition', 'Array'), 'uniqArray': ('uniq', 'Array'), 'contingencyArray': ('contingency', 'Array'), 'studentTTestArray': ('studentTTest', 'Array'), 'quantileTimingArray': ('quantileTiming', 'Array'), 'quantileBFloat16Array': ('quantileBFloat16', 'Array'), 'quantilesInterpolatedWeightedArray': ('quantilesInterpolatedWeighted', 'Array'), 'minArray': ('min', 'Array'), 'groupBitmapArray': ('groupBitmap', 'Array'), 'groupBitXorArray': ('groupBitXor', 'Array'), 'intervalLengthSumArray': ('intervalLengthSum', 'Array'), 'uniqHLL12Array': ('uniqHLL12', 'Array'), 'quantilesBFloat16Array': ('quantilesBFloat16', 'Array'), 'kurtPopArray': ('kurtPop', 'Array'), 'quantilesTDigestArray': ('quantilesTDigest', 'Array'), 'sumKahanArray': ('sumKahan', 'Array'), 'sumMapArray': ('sumMap', 'Array'), 'medianArray': ('median', 'Array'), 'welchTTestArray': ('welchTTest', 'Array'), 'sparkBarArray': ('sparkBar', 'Array'), 'retentionArray': ('retention', 'Array'), 'last_valueArray': ('last_value', 'Array'), 'corrArray': ('corr', 'Array'), 'skewSampArray': ('skewSamp', 'Array'), 'sumWithOverflowArray': ('sumWithOverflow', 'Array'), 'kolmogorovSmirnovTestArray': ('kolmogorovSmirnovTest', 'Array'), 'quantileExactLowArray': ('quantileExactLow', 'Array'), 'countArray': ('count', 'Array'), 'groupBitmapOrArray': ('groupBitmapOr', 'Array'), 'minMapArray': ('minMap', 'Array'), 'rankCorrArray': ('rankCorr', 'Array'), 'stddevSampArray': ('stddevSamp', 'Array'), 'cramersVBiasCorrectedArray': ('cramersVBiasCorrected', 'Array'), 'groupBitAndArray': ('groupBitAnd', 'Array'), 'groupArrayMovingAvgArray': ('groupArrayMovingAvg', 'Array'), 'groupBitOrArray': ('groupBitOr', 'Array'), 'quantileExactHighArray': ('quantileExactHigh', 'Array'), 'sequenceMatchArray': ('sequenceMatch', 'Array'), 'uniqExactArray': ('uniqExact', 'Array'), 'groupArrayLastArray': ('groupArrayLast', 'Array'), 'quantileExactWeightedArray': ('quantileExactWeighted', 'Array'), 'quantileInterpolatedWeightedArray': ('quantileInterpolatedWeighted', 'Array'), 'quantilesTDigestWeightedArray': ('quantilesTDigestWeighted', 'Array'), 'avgWeightedArray': ('avgWeighted', 'Array'), 'quantilesArray': ('quantiles', 'Array'), 'quantileTDigestArray': ('quantileTDigest', 'Array'), 'stochasticLinearRegressionArray': ('stochasticLinearRegression', 'Array'), 'groupBitmapXorArray': ('groupBitmapXor', 'Array'), 'quantilesExactArray': ('quantilesExact', 'Array'), 'quantilesBFloat16WeightedArray': ('quantilesBFloat16Weighted', 'Array'), 'histogramArray': ('histogram', 'Array'), 'uniqThetaArray': ('uniqTheta', 'Array'), 'stddevPopArray': ('stddevPop', 'Array'), 'anyArray': ('any', 'Array'), 'sequenceCountArray': ('sequenceCount', 'Array'), 'argMinArray': ('argMin', 'Array'), 'maxArray': ('max', 'Array'), 'windowFunnelArray': ('windowFunnel', 'Array'), 'varSampArray': ('varSamp', 'Array'), 'groupArraySampleArray': ('groupArraySample', 'Array'), 'boundingRatioArray': ('boundingRatio', 'Array'), 'groupArrayMovingSumArray': ('groupArrayMovingSum', 'Array'), 'mannWhitneyUTestArray': ('mannWhitneyUTest', 'Array'), 'quantilesTimingArray': ('quantilesTiming', 'Array'), 'skewPopArray': ('skewPop', 'Array'), 'topKArray': ('topK', 'Array'), 'quantileTDigestWeightedArray': ('quantileTDigestWeighted', 'Array'), 'quantileBFloat16WeightedArray': ('quantileBFloat16Weighted', 'Array'), 'avgArray': ('avg', 'Array'), 'quantileArray': ('quantile', 'Array'), 'argMaxArrayIf': ('argMax', 'ArrayIf'), 'quantileExactArrayIf': ('quantileExact', 'ArrayIf'), 'quantilesDeterministicArrayIf': ('quantilesDeterministic', 'ArrayIf'), 'first_valueArrayIf': ('first_value', 'ArrayIf'), 'stochasticLogisticRegressionArrayIf': ('stochasticLogisticRegression', 'ArrayIf'), 'kurtSampArrayIf': ('kurtSamp', 'ArrayIf'), 'cramersVArrayIf': ('cramersV', 'ArrayIf'), 'quantilesGKArrayIf': ('quantilesGK', 'ArrayIf'), 'uniqCombinedArrayIf': ('uniqCombined', 'ArrayIf'), 'maxIntersectionsArrayIf': ('maxIntersections', 'ArrayIf'), 'quantilesTimingWeightedArrayIf': ('quantilesTimingWeighted', 'ArrayIf'), 'sumArrayIf': ('sum', 'ArrayIf'), 'sumCountArrayIf': ('sumCount', 'ArrayIf'), 'quantileGKArrayIf': ('quantileGK', 'ArrayIf'), 'covarPopArrayIf': ('covarPop', 'ArrayIf'), 'covarSampArrayIf': ('covarSamp', 'ArrayIf'), 'sequenceNextNodeArrayIf': ('sequenceNextNode', 'ArrayIf'), 'uniqCombined64ArrayIf': ('uniqCombined64', 'ArrayIf'), 'quantileTimingWeightedArrayIf': ('quantileTimingWeighted', 'ArrayIf'), 'maxMapArrayIf': ('maxMap', 'ArrayIf'), 'entropyArrayIf': ('entropy', 'ArrayIf'), 'quantilesExactLowArrayIf': ('quantilesExactLow', 'ArrayIf'), 'deltaSumArrayIf': ('deltaSum', 'ArrayIf'), 'quantileDeterministicArrayIf': ('quantileDeterministic', 'ArrayIf'), 'groupUniqArrayArrayIf': ('groupUniqArray', 'ArrayIf'), 'categoricalInformationValueArrayIf': ('categoricalInformationValue', 'ArrayIf'), 'deltaSumTimestampArrayIf': ('deltaSumTimestamp', 'ArrayIf'), 'quantilesExactHighArrayIf': ('quantilesExactHigh', 'ArrayIf'), 'uniqUpToArrayIf': ('uniqUpTo', 'ArrayIf'), 'theilsUArrayIf': ('theilsU', 'ArrayIf'), 'simpleLinearRegressionArrayIf': ('simpleLinearRegression', 'ArrayIf'), 'anyLastArrayIf': ('anyLast', 'ArrayIf'), 'anyHeavyArrayIf': ('anyHeavy', 'ArrayIf'), 'topKWeightedArrayIf': ('topKWeighted', 'ArrayIf'), 'exponentialTimeDecayedAvgArrayIf': ('exponentialTimeDecayedAvg', 'ArrayIf'), 'meanZTestArrayIf': ('meanZTest', 'ArrayIf'), 'largestTriangleThreeBucketsArrayIf': ('largestTriangleThreeBuckets', 'ArrayIf'), 'groupArrayArrayIf': ('groupArray', 'ArrayIf'), 'groupBitmapAndArrayIf': ('groupBitmapAnd', 'ArrayIf'), 'groupArrayInsertAtArrayIf': ('groupArrayInsertAt', 'ArrayIf'), 'varPopArrayIf': ('varPop', 'ArrayIf'), 'exponentialMovingAverageArrayIf': ('exponentialMovingAverage', 'ArrayIf'), 'quantilesExactWeightedArrayIf': ('quantilesExactWeighted', 'ArrayIf'), 'maxIntersectionsPositionArrayIf': ('maxIntersectionsPosition', 'ArrayIf'), 'uniqArrayIf': ('uniq', 'ArrayIf'), 'contingencyArrayIf': ('contingency', 'ArrayIf'), 'studentTTestArrayIf': ('studentTTest', 'ArrayIf'), 'quantileTimingArrayIf': ('quantileTiming', 'ArrayIf'), 'quantileBFloat16ArrayIf': ('quantileBFloat16', 'ArrayIf'), 'quantilesInterpolatedWeightedArrayIf': ('quantilesInterpolatedWeighted', 'ArrayIf'), 'minArrayIf': ('min', 'ArrayIf'), 'groupBitmapArrayIf': ('groupBitmap', 'ArrayIf'), 'groupBitXorArrayIf': ('groupBitXor', 'ArrayIf'), 'intervalLengthSumArrayIf': ('intervalLengthSum', 'ArrayIf'), 'uniqHLL12ArrayIf': ('uniqHLL12', 'ArrayIf'), 'quantilesBFloat16ArrayIf': ('quantilesBFloat16', 'ArrayIf'), 'kurtPopArrayIf': ('kurtPop', 'ArrayIf'), 'quantilesTDigestArrayIf': ('quantilesTDigest', 'ArrayIf'), 'sumKahanArrayIf': ('sumKahan', 'ArrayIf'), 'sumMapArrayIf': ('sumMap', 'ArrayIf'), 'medianArrayIf': ('median', 'ArrayIf'), 'welchTTestArrayIf': ('welchTTest', 'ArrayIf'), 'sparkBarArrayIf': ('sparkBar', 'ArrayIf'), 'retentionArrayIf': ('retention', 'ArrayIf'), 'last_valueArrayIf': ('last_value', 'ArrayIf'), 'corrArrayIf': ('corr', 'ArrayIf'), 'skewSampArrayIf': ('skewSamp', 'ArrayIf'), 'sumWithOverflowArrayIf': ('sumWithOverflow', 'ArrayIf'), 'kolmogorovSmirnovTestArrayIf': ('kolmogorovSmirnovTest', 'ArrayIf'), 'quantileExactLowArrayIf': ('quantileExactLow', 'ArrayIf'), 'countArrayIf': ('count', 'ArrayIf'), 'groupBitmapOrArrayIf': ('groupBitmapOr', 'ArrayIf'), 'minMapArrayIf': ('minMap', 'ArrayIf'), 'rankCorrArrayIf': ('rankCorr', 'ArrayIf'), 'stddevSampArrayIf': ('stddevSamp', 'ArrayIf'), 'cramersVBiasCorrectedArrayIf': ('cramersVBiasCorrected', 'ArrayIf'), 'groupBitAndArrayIf': ('groupBitAnd', 'ArrayIf'), 'groupArrayMovingAvgArrayIf': ('groupArrayMovingAvg', 'ArrayIf'), 'groupBitOrArrayIf': ('groupBitOr', 'ArrayIf'), 'quantileExactHighArrayIf': ('quantileExactHigh', 'ArrayIf'), 'sequenceMatchArrayIf': ('sequenceMatch', 'ArrayIf'), 'uniqExactArrayIf': ('uniqExact', 'ArrayIf'), 'groupArrayLastArrayIf': ('groupArrayLast', 'ArrayIf'), 'quantileExactWeightedArrayIf': ('quantileExactWeighted', 'ArrayIf'), 'quantileInterpolatedWeightedArrayIf': ('quantileInterpolatedWeighted', 'ArrayIf'), 'quantilesTDigestWeightedArrayIf': ('quantilesTDigestWeighted', 'ArrayIf'), 'avgWeightedArrayIf': ('avgWeighted', 'ArrayIf'), 'quantilesArrayIf': ('quantiles', 'ArrayIf'), 'quantileTDigestArrayIf': ('quantileTDigest', 'ArrayIf'), 'stochasticLinearRegressionArrayIf': ('stochasticLinearRegression', 'ArrayIf'), 'groupBitmapXorArrayIf': ('groupBitmapXor', 'ArrayIf'), 'quantilesExactArrayIf': ('quantilesExact', 'ArrayIf'), 'quantilesBFloat16WeightedArrayIf': ('quantilesBFloat16Weighted', 'ArrayIf'), 'histogramArrayIf': ('histogram', 'ArrayIf'), 'uniqThetaArrayIf': ('uniqTheta', 'ArrayIf'), 'stddevPopArrayIf': ('stddevPop', 'ArrayIf'), 'anyArrayIf': ('any', 'ArrayIf'), 'sequenceCountArrayIf': ('sequenceCount', 'ArrayIf'), 'argMinArrayIf': ('argMin', 'ArrayIf'), 'maxArrayIf': ('max', 'ArrayIf'), 'windowFunnelArrayIf': ('windowFunnel', 'ArrayIf'), 'varSampArrayIf': ('varSamp', 'ArrayIf'), 'groupArraySampleArrayIf': ('groupArraySample', 'ArrayIf'), 'boundingRatioArrayIf': ('boundingRatio', 'ArrayIf'), 'groupArrayMovingSumArrayIf': ('groupArrayMovingSum', 'ArrayIf'), 'mannWhitneyUTestArrayIf': ('mannWhitneyUTest', 'ArrayIf'), 'quantilesTimingArrayIf': ('quantilesTiming', 'ArrayIf'), 'skewPopArrayIf': ('skewPop', 'ArrayIf'), 'topKArrayIf': ('topK', 'ArrayIf'), 'quantileTDigestWeightedArrayIf': ('quantileTDigestWeighted', 'ArrayIf'), 'quantileBFloat16WeightedArrayIf': ('quantileBFloat16Weighted', 'ArrayIf'), 'avgArrayIf': ('avg', 'ArrayIf'), 'quantileArrayIf': ('quantile', 'ArrayIf'), 'argMaxMap': ('argMax', 'Map'), 'quantileExactMap': ('quantileExact', 'Map'), 'quantilesDeterministicMap': ('quantilesDeterministic', 'Map'), 'first_valueMap': ('first_value', 'Map'), 'stochasticLogisticRegressionMap': ('stochasticLogisticRegression', 'Map'), 'kurtSampMap': ('kurtSamp', 'Map'), 'cramersVMap': ('cramersV', 'Map'), 'quantilesGKMap': ('quantilesGK', 'Map'), 'uniqCombinedMap': ('uniqCombined', 'Map'), 'maxIntersectionsMap': ('maxIntersections', 'Map'), 'quantilesTimingWeightedMap': ('quantilesTimingWeighted', 'Map'), 'sumMap': ('sumMap', ''), 'sumCountMap': ('sumCount', 'Map'), 'quantileGKMap': ('quantileGK', 'Map'), 'covarPopMap': ('covarPop', 'Map'), 'covarSampMap': ('covarSamp', 'Map'), 'sequenceNextNodeMap': ('sequenceNextNode', 'Map'), 'uniqCombined64Map': ('uniqCombined64', 'Map'), 'quantileTimingWeightedMap': ('quantileTimingWeighted', 'Map'), 'maxMapMap': ('maxMap', 'Map'), 'entropyMap': ('entropy', 'Map'), 'quantilesExactLowMap': ('quantilesExactLow', 'Map'), 'deltaSumMap': ('deltaSum', 'Map'), 'quantileDeterministicMap': ('quantileDeterministic', 'Map'), 'groupUniqArrayMap': ('groupUniqArray', 'Map'), 'categoricalInformationValueMap': ('categoricalInformationValue', 'Map'), 'deltaSumTimestampMap': ('deltaSumTimestamp', 'Map'), 'quantilesExactHighMap': ('quantilesExactHigh', 'Map'), 'uniqUpToMap': ('uniqUpTo', 'Map'), 'theilsUMap': ('theilsU', 'Map'), 'simpleLinearRegressionMap': ('simpleLinearRegression', 'Map'), 'anyLastMap': ('anyLast', 'Map'), 'anyHeavyMap': ('anyHeavy', 'Map'), 'topKWeightedMap': ('topKWeighted', 'Map'), 'exponentialTimeDecayedAvgMap': ('exponentialTimeDecayedAvg', 'Map'), 'meanZTestMap': ('meanZTest', 'Map'), 'largestTriangleThreeBucketsMap': ('largestTriangleThreeBuckets', 'Map'), 'groupArrayMap': ('groupArray', 'Map'), 'groupBitmapAndMap': ('groupBitmapAnd', 'Map'), 'groupArrayInsertAtMap': ('groupArrayInsertAt', 'Map'), 'varPopMap': ('varPop', 'Map'), 'exponentialMovingAverageMap': ('exponentialMovingAverage', 'Map'), 'quantilesExactWeightedMap': ('quantilesExactWeighted', 'Map'), 'maxIntersectionsPositionMap': ('maxIntersectionsPosition', 'Map'), 'uniqMap': ('uniq', 'Map'), 'contingencyMap': ('contingency', 'Map'), 'studentTTestMap': ('studentTTest', 'Map'), 'quantileTimingMap': ('quantileTiming', 'Map'), 'quantileBFloat16Map': ('quantileBFloat16', 'Map'), 'quantilesInterpolatedWeightedMap': ('quantilesInterpolatedWeighted', 'Map'), 'minMap': ('minMap', ''), 'groupBitmapMap': ('groupBitmap', 'Map'), 'groupBitXorMap': ('groupBitXor', 'Map'), 'intervalLengthSumMap': ('intervalLengthSum', 'Map'), 'uniqHLL12Map': ('uniqHLL12', 'Map'), 'quantilesBFloat16Map': ('quantilesBFloat16', 'Map'), 'kurtPopMap': ('kurtPop', 'Map'), 'quantilesTDigestMap': ('quantilesTDigest', 'Map'), 'sumKahanMap': ('sumKahan', 'Map'), 'sumMapMap': ('sumMap', 'Map'), 'medianMap': ('median', 'Map'), 'welchTTestMap': ('welchTTest', 'Map'), 'sparkBarMap': ('sparkBar', 'Map'), 'retentionMap': ('retention', 'Map'), 'last_valueMap': ('last_value', 'Map'), 'corrMap': ('corr', 'Map'), 'skewSampMap': ('skewSamp', 'Map'), 'sumWithOverflowMap': ('sumWithOverflow', 'Map'), 'kolmogorovSmirnovTestMap': ('kolmogorovSmirnovTest', 'Map'), 'quantileExactLowMap': ('quantileExactLow', 'Map'), 'countMap': ('count', 'Map'), 'groupBitmapOrMap': ('groupBitmapOr', 'Map'), 'minMapMap': ('minMap', 'Map'), 'rankCorrMap': ('rankCorr', 'Map'), 'stddevSampMap': ('stddevSamp', 'Map'), 'cramersVBiasCorrectedMap': ('cramersVBiasCorrected', 'Map'), 'groupBitAndMap': ('groupBitAnd', 'Map'), 'groupArrayMovingAvgMap': ('groupArrayMovingAvg', 'Map'), 'groupBitOrMap': ('groupBitOr', 'Map'), 'quantileExactHighMap': ('quantileExactHigh', 'Map'), 'sequenceMatchMap': ('sequenceMatch', 'Map'), 'uniqExactMap': ('uniqExact', 'Map'), 'groupArrayLastMap': ('groupArrayLast', 'Map'), 'quantileExactWeightedMap': ('quantileExactWeighted', 'Map'), 'quantileInterpolatedWeightedMap': ('quantileInterpolatedWeighted', 'Map'), 'quantilesTDigestWeightedMap': ('quantilesTDigestWeighted', 'Map'), 'avgWeightedMap': ('avgWeighted', 'Map'), 'quantilesMap': ('quantiles', 'Map'), 'quantileTDigestMap': ('quantileTDigest', 'Map'), 'stochasticLinearRegressionMap': ('stochasticLinearRegression', 'Map'), 'groupBitmapXorMap': ('groupBitmapXor', 'Map'), 'quantilesExactMap': ('quantilesExact', 'Map'), 'quantilesBFloat16WeightedMap': ('quantilesBFloat16Weighted', 'Map'), 'histogramMap': ('histogram', 'Map'), 'uniqThetaMap': ('uniqTheta', 'Map'), 'stddevPopMap': ('stddevPop', 'Map'), 'anyMap': ('any', 'Map'), 'sequenceCountMap': ('sequenceCount', 'Map'), 'argMinMap': ('argMin', 'Map'), 'maxMap': ('maxMap', ''), 'windowFunnelMap': ('windowFunnel', 'Map'), 'varSampMap': ('varSamp', 'Map'), 'groupArraySampleMap': ('groupArraySample', 'Map'), 'boundingRatioMap': ('boundingRatio', 'Map'), 'groupArrayMovingSumMap': ('groupArrayMovingSum', 'Map'), 'mannWhitneyUTestMap': ('mannWhitneyUTest', 'Map'), 'quantilesTimingMap': ('quantilesTiming', 'Map'), 'skewPopMap': ('skewPop', 'Map'), 'topKMap': ('topK', 'Map'), 'quantileTDigestWeightedMap': ('quantileTDigestWeighted', 'Map'), 'quantileBFloat16WeightedMap': ('quantileBFloat16Weighted', 'Map'), 'avgMap': ('avg', 'Map'), 'quantileMap': ('quantile', 'Map'), 'argMaxSimpleState': ('argMax', 'SimpleState'), 'quantileExactSimpleState': ('quantileExact', 'SimpleState'), 'quantilesDeterministicSimpleState': ('quantilesDeterministic', 'SimpleState'), 'first_valueSimpleState': ('first_value', 'SimpleState'), 'stochasticLogisticRegressionSimpleState': ('stochasticLogisticRegression', 'SimpleState'), 'kurtSampSimpleState': ('kurtSamp', 'SimpleState'), 'cramersVSimpleState': ('cramersV', 'SimpleState'), 'quantilesGKSimpleState': ('quantilesGK', 'SimpleState'), 'uniqCombinedSimpleState': ('uniqCombined', 'SimpleState'), 'maxIntersectionsSimpleState': ('maxIntersections', 'SimpleState'), 'quantilesTimingWeightedSimpleState': ('quantilesTimingWeighted', 'SimpleState'), 'sumSimpleState': ('sum', 'SimpleState'), 'sumCountSimpleState': ('sumCount', 'SimpleState'), 'quantileGKSimpleState': ('quantileGK', 'SimpleState'), 'covarPopSimpleState': ('covarPop', 'SimpleState'), 'covarSampSimpleState': ('covarSamp', 'SimpleState'), 'sequenceNextNodeSimpleState': ('sequenceNextNode', 'SimpleState'), 'uniqCombined64SimpleState': ('uniqCombined64', 'SimpleState'), 'quantileTimingWeightedSimpleState': ('quantileTimingWeighted', 'SimpleState'), 'maxMapSimpleState': ('maxMap', 'SimpleState'), 'entropySimpleState': ('entropy', 'SimpleState'), 'quantilesExactLowSimpleState': ('quantilesExactLow', 'SimpleState'), 'deltaSumSimpleState': ('deltaSum', 'SimpleState'), 'quantileDeterministicSimpleState': ('quantileDeterministic', 'SimpleState'), 'groupUniqArraySimpleState': ('groupUniqArray', 'SimpleState'), 'categoricalInformationValueSimpleState': ('categoricalInformationValue', 'SimpleState'), 'deltaSumTimestampSimpleState': ('deltaSumTimestamp', 'SimpleState'), 'quantilesExactHighSimpleState': ('quantilesExactHigh', 'SimpleState'), 'uniqUpToSimpleState': ('uniqUpTo', 'SimpleState'), 'theilsUSimpleState': ('theilsU', 'SimpleState'), 'simpleLinearRegressionSimpleState': ('simpleLinearRegression', 'SimpleState'), 'anyLastSimpleState': ('anyLast', 'SimpleState'), 'anyHeavySimpleState': ('anyHeavy', 'SimpleState'), 'topKWeightedSimpleState': ('topKWeighted', 'SimpleState'), 'exponentialTimeDecayedAvgSimpleState': ('exponentialTimeDecayedAvg', 'SimpleState'), 'meanZTestSimpleState': ('meanZTest', 'SimpleState'), 'largestTriangleThreeBucketsSimpleState': ('largestTriangleThreeBuckets', 'SimpleState'), 'groupArraySimpleState': ('groupArray', 'SimpleState'), 'groupBitmapAndSimpleState': ('groupBitmapAnd', 'SimpleState'), 'groupArrayInsertAtSimpleState': ('groupArrayInsertAt', 'SimpleState'), 'varPopSimpleState': ('varPop', 'SimpleState'), 'exponentialMovingAverageSimpleState': ('exponentialMovingAverage', 'SimpleState'), 'quantilesExactWeightedSimpleState': ('quantilesExactWeighted', 'SimpleState'), 'maxIntersectionsPositionSimpleState': ('maxIntersectionsPosition', 'SimpleState'), 'uniqSimpleState': ('uniq', 'SimpleState'), 'contingencySimpleState': ('contingency', 'SimpleState'), 'studentTTestSimpleState': ('studentTTest', 'SimpleState'), 'quantileTimingSimpleState': ('quantileTiming', 'SimpleState'), 'quantileBFloat16SimpleState': ('quantileBFloat16', 'SimpleState'), 'quantilesInterpolatedWeightedSimpleState': ('quantilesInterpolatedWeighted', 'SimpleState'), 'minSimpleState': ('min', 'SimpleState'), 'groupBitmapSimpleState': ('groupBitmap', 'SimpleState'), 'groupBitXorSimpleState': ('groupBitXor', 'SimpleState'), 'intervalLengthSumSimpleState': ('intervalLengthSum', 'SimpleState'), 'uniqHLL12SimpleState': ('uniqHLL12', 'SimpleState'), 'quantilesBFloat16SimpleState': ('quantilesBFloat16', 'SimpleState'), 'kurtPopSimpleState': ('kurtPop', 'SimpleState'), 'quantilesTDigestSimpleState': ('quantilesTDigest', 'SimpleState'), 'sumKahanSimpleState': ('sumKahan', 'SimpleState'), 'sumMapSimpleState': ('sumMap', 'SimpleState'), 'medianSimpleState': ('median', 'SimpleState'), 'welchTTestSimpleState': ('welchTTest', 'SimpleState'), 'sparkBarSimpleState': ('sparkBar', 'SimpleState'), 'retentionSimpleState': ('retention', 'SimpleState'), 'last_valueSimpleState': ('last_value', 'SimpleState'), 'corrSimpleState': ('corr', 'SimpleState'), 'skewSampSimpleState': ('skewSamp', 'SimpleState'), 'sumWithOverflowSimpleState': ('sumWithOverflow', 'SimpleState'), 'kolmogorovSmirnovTestSimpleState': ('kolmogorovSmirnovTest', 'SimpleState'), 'quantileExactLowSimpleState': ('quantileExactLow', 'SimpleState'), 'countSimpleState': ('count', 'SimpleState'), 'groupBitmapOrSimpleState': ('groupBitmapOr', 'SimpleState'), 'minMapSimpleState': ('minMap', 'SimpleState'), 'rankCorrSimpleState': ('rankCorr', 'SimpleState'), 'stddevSampSimpleState': ('stddevSamp', 'SimpleState'), 'cramersVBiasCorrectedSimpleState': ('cramersVBiasCorrected', 'SimpleState'), 'groupBitAndSimpleState': ('groupBitAnd', 'SimpleState'), 'groupArrayMovingAvgSimpleState': ('groupArrayMovingAvg', 'SimpleState'), 'groupBitOrSimpleState': ('groupBitOr', 'SimpleState'), 'quantileExactHighSimpleState': ('quantileExactHigh', 'SimpleState'), 'sequenceMatchSimpleState': ('sequenceMatch', 'SimpleState'), 'uniqExactSimpleState': ('uniqExact', 'SimpleState'), 'groupArrayLastSimpleState': ('groupArrayLast', 'SimpleState'), 'quantileExactWeightedSimpleState': ('quantileExactWeighted', 'SimpleState'), 'quantileInterpolatedWeightedSimpleState': ('quantileInterpolatedWeighted', 'SimpleState'), 'quantilesTDigestWeightedSimpleState': ('quantilesTDigestWeighted', 'SimpleState'), 'avgWeightedSimpleState': ('avgWeighted', 'SimpleState'), 'quantilesSimpleState': ('quantiles', 'SimpleState'), 'quantileTDigestSimpleState': ('quantileTDigest', 'SimpleState'), 'stochasticLinearRegressionSimpleState': ('stochasticLinearRegression', 'SimpleState'), 'groupBitmapXorSimpleState': ('groupBitmapXor', 'SimpleState'), 'quantilesExactSimpleState': ('quantilesExact', 'SimpleState'), 'quantilesBFloat16WeightedSimpleState': ('quantilesBFloat16Weighted', 'SimpleState'), 'histogramSimpleState': ('histogram', 'SimpleState'), 'uniqThetaSimpleState': ('uniqTheta', 'SimpleState'), 'stddevPopSimpleState': ('stddevPop', 'SimpleState'), 'anySimpleState': ('any', 'SimpleState'), 'sequenceCountSimpleState': ('sequenceCount', 'SimpleState'), 'argMinSimpleState': ('argMin', 'SimpleState'), 'maxSimpleState': ('max', 'SimpleState'), 'windowFunnelSimpleState': ('windowFunnel', 'SimpleState'), 'varSampSimpleState': ('varSamp', 'SimpleState'), 'groupArraySampleSimpleState': ('groupArraySample', 'SimpleState'), 'boundingRatioSimpleState': ('boundingRatio', 'SimpleState'), 'groupArrayMovingSumSimpleState': ('groupArrayMovingSum', 'SimpleState'), 'mannWhitneyUTestSimpleState': ('mannWhitneyUTest', 'SimpleState'), 'quantilesTimingSimpleState': ('quantilesTiming', 'SimpleState'), 'skewPopSimpleState': ('skewPop', 'SimpleState'), 'topKSimpleState': ('topK', 'SimpleState'), 'quantileTDigestWeightedSimpleState': ('quantileTDigestWeighted', 'SimpleState'), 'quantileBFloat16WeightedSimpleState': ('quantileBFloat16Weighted', 'SimpleState'), 'avgSimpleState': ('avg', 'SimpleState'), 'quantileSimpleState': ('quantile', 'SimpleState'), 'argMaxState': ('argMax', 'State'), 'quantileExactState': ('quantileExact', 'State'), 'quantilesDeterministicState': ('quantilesDeterministic', 'State'), 'first_valueState': ('first_value', 'State'), 'stochasticLogisticRegressionState': ('stochasticLogisticRegression', 'State'), 'kurtSampState': ('kurtSamp', 'State'), 'cramersVState': ('cramersV', 'State'), 'quantilesGKState': ('quantilesGK', 'State'), 'uniqCombinedState': ('uniqCombined', 'State'), 'maxIntersectionsState': ('maxIntersections', 'State'), 'quantilesTimingWeightedState': ('quantilesTimingWeighted', 'State'), 'sumState': ('sum', 'State'), 'sumCountState': ('sumCount', 'State'), 'quantileGKState': ('quantileGK', 'State'), 'covarPopState': ('covarPop', 'State'), 'covarSampState': ('covarSamp', 'State'), 'sequenceNextNodeState': ('sequenceNextNode', 'State'), 'uniqCombined64State': ('uniqCombined64', 'State'), 'quantileTimingWeightedState': ('quantileTimingWeighted', 'State'), 'maxMapState': ('maxMap', 'State'), 'entropyState': ('entropy', 'State'), 'quantilesExactLowState': ('quantilesExactLow', 'State'), 'deltaSumState': ('deltaSum', 'State'), 'quantileDeterministicState': ('quantileDeterministic', 'State'), 'groupUniqArrayState': ('groupUniqArray', 'State'), 'categoricalInformationValueState': ('categoricalInformationValue', 'State'), 'deltaSumTimestampState': ('deltaSumTimestamp', 'State'), 'quantilesExactHighState': ('quantilesExactHigh', 'State'), 'uniqUpToState': ('uniqUpTo', 'State'), 'theilsUState': ('theilsU', 'State'), 'simpleLinearRegressionState': ('simpleLinearRegression', 'State'), 'anyLastState': ('anyLast', 'State'), 'anyHeavyState': ('anyHeavy', 'State'), 'topKWeightedState': ('topKWeighted', 'State'), 'exponentialTimeDecayedAvgState': ('exponentialTimeDecayedAvg', 'State'), 'meanZTestState': ('meanZTest', 'State'), 'largestTriangleThreeBucketsState': ('largestTriangleThreeBuckets', 'State'), 'groupArrayState': ('groupArray', 'State'), 'groupBitmapAndState': ('groupBitmapAnd', 'State'), 'groupArrayInsertAtState': ('groupArrayInsertAt', 'State'), 'varPopState': ('varPop', 'State'), 'exponentialMovingAverageState': ('exponentialMovingAverage', 'State'), 'quantilesExactWeightedState': ('quantilesExactWeighted', 'State'), 'maxIntersectionsPositionState': ('maxIntersectionsPosition', 'State'), 'uniqState': ('uniq', 'State'), 'contingencyState': ('contingency', 'State'), 'studentTTestState': ('studentTTest', 'State'), 'quantileTimingState': ('quantileTiming', 'State'), 'quantileBFloat16State': ('quantileBFloat16', 'State'), 'quantilesInterpolatedWeightedState': ('quantilesInterpolatedWeighted', 'State'), 'minState': ('min', 'State'), 'groupBitmapState': ('groupBitmap', 'State'), 'groupBitXorState': ('groupBitXor', 'State'), 'intervalLengthSumState': ('intervalLengthSum', 'State'), 'uniqHLL12State': ('uniqHLL12', 'State'), 'quantilesBFloat16State': ('quantilesBFloat16', 'State'), 'kurtPopState': ('kurtPop', 'State'), 'quantilesTDigestState': ('quantilesTDigest', 'State'), 'sumKahanState': ('sumKahan', 'State'), 'sumMapState': ('sumMap', 'State'), 'medianState': ('median', 'State'), 'welchTTestState': ('welchTTest', 'State'), 'sparkBarState': ('sparkBar', 'State'), 'retentionState': ('retention', 'State'), 'last_valueState': ('last_value', 'State'), 'corrState': ('corr', 'State'), 'skewSampState': ('skewSamp', 'State'), 'sumWithOverflowState': ('sumWithOverflow', 'State'), 'kolmogorovSmirnovTestState': ('kolmogorovSmirnovTest', 'State'), 'quantileExactLowState': ('quantileExactLow', 'State'), 'countState': ('count', 'State'), 'groupBitmapOrState': ('groupBitmapOr', 'State'), 'minMapState': ('minMap', 'State'), 'rankCorrState': ('rankCorr', 'State'), 'stddevSampState': ('stddevSamp', 'State'), 'cramersVBiasCorrectedState': ('cramersVBiasCorrected', 'State'), 'groupBitAndState': ('groupBitAnd', 'State'), 'groupArrayMovingAvgState': ('groupArrayMovingAvg', 'State'), 'groupBitOrState': ('groupBitOr', 'State'), 'quantileExactHighState': ('quantileExactHigh', 'State'), 'sequenceMatchState': ('sequenceMatch', 'State'), 'uniqExactState': ('uniqExact', 'State'), 'groupArrayLastState': ('groupArrayLast', 'State'), 'quantileExactWeightedState': ('quantileExactWeighted', 'State'), 'quantileInterpolatedWeightedState': ('quantileInterpolatedWeighted', 'State'), 'quantilesTDigestWeightedState': ('quantilesTDigestWeighted', 'State'), 'avgWeightedState': ('avgWeighted', 'State'), 'quantilesState': ('quantiles', 'State'), 'quantileTDigestState': ('quantileTDigest', 'State'), 'stochasticLinearRegressionState': ('stochasticLinearRegression', 'State'), 'groupBitmapXorState': ('groupBitmapXor', 'State'), 'quantilesExactState': ('quantilesExact', 'State'), 'quantilesBFloat16WeightedState': ('quantilesBFloat16Weighted', 'State'), 'histogramState': ('histogram', 'State'), 'uniqThetaState': ('uniqTheta', 'State'), 'stddevPopState': ('stddevPop', 'State'), 'anyState': ('any', 'State'), 'sequenceCountState': ('sequenceCount', 'State'), 'argMinState': ('argMin', 'State'), 'maxState': ('max', 'State'), 'windowFunnelState': ('windowFunnel', 'State'), 'varSampState': ('varSamp', 'State'), 'groupArraySampleState': ('groupArraySample', 'State'), 'boundingRatioState': ('boundingRatio', 'State'), 'groupArrayMovingSumState': ('groupArrayMovingSum', 'State'), 'mannWhitneyUTestState': ('mannWhitneyUTest', 'State'), 'quantilesTimingState': ('quantilesTiming', 'State'), 'skewPopState': ('skewPop', 'State'), 'topKState': ('topK', 'State'), 'quantileTDigestWeightedState': ('quantileTDigestWeighted', 'State'), 'quantileBFloat16WeightedState': ('quantileBFloat16Weighted', 'State'), 'avgState': ('avg', 'State'), 'quantileState': ('quantile', 'State'), 'argMaxMerge': ('argMax', 'Merge'), 'quantileExactMerge': ('quantileExact', 'Merge'), 'quantilesDeterministicMerge': ('quantilesDeterministic', 'Merge'), 'first_valueMerge': ('first_value', 'Merge'), 'stochasticLogisticRegressionMerge': ('stochasticLogisticRegression', 'Merge'), 'kurtSampMerge': ('kurtSamp', 'Merge'), 'cramersVMerge': ('cramersV', 'Merge'), 'quantilesGKMerge': ('quantilesGK', 'Merge'), 'uniqCombinedMerge': ('uniqCombined', 'Merge'), 'maxIntersectionsMerge': ('maxIntersections', 'Merge'), 'quantilesTimingWeightedMerge': ('quantilesTimingWeighted', 'Merge'), 'sumMerge': ('sum', 'Merge'), 'sumCountMerge': ('sumCount', 'Merge'), 'quantileGKMerge': ('quantileGK', 'Merge'), 'covarPopMerge': ('covarPop', 'Merge'), 'covarSampMerge': ('covarSamp', 'Merge'), 'sequenceNextNodeMerge': ('sequenceNextNode', 'Merge'), 'uniqCombined64Merge': ('uniqCombined64', 'Merge'), 'quantileTimingWeightedMerge': ('quantileTimingWeighted', 'Merge'), 'maxMapMerge': ('maxMap', 'Merge'), 'entropyMerge': ('entropy', 'Merge'), 'quantilesExactLowMerge': ('quantilesExactLow', 'Merge'), 'deltaSumMerge': ('deltaSum', 'Merge'), 'quantileDeterministicMerge': ('quantileDeterministic', 'Merge'), 'groupUniqArrayMerge': ('groupUniqArray', 'Merge'), 'categoricalInformationValueMerge': ('categoricalInformationValue', 'Merge'), 'deltaSumTimestampMerge': ('deltaSumTimestamp', 'Merge'), 'quantilesExactHighMerge': ('quantilesExactHigh', 'Merge'), 'uniqUpToMerge': ('uniqUpTo', 'Merge'), 'theilsUMerge': ('theilsU', 'Merge'), 'simpleLinearRegressionMerge': ('simpleLinearRegression', 'Merge'), 'anyLastMerge': ('anyLast', 'Merge'), 'anyHeavyMerge': ('anyHeavy', 'Merge'), 'topKWeightedMerge': ('topKWeighted', 'Merge'), 'exponentialTimeDecayedAvgMerge': ('exponentialTimeDecayedAvg', 'Merge'), 'meanZTestMerge': ('meanZTest', 'Merge'), 'largestTriangleThreeBucketsMerge': ('largestTriangleThreeBuckets', 'Merge'), 'groupArrayMerge': ('groupArray', 'Merge'), 'groupBitmapAndMerge': ('groupBitmapAnd', 'Merge'), 'groupArrayInsertAtMerge': ('groupArrayInsertAt', 'Merge'), 'varPopMerge': ('varPop', 'Merge'), 'exponentialMovingAverageMerge': ('exponentialMovingAverage', 'Merge'), 'quantilesExactWeightedMerge': ('quantilesExactWeighted', 'Merge'), 'maxIntersectionsPositionMerge': ('maxIntersectionsPosition', 'Merge'), 'uniqMerge': ('uniq', 'Merge'), 'contingencyMerge': ('contingency', 'Merge'), 'studentTTestMerge': ('studentTTest', 'Merge'), 'quantileTimingMerge': ('quantileTiming', 'Merge'), 'quantileBFloat16Merge': ('quantileBFloat16', 'Merge'), 'quantilesInterpolatedWeightedMerge': ('quantilesInterpolatedWeighted', 'Merge'), 'minMerge': ('min', 'Merge'), 'groupBitmapMerge': ('groupBitmap', 'Merge'), 'groupBitXorMerge': ('groupBitXor', 'Merge'), 'intervalLengthSumMerge': ('intervalLengthSum', 'Merge'), 'uniqHLL12Merge': ('uniqHLL12', 'Merge'), 'quantilesBFloat16Merge': ('quantilesBFloat16', 'Merge'), 'kurtPopMerge': ('kurtPop', 'Merge'), 'quantilesTDigestMerge': ('quantilesTDigest', 'Merge'), 'sumKahanMerge': ('sumKahan', 'Merge'), 'sumMapMerge': ('sumMap', 'Merge'), 'medianMerge': ('median', 'Merge'), 'welchTTestMerge': ('welchTTest', 'Merge'), 'sparkBarMerge': ('sparkBar', 'Merge'), 'retentionMerge': ('retention', 'Merge'), 'last_valueMerge': ('last_value', 'Merge'), 'corrMerge': ('corr', 'Merge'), 'skewSampMerge': ('skewSamp', 'Merge'), 'sumWithOverflowMerge': ('sumWithOverflow', 'Merge'), 'kolmogorovSmirnovTestMerge': ('kolmogorovSmirnovTest', 'Merge'), 'quantileExactLowMerge': ('quantileExactLow', 'Merge'), 'countMerge': ('count', 'Merge'), 'groupBitmapOrMerge': ('groupBitmapOr', 'Merge'), 'minMapMerge': ('minMap', 'Merge'), 'rankCorrMerge': ('rankCorr', 'Merge'), 'stddevSampMerge': ('stddevSamp', 'Merge'), 'cramersVBiasCorrectedMerge': ('cramersVBiasCorrected', 'Merge'), 'groupBitAndMerge': ('groupBitAnd', 'Merge'), 'groupArrayMovingAvgMerge': ('groupArrayMovingAvg', 'Merge'), 'groupBitOrMerge': ('groupBitOr', 'Merge'), 'quantileExactHighMerge': ('quantileExactHigh', 'Merge'), 'sequenceMatchMerge': ('sequenceMatch', 'Merge'), 'uniqExactMerge': ('uniqExact', 'Merge'), 'groupArrayLastMerge': ('groupArrayLast', 'Merge'), 'quantileExactWeightedMerge': ('quantileExactWeighted', 'Merge'), 'quantileInterpolatedWeightedMerge': ('quantileInterpolatedWeighted', 'Merge'), 'quantilesTDigestWeightedMerge': ('quantilesTDigestWeighted', 'Merge'), 'avgWeightedMerge': ('avgWeighted', 'Merge'), 'quantilesMerge': ('quantiles', 'Merge'), 'quantileTDigestMerge': ('quantileTDigest', 'Merge'), 'stochasticLinearRegressionMerge': ('stochasticLinearRegression', 'Merge'), 'groupBitmapXorMerge': ('groupBitmapXor', 'Merge'), 'quantilesExactMerge': ('quantilesExact', 'Merge'), 'quantilesBFloat16WeightedMerge': ('quantilesBFloat16Weighted', 'Merge'), 'histogramMerge': ('histogram', 'Merge'), 'uniqThetaMerge': ('uniqTheta', 'Merge'), 'stddevPopMerge': ('stddevPop', 'Merge'), 'anyMerge': ('any', 'Merge'), 'sequenceCountMerge': ('sequenceCount', 'Merge'), 'argMinMerge': ('argMin', 'Merge'), 'maxMerge': ('max', 'Merge'), 'windowFunnelMerge': ('windowFunnel', 'Merge'), 'varSampMerge': ('varSamp', 'Merge'), 'groupArraySampleMerge': ('groupArraySample', 'Merge'), 'boundingRatioMerge': ('boundingRatio', 'Merge'), 'groupArrayMovingSumMerge': ('groupArrayMovingSum', 'Merge'), 'mannWhitneyUTestMerge': ('mannWhitneyUTest', 'Merge'), 'quantilesTimingMerge': ('quantilesTiming', 'Merge'), 'skewPopMerge': ('skewPop', 'Merge'), 'topKMerge': ('topK', 'Merge'), 'quantileTDigestWeightedMerge': ('quantileTDigestWeighted', 'Merge'), 'quantileBFloat16WeightedMerge': ('quantileBFloat16Weighted', 'Merge'), 'avgMerge': ('avg', 'Merge'), 'quantileMerge': ('quantile', 'Merge'), 'argMaxMergeState': ('argMax', 'MergeState'), 'quantileExactMergeState': ('quantileExact', 'MergeState'), 'quantilesDeterministicMergeState': ('quantilesDeterministic', 'MergeState'), 'first_valueMergeState': ('first_value', 'MergeState'), 'stochasticLogisticRegressionMergeState': ('stochasticLogisticRegression', 'MergeState'), 'kurtSampMergeState': ('kurtSamp', 'MergeState'), 'cramersVMergeState': ('cramersV', 'MergeState'), 'quantilesGKMergeState': ('quantilesGK', 'MergeState'), 'uniqCombinedMergeState': ('uniqCombined', 'MergeState'), 'maxIntersectionsMergeState': ('maxIntersections', 'MergeState'), 'quantilesTimingWeightedMergeState': ('quantilesTimingWeighted', 'MergeState'), 'sumMergeState': ('sum', 'MergeState'), 'sumCountMergeState': ('sumCount', 'MergeState'), 'quantileGKMergeState': ('quantileGK', 'MergeState'), 'covarPopMergeState': ('covarPop', 'MergeState'), 'covarSampMergeState': ('covarSamp', 'MergeState'), 'sequenceNextNodeMergeState': ('sequenceNextNode', 'MergeState'), 'uniqCombined64MergeState': ('uniqCombined64', 'MergeState'), 'quantileTimingWeightedMergeState': ('quantileTimingWeighted', 'MergeState'), 'maxMapMergeState': ('maxMap', 'MergeState'), 'entropyMergeState': ('entropy', 'MergeState'), 'quantilesExactLowMergeState': ('quantilesExactLow', 'MergeState'), 'deltaSumMergeState': ('deltaSum', 'MergeState'), 'quantileDeterministicMergeState': ('quantileDeterministic', 'MergeState'), 'groupUniqArrayMergeState': ('groupUniqArray', 'MergeState'), 'categoricalInformationValueMergeState': ('categoricalInformationValue', 'MergeState'), 'deltaSumTimestampMergeState': ('deltaSumTimestamp', 'MergeState'), 'quantilesExactHighMergeState': ('quantilesExactHigh', 'MergeState'), 'uniqUpToMergeState': ('uniqUpTo', 'MergeState'), 'theilsUMergeState': ('theilsU', 'MergeState'), 'simpleLinearRegressionMergeState': ('simpleLinearRegression', 'MergeState'), 'anyLastMergeState': ('anyLast', 'MergeState'), 'anyHeavyMergeState': ('anyHeavy', 'MergeState'), 'topKWeightedMergeState': ('topKWeighted', 'MergeState'), 'exponentialTimeDecayedAvgMergeState': ('exponentialTimeDecayedAvg', 'MergeState'), 'meanZTestMergeState': ('meanZTest', 'MergeState'), 'largestTriangleThreeBucketsMergeState': ('largestTriangleThreeBuckets', 'MergeState'), 'groupArrayMergeState': ('groupArray', 'MergeState'), 'groupBitmapAndMergeState': ('groupBitmapAnd', 'MergeState'), 'groupArrayInsertAtMergeState': ('groupArrayInsertAt', 'MergeState'), 'varPopMergeState': ('varPop', 'MergeState'), 'exponentialMovingAverageMergeState': ('exponentialMovingAverage', 'MergeState'), 'quantilesExactWeightedMergeState': ('quantilesExactWeighted', 'MergeState'), 'maxIntersectionsPositionMergeState': ('maxIntersectionsPosition', 'MergeState'), 'uniqMergeState': ('uniq', 'MergeState'), 'contingencyMergeState': ('contingency', 'MergeState'), 'studentTTestMergeState': ('studentTTest', 'MergeState'), 'quantileTimingMergeState': ('quantileTiming', 'MergeState'), 'quantileBFloat16MergeState': ('quantileBFloat16', 'MergeState'), 'quantilesInterpolatedWeightedMergeState': ('quantilesInterpolatedWeighted', 'MergeState'), 'minMergeState': ('min', 'MergeState'), 'groupBitmapMergeState': ('groupBitmap', 'MergeState'), 'groupBitXorMergeState': ('groupBitXor', 'MergeState'), 'intervalLengthSumMergeState': ('intervalLengthSum', 'MergeState'), 'uniqHLL12MergeState': ('uniqHLL12', 'MergeState'), 'quantilesBFloat16MergeState': ('quantilesBFloat16', 'MergeState'), 'kurtPopMergeState': ('kurtPop', 'MergeState'), 'quantilesTDigestMergeState': ('quantilesTDigest', 'MergeState'), 'sumKahanMergeState': ('sumKahan', 'MergeState'), 'sumMapMergeState': ('sumMap', 'MergeState'), 'medianMergeState': ('median', 'MergeState'), 'welchTTestMergeState': ('welchTTest', 'MergeState'), 'sparkBarMergeState': ('sparkBar', 'MergeState'), 'retentionMergeState': ('retention', 'MergeState'), 'last_valueMergeState': ('last_value', 'MergeState'), 'corrMergeState': ('corr', 'MergeState'), 'skewSampMergeState': ('skewSamp', 'MergeState'), 'sumWithOverflowMergeState': ('sumWithOverflow', 'MergeState'), 'kolmogorovSmirnovTestMergeState': ('kolmogorovSmirnovTest', 'MergeState'), 'quantileExactLowMergeState': ('quantileExactLow', 'MergeState'), 'countMergeState': ('count', 'MergeState'), 'groupBitmapOrMergeState': ('groupBitmapOr', 'MergeState'), 'minMapMergeState': ('minMap', 'MergeState'), 'rankCorrMergeState': ('rankCorr', 'MergeState'), 'stddevSampMergeState': ('stddevSamp', 'MergeState'), 'cramersVBiasCorrectedMergeState': ('cramersVBiasCorrected', 'MergeState'), 'groupBitAndMergeState': ('groupBitAnd', 'MergeState'), 'groupArrayMovingAvgMergeState': ('groupArrayMovingAvg', 'MergeState'), 'groupBitOrMergeState': ('groupBitOr', 'MergeState'), 'quantileExactHighMergeState': ('quantileExactHigh', 'MergeState'), 'sequenceMatchMergeState': ('sequenceMatch', 'MergeState'), 'uniqExactMergeState': ('uniqExact', 'MergeState'), 'groupArrayLastMergeState': ('groupArrayLast', 'MergeState'), 'quantileExactWeightedMergeState': ('quantileExactWeighted', 'MergeState'), 'quantileInterpolatedWeightedMergeState': ('quantileInterpolatedWeighted', 'MergeState'), 'quantilesTDigestWeightedMergeState': ('quantilesTDigestWeighted', 'MergeState'), 'avgWeightedMergeState': ('avgWeighted', 'MergeState'), 'quantilesMergeState': ('quantiles', 'MergeState'), 'quantileTDigestMergeState': ('quantileTDigest', 'MergeState'), 'stochasticLinearRegressionMergeState': ('stochasticLinearRegression', 'MergeState'), 'groupBitmapXorMergeState': ('groupBitmapXor', 'MergeState'), 'quantilesExactMergeState': ('quantilesExact', 'MergeState'), 'quantilesBFloat16WeightedMergeState': ('quantilesBFloat16Weighted', 'MergeState'), 'histogramMergeState': ('histogram', 'MergeState'), 'uniqThetaMergeState': ('uniqTheta', 'MergeState'), 'stddevPopMergeState': ('stddevPop', 'MergeState'), 'anyMergeState': ('any', 'MergeState'), 'sequenceCountMergeState': ('sequenceCount', 'MergeState'), 'argMinMergeState': ('argMin', 'MergeState'), 'maxMergeState': ('max', 'MergeState'), 'windowFunnelMergeState': ('windowFunnel', 'MergeState'), 'varSampMergeState': ('varSamp', 'MergeState'), 'groupArraySampleMergeState': ('groupArraySample', 'MergeState'), 'boundingRatioMergeState': ('boundingRatio', 'MergeState'), 'groupArrayMovingSumMergeState': ('groupArrayMovingSum', 'MergeState'), 'mannWhitneyUTestMergeState': ('mannWhitneyUTest', 'MergeState'), 'quantilesTimingMergeState': ('quantilesTiming', 'MergeState'), 'skewPopMergeState': ('skewPop', 'MergeState'), 'topKMergeState': ('topK', 'MergeState'), 'quantileTDigestWeightedMergeState': ('quantileTDigestWeighted', 'MergeState'), 'quantileBFloat16WeightedMergeState': ('quantileBFloat16Weighted', 'MergeState'), 'avgMergeState': ('avg', 'MergeState'), 'quantileMergeState': ('quantile', 'MergeState'), 'argMaxForEach': ('argMax', 'ForEach'), 'quantileExactForEach': ('quantileExact', 'ForEach'), 'quantilesDeterministicForEach': ('quantilesDeterministic', 'ForEach'), 'first_valueForEach': ('first_value', 'ForEach'), 'stochasticLogisticRegressionForEach': ('stochasticLogisticRegression', 'ForEach'), 'kurtSampForEach': ('kurtSamp', 'ForEach'), 'cramersVForEach': ('cramersV', 'ForEach'), 'quantilesGKForEach': ('quantilesGK', 'ForEach'), 'uniqCombinedForEach': ('uniqCombined', 'ForEach'), 'maxIntersectionsForEach': ('maxIntersections', 'ForEach'), 'quantilesTimingWeightedForEach': ('quantilesTimingWeighted', 'ForEach'), 'sumForEach': ('sum', 'ForEach'), 'sumCountForEach': ('sumCount', 'ForEach'), 'quantileGKForEach': ('quantileGK', 'ForEach'), 'covarPopForEach': ('covarPop', 'ForEach'), 'covarSampForEach': ('covarSamp', 'ForEach'), 'sequenceNextNodeForEach': ('sequenceNextNode', 'ForEach'), 'uniqCombined64ForEach': ('uniqCombined64', 'ForEach'), 'quantileTimingWeightedForEach': ('quantileTimingWeighted', 'ForEach'), 'maxMapForEach': ('maxMap', 'ForEach'), 'entropyForEach': ('entropy', 'ForEach'), 'quantilesExactLowForEach': ('quantilesExactLow', 'ForEach'), 'deltaSumForEach': ('deltaSum', 'ForEach'), 'quantileDeterministicForEach': ('quantileDeterministic', 'ForEach'), 'groupUniqArrayForEach': ('groupUniqArray', 'ForEach'), 'categoricalInformationValueForEach': ('categoricalInformationValue', 'ForEach'), 'deltaSumTimestampForEach': ('deltaSumTimestamp', 'ForEach'), 'quantilesExactHighForEach': ('quantilesExactHigh', 'ForEach'), 'uniqUpToForEach': ('uniqUpTo', 'ForEach'), 'theilsUForEach': ('theilsU', 'ForEach'), 'simpleLinearRegressionForEach': ('simpleLinearRegression', 'ForEach'), 'anyLastForEach': ('anyLast', 'ForEach'), 'anyHeavyForEach': ('anyHeavy', 'ForEach'), 'topKWeightedForEach': ('topKWeighted', 'ForEach'), 'exponentialTimeDecayedAvgForEach': ('exponentialTimeDecayedAvg', 'ForEach'), 'meanZTestForEach': ('meanZTest', 'ForEach'), 'largestTriangleThreeBucketsForEach': ('largestTriangleThreeBuckets', 'ForEach'), 'groupArrayForEach': ('groupArray', 'ForEach'), 'groupBitmapAndForEach': ('groupBitmapAnd', 'ForEach'), 'groupArrayInsertAtForEach': ('groupArrayInsertAt', 'ForEach'), 'varPopForEach': ('varPop', 'ForEach'), 'exponentialMovingAverageForEach': ('exponentialMovingAverage', 'ForEach'), 'quantilesExactWeightedForEach': ('quantilesExactWeighted', 'ForEach'), 'maxIntersectionsPositionForEach': ('maxIntersectionsPosition', 'ForEach'), 'uniqForEach': ('uniq', 'ForEach'), 'contingencyForEach': ('contingency', 'ForEach'), 'studentTTestForEach': ('studentTTest', 'ForEach'), 'quantileTimingForEach': ('quantileTiming', 'ForEach'), 'quantileBFloat16ForEach': ('quantileBFloat16', 'ForEach'), 'quantilesInterpolatedWeightedForEach': ('quantilesInterpolatedWeighted', 'ForEach'), 'minForEach': ('min', 'ForEach'), 'groupBitmapForEach': ('groupBitmap', 'ForEach'), 'groupBitXorForEach': ('groupBitXor', 'ForEach'), 'intervalLengthSumForEach': ('intervalLengthSum', 'ForEach'), 'uniqHLL12ForEach': ('uniqHLL12', 'ForEach'), 'quantilesBFloat16ForEach': ('quantilesBFloat16', 'ForEach'), 'kurtPopForEach': ('kurtPop', 'ForEach'), 'quantilesTDigestForEach': ('quantilesTDigest', 'ForEach'), 'sumKahanForEach': ('sumKahan', 'ForEach'), 'sumMapForEach': ('sumMap', 'ForEach'), 'medianForEach': ('median', 'ForEach'), 'welchTTestForEach': ('welchTTest', 'ForEach'), 'sparkBarForEach': ('sparkBar', 'ForEach'), 'retentionForEach': ('retention', 'ForEach'), 'last_valueForEach': ('last_value', 'ForEach'), 'corrForEach': ('corr', 'ForEach'), 'skewSampForEach': ('skewSamp', 'ForEach'), 'sumWithOverflowForEach': ('sumWithOverflow', 'ForEach'), 'kolmogorovSmirnovTestForEach': ('kolmogorovSmirnovTest', 'ForEach'), 'quantileExactLowForEach': ('quantileExactLow', 'ForEach'), 'countForEach': ('count', 'ForEach'), 'groupBitmapOrForEach': ('groupBitmapOr', 'ForEach'), 'minMapForEach': ('minMap', 'ForEach'), 'rankCorrForEach': ('rankCorr', 'ForEach'), 'stddevSampForEach': ('stddevSamp', 'ForEach'), 'cramersVBiasCorrectedForEach': ('cramersVBiasCorrected', 'ForEach'), 'groupBitAndForEach': ('groupBitAnd', 'ForEach'), 'groupArrayMovingAvgForEach': ('groupArrayMovingAvg', 'ForEach'), 'groupBitOrForEach': ('groupBitOr', 'ForEach'), 'quantileExactHighForEach': ('quantileExactHigh', 'ForEach'), 'sequenceMatchForEach': ('sequenceMatch', 'ForEach'), 'uniqExactForEach': ('uniqExact', 'ForEach'), 'groupArrayLastForEach': ('groupArrayLast', 'ForEach'), 'quantileExactWeightedForEach': ('quantileExactWeighted', 'ForEach'), 'quantileInterpolatedWeightedForEach': ('quantileInterpolatedWeighted', 'ForEach'), 'quantilesTDigestWeightedForEach': ('quantilesTDigestWeighted', 'ForEach'), 'avgWeightedForEach': ('avgWeighted', 'ForEach'), 'quantilesForEach': ('quantiles', 'ForEach'), 'quantileTDigestForEach': ('quantileTDigest', 'ForEach'), 'stochasticLinearRegressionForEach': ('stochasticLinearRegression', 'ForEach'), 'groupBitmapXorForEach': ('groupBitmapXor', 'ForEach'), 'quantilesExactForEach': ('quantilesExact', 'ForEach'), 'quantilesBFloat16WeightedForEach': ('quantilesBFloat16Weighted', 'ForEach'), 'histogramForEach': ('histogram', 'ForEach'), 'uniqThetaForEach': ('uniqTheta', 'ForEach'), 'stddevPopForEach': ('stddevPop', 'ForEach'), 'anyForEach': ('any', 'ForEach'), 'sequenceCountForEach': ('sequenceCount', 'ForEach'), 'argMinForEach': ('argMin', 'ForEach'), 'maxForEach': ('max', 'ForEach'), 'windowFunnelForEach': ('windowFunnel', 'ForEach'), 'varSampForEach': ('varSamp', 'ForEach'), 'groupArraySampleForEach': ('groupArraySample', 'ForEach'), 'boundingRatioForEach': ('boundingRatio', 'ForEach'), 'groupArrayMovingSumForEach': ('groupArrayMovingSum', 'ForEach'), 'mannWhitneyUTestForEach': ('mannWhitneyUTest', 'ForEach'), 'quantilesTimingForEach': ('quantilesTiming', 'ForEach'), 'skewPopForEach': ('skewPop', 'ForEach'), 'topKForEach': ('topK', 'ForEach'), 'quantileTDigestWeightedForEach': ('quantileTDigestWeighted', 'ForEach'), 'quantileBFloat16WeightedForEach': ('quantileBFloat16Weighted', 'ForEach'), 'avgForEach': ('avg', 'ForEach'), 'quantileForEach': ('quantile', 'ForEach'), 'argMaxDistinct': ('argMax', 'Distinct'), 'quantileExactDistinct': ('quantileExact', 'Distinct'), 'quantilesDeterministicDistinct': ('quantilesDeterministic', 'Distinct'), 'first_valueDistinct': ('first_value', 'Distinct'), 'stochasticLogisticRegressionDistinct': ('stochasticLogisticRegression', 'Distinct'), 'kurtSampDistinct': ('kurtSamp', 'Distinct'), 'cramersVDistinct': ('cramersV', 'Distinct'), 'quantilesGKDistinct': ('quantilesGK', 'Distinct'), 'uniqCombinedDistinct': ('uniqCombined', 'Distinct'), 'maxIntersectionsDistinct': ('maxIntersections', 'Distinct'), 'quantilesTimingWeightedDistinct': ('quantilesTimingWeighted', 'Distinct'), 'sumDistinct': ('sum', 'Distinct'), 'sumCountDistinct': ('sumCount', 'Distinct'), 'quantileGKDistinct': ('quantileGK', 'Distinct'), 'covarPopDistinct': ('covarPop', 'Distinct'), 'covarSampDistinct': ('covarSamp', 'Distinct'), 'sequenceNextNodeDistinct': ('sequenceNextNode', 'Distinct'), 'uniqCombined64Distinct': ('uniqCombined64', 'Distinct'), 'quantileTimingWeightedDistinct': ('quantileTimingWeighted', 'Distinct'), 'maxMapDistinct': ('maxMap', 'Distinct'), 'entropyDistinct': ('entropy', 'Distinct'), 'quantilesExactLowDistinct': ('quantilesExactLow', 'Distinct'), 'deltaSumDistinct': ('deltaSum', 'Distinct'), 'quantileDeterministicDistinct': ('quantileDeterministic', 'Distinct'), 'groupUniqArrayDistinct': ('groupUniqArray', 'Distinct'), 'categoricalInformationValueDistinct': ('categoricalInformationValue', 'Distinct'), 'deltaSumTimestampDistinct': ('deltaSumTimestamp', 'Distinct'), 'quantilesExactHighDistinct': ('quantilesExactHigh', 'Distinct'), 'uniqUpToDistinct': ('uniqUpTo', 'Distinct'), 'theilsUDistinct': ('theilsU', 'Distinct'), 'simpleLinearRegressionDistinct': ('simpleLinearRegression', 'Distinct'), 'anyLastDistinct': ('anyLast', 'Distinct'), 'anyHeavyDistinct': ('anyHeavy', 'Distinct'), 'topKWeightedDistinct': ('topKWeighted', 'Distinct'), 'exponentialTimeDecayedAvgDistinct': ('exponentialTimeDecayedAvg', 'Distinct'), 'meanZTestDistinct': ('meanZTest', 'Distinct'), 'largestTriangleThreeBucketsDistinct': ('largestTriangleThreeBuckets', 'Distinct'), 'groupArrayDistinct': ('groupArray', 'Distinct'), 'groupBitmapAndDistinct': ('groupBitmapAnd', 'Distinct'), 'groupArrayInsertAtDistinct': ('groupArrayInsertAt', 'Distinct'), 'varPopDistinct': ('varPop', 'Distinct'), 'exponentialMovingAverageDistinct': ('exponentialMovingAverage', 'Distinct'), 'quantilesExactWeightedDistinct': ('quantilesExactWeighted', 'Distinct'), 'maxIntersectionsPositionDistinct': ('maxIntersectionsPosition', 'Distinct'), 'uniqDistinct': ('uniq', 'Distinct'), 'contingencyDistinct': ('contingency', 'Distinct'), 'studentTTestDistinct': ('studentTTest', 'Distinct'), 'quantileTimingDistinct': ('quantileTiming', 'Distinct'), 'quantileBFloat16Distinct': ('quantileBFloat16', 'Distinct'), 'quantilesInterpolatedWeightedDistinct': ('quantilesInterpolatedWeighted', 'Distinct'), 'minDistinct': ('min', 'Distinct'), 'groupBitmapDistinct': ('groupBitmap', 'Distinct'), 'groupBitXorDistinct': ('groupBitXor', 'Distinct'), 'intervalLengthSumDistinct': ('intervalLengthSum', 'Distinct'), 'uniqHLL12Distinct': ('uniqHLL12', 'Distinct'), 'quantilesBFloat16Distinct': ('quantilesBFloat16', 'Distinct'), 'kurtPopDistinct': ('kurtPop', 'Distinct'), 'quantilesTDigestDistinct': ('quantilesTDigest', 'Distinct'), 'sumKahanDistinct': ('sumKahan', 'Distinct'), 'sumMapDistinct': ('sumMap', 'Distinct'), 'medianDistinct': ('median', 'Distinct'), 'welchTTestDistinct': ('welchTTest', 'Distinct'), 'sparkBarDistinct': ('sparkBar', 'Distinct'), 'retentionDistinct': ('retention', 'Distinct'), 'last_valueDistinct': ('last_value', 'Distinct'), 'corrDistinct': ('corr', 'Distinct'), 'skewSampDistinct': ('skewSamp', 'Distinct'), 'sumWithOverflowDistinct': ('sumWithOverflow', 'Distinct'), 'kolmogorovSmirnovTestDistinct': ('kolmogorovSmirnovTest', 'Distinct'), 'quantileExactLowDistinct': ('quantileExactLow', 'Distinct'), 'countDistinct': ('count', 'Distinct'), 'groupBitmapOrDistinct': ('groupBitmapOr', 'Distinct'), 'minMapDistinct': ('minMap', 'Distinct'), 'rankCorrDistinct': ('rankCorr', 'Distinct'), 'stddevSampDistinct': ('stddevSamp', 'Distinct'), 'cramersVBiasCorrectedDistinct': ('cramersVBiasCorrected', 'Distinct'), 'groupBitAndDistinct': ('groupBitAnd', 'Distinct'), 'groupArrayMovingAvgDistinct': ('groupArrayMovingAvg', 'Distinct'), 'groupBitOrDistinct': ('groupBitOr', 'Distinct'), 'quantileExactHighDistinct': ('quantileExactHigh', 'Distinct'), 'sequenceMatchDistinct': ('sequenceMatch', 'Distinct'), 'uniqExactDistinct': ('uniqExact', 'Distinct'), 'groupArrayLastDistinct': ('groupArrayLast', 'Distinct'), 'quantileExactWeightedDistinct': ('quantileExactWeighted', 'Distinct'), 'quantileInterpolatedWeightedDistinct': ('quantileInterpolatedWeighted', 'Distinct'), 'quantilesTDigestWeightedDistinct': ('quantilesTDigestWeighted', 'Distinct'), 'avgWeightedDistinct': ('avgWeighted', 'Distinct'), 'quantilesDistinct': ('quantiles', 'Distinct'), 'quantileTDigestDistinct': ('quantileTDigest', 'Distinct'), 'stochasticLinearRegressionDistinct': ('stochasticLinearRegression', 'Distinct'), 'groupBitmapXorDistinct': ('groupBitmapXor', 'Distinct'), 'quantilesExactDistinct': ('quantilesExact', 'Distinct'), 'quantilesBFloat16WeightedDistinct': ('quantilesBFloat16Weighted', 'Distinct'), 'histogramDistinct': ('histogram', 'Distinct'), 'uniqThetaDistinct': ('uniqTheta', 'Distinct'), 'stddevPopDistinct': ('stddevPop', 'Distinct'), 'anyDistinct': ('any', 'Distinct'), 'sequenceCountDistinct': ('sequenceCount', 'Distinct'), 'argMinDistinct': ('argMin', 'Distinct'), 'maxDistinct': ('max', 'Distinct'), 'windowFunnelDistinct': ('windowFunnel', 'Distinct'), 'varSampDistinct': ('varSamp', 'Distinct'), 'groupArraySampleDistinct': ('groupArraySample', 'Distinct'), 'boundingRatioDistinct': ('boundingRatio', 'Distinct'), 'groupArrayMovingSumDistinct': ('groupArrayMovingSum', 'Distinct'), 'mannWhitneyUTestDistinct': ('mannWhitneyUTest', 'Distinct'), 'quantilesTimingDistinct': ('quantilesTiming', 'Distinct'), 'skewPopDistinct': ('skewPop', 'Distinct'), 'topKDistinct': ('topK', 'Distinct'), 'quantileTDigestWeightedDistinct': ('quantileTDigestWeighted', 'Distinct'), 'quantileBFloat16WeightedDistinct': ('quantileBFloat16Weighted', 'Distinct'), 'avgDistinct': ('avg', 'Distinct'), 'quantileDistinct': ('quantile', 'Distinct'), 'argMaxOrDefault': ('argMax', 'OrDefault'), 'quantileExactOrDefault': ('quantileExact', 'OrDefault'), 'quantilesDeterministicOrDefault': ('quantilesDeterministic', 'OrDefault'), 'first_valueOrDefault': ('first_value', 'OrDefault'), 'stochasticLogisticRegressionOrDefault': ('stochasticLogisticRegression', 'OrDefault'), 'kurtSampOrDefault': ('kurtSamp', 'OrDefault'), 'cramersVOrDefault': ('cramersV', 'OrDefault'), 'quantilesGKOrDefault': ('quantilesGK', 'OrDefault'), 'uniqCombinedOrDefault': ('uniqCombined', 'OrDefault'), 'maxIntersectionsOrDefault': ('maxIntersections', 'OrDefault'), 'quantilesTimingWeightedOrDefault': ('quantilesTimingWeighted', 'OrDefault'), 'sumOrDefault': ('sum', 'OrDefault'), 'sumCountOrDefault': ('sumCount', 'OrDefault'), 'quantileGKOrDefault': ('quantileGK', 'OrDefault'), 'covarPopOrDefault': ('covarPop', 'OrDefault'), 'covarSampOrDefault': ('covarSamp', 'OrDefault'), 'sequenceNextNodeOrDefault': ('sequenceNextNode', 'OrDefault'), 'uniqCombined64OrDefault': ('uniqCombined64', 'OrDefault'), 'quantileTimingWeightedOrDefault': ('quantileTimingWeighted', 'OrDefault'), 'maxMapOrDefault': ('maxMap', 'OrDefault'), 'entropyOrDefault': ('entropy', 'OrDefault'), 'quantilesExactLowOrDefault': ('quantilesExactLow', 'OrDefault'), 'deltaSumOrDefault': ('deltaSum', 'OrDefault'), 'quantileDeterministicOrDefault': ('quantileDeterministic', 'OrDefault'), 'groupUniqArrayOrDefault': ('groupUniqArray', 'OrDefault'), 'categoricalInformationValueOrDefault': ('categoricalInformationValue', 'OrDefault'), 'deltaSumTimestampOrDefault': ('deltaSumTimestamp', 'OrDefault'), 'quantilesExactHighOrDefault': ('quantilesExactHigh', 'OrDefault'), 'uniqUpToOrDefault': ('uniqUpTo', 'OrDefault'), 'theilsUOrDefault': ('theilsU', 'OrDefault'), 'simpleLinearRegressionOrDefault': ('simpleLinearRegression', 'OrDefault'), 'anyLastOrDefault': ('anyLast', 'OrDefault'), 'anyHeavyOrDefault': ('anyHeavy', 'OrDefault'), 'topKWeightedOrDefault': ('topKWeighted', 'OrDefault'), 'exponentialTimeDecayedAvgOrDefault': ('exponentialTimeDecayedAvg', 'OrDefault'), 'meanZTestOrDefault': ('meanZTest', 'OrDefault'), 'largestTriangleThreeBucketsOrDefault': ('largestTriangleThreeBuckets', 'OrDefault'), 'groupArrayOrDefault': ('groupArray', 'OrDefault'), 'groupBitmapAndOrDefault': ('groupBitmapAnd', 'OrDefault'), 'groupArrayInsertAtOrDefault': ('groupArrayInsertAt', 'OrDefault'), 'varPopOrDefault': ('varPop', 'OrDefault'), 'exponentialMovingAverageOrDefault': ('exponentialMovingAverage', 'OrDefault'), 'quantilesExactWeightedOrDefault': ('quantilesExactWeighted', 'OrDefault'), 'maxIntersectionsPositionOrDefault': ('maxIntersectionsPosition', 'OrDefault'), 'uniqOrDefault': ('uniq', 'OrDefault'), 'contingencyOrDefault': ('contingency', 'OrDefault'), 'studentTTestOrDefault': ('studentTTest', 'OrDefault'), 'quantileTimingOrDefault': ('quantileTiming', 'OrDefault'), 'quantileBFloat16OrDefault': ('quantileBFloat16', 'OrDefault'), 'quantilesInterpolatedWeightedOrDefault': ('quantilesInterpolatedWeighted', 'OrDefault'), 'minOrDefault': ('min', 'OrDefault'), 'groupBitmapOrDefault': ('groupBitmap', 'OrDefault'), 'groupBitXorOrDefault': ('groupBitXor', 'OrDefault'), 'intervalLengthSumOrDefault': ('intervalLengthSum', 'OrDefault'), 'uniqHLL12OrDefault': ('uniqHLL12', 'OrDefault'), 'quantilesBFloat16OrDefault': ('quantilesBFloat16', 'OrDefault'), 'kurtPopOrDefault': ('kurtPop', 'OrDefault'), 'quantilesTDigestOrDefault': ('quantilesTDigest', 'OrDefault'), 'sumKahanOrDefault': ('sumKahan', 'OrDefault'), 'sumMapOrDefault': ('sumMap', 'OrDefault'), 'medianOrDefault': ('median', 'OrDefault'), 'welchTTestOrDefault': ('welchTTest', 'OrDefault'), 'sparkBarOrDefault': ('sparkBar', 'OrDefault'), 'retentionOrDefault': ('retention', 'OrDefault'), 'last_valueOrDefault': ('last_value', 'OrDefault'), 'corrOrDefault': ('corr', 'OrDefault'), 'skewSampOrDefault': ('skewSamp', 'OrDefault'), 'sumWithOverflowOrDefault': ('sumWithOverflow', 'OrDefault'), 'kolmogorovSmirnovTestOrDefault': ('kolmogorovSmirnovTest', 'OrDefault'), 'quantileExactLowOrDefault': ('quantileExactLow', 'OrDefault'), 'countOrDefault': ('count', 'OrDefault'), 'groupBitmapOrOrDefault': ('groupBitmapOr', 'OrDefault'), 'minMapOrDefault': ('minMap', 'OrDefault'), 'rankCorrOrDefault': ('rankCorr', 'OrDefault'), 'stddevSampOrDefault': ('stddevSamp', 'OrDefault'), 'cramersVBiasCorrectedOrDefault': ('cramersVBiasCorrected', 'OrDefault'), 'groupBitAndOrDefault': ('groupBitAnd', 'OrDefault'), 'groupArrayMovingAvgOrDefault': ('groupArrayMovingAvg', 'OrDefault'), 'groupBitOrOrDefault': ('groupBitOr', 'OrDefault'), 'quantileExactHighOrDefault': ('quantileExactHigh', 'OrDefault'), 'sequenceMatchOrDefault': ('sequenceMatch', 'OrDefault'), 'uniqExactOrDefault': ('uniqExact', 'OrDefault'), 'groupArrayLastOrDefault': ('groupArrayLast', 'OrDefault'), 'quantileExactWeightedOrDefault': ('quantileExactWeighted', 'OrDefault'), 'quantileInterpolatedWeightedOrDefault': ('quantileInterpolatedWeighted', 'OrDefault'), 'quantilesTDigestWeightedOrDefault': ('quantilesTDigestWeighted', 'OrDefault'), 'avgWeightedOrDefault': ('avgWeighted', 'OrDefault'), 'quantilesOrDefault': ('quantiles', 'OrDefault'), 'quantileTDigestOrDefault': ('quantileTDigest', 'OrDefault'), 'stochasticLinearRegressionOrDefault': ('stochasticLinearRegression', 'OrDefault'), 'groupBitmapXorOrDefault': ('groupBitmapXor', 'OrDefault'), 'quantilesExactOrDefault': ('quantilesExact', 'OrDefault'), 'quantilesBFloat16WeightedOrDefault': ('quantilesBFloat16Weighted', 'OrDefault'), 'histogramOrDefault': ('histogram', 'OrDefault'), 'uniqThetaOrDefault': ('uniqTheta', 'OrDefault'), 'stddevPopOrDefault': ('stddevPop', 'OrDefault'), 'anyOrDefault': ('any', 'OrDefault'), 'sequenceCountOrDefault': ('sequenceCount', 'OrDefault'), 'argMinOrDefault': ('argMin', 'OrDefault'), 'maxOrDefault': ('max', 'OrDefault'), 'windowFunnelOrDefault': ('windowFunnel', 'OrDefault'), 'varSampOrDefault': ('varSamp', 'OrDefault'), 'groupArraySampleOrDefault': ('groupArraySample', 'OrDefault'), 'boundingRatioOrDefault': ('boundingRatio', 'OrDefault'), 'groupArrayMovingSumOrDefault': ('groupArrayMovingSum', 'OrDefault'), 'mannWhitneyUTestOrDefault': ('mannWhitneyUTest', 'OrDefault'), 'quantilesTimingOrDefault': ('quantilesTiming', 'OrDefault'), 'skewPopOrDefault': ('skewPop', 'OrDefault'), 'topKOrDefault': ('topK', 'OrDefault'), 'quantileTDigestWeightedOrDefault': ('quantileTDigestWeighted', 'OrDefault'), 'quantileBFloat16WeightedOrDefault': ('quantileBFloat16Weighted', 'OrDefault'), 'avgOrDefault': ('avg', 'OrDefault'), 'quantileOrDefault': ('quantile', 'OrDefault'), 'argMaxOrNull': ('argMax', 'OrNull'), 'quantileExactOrNull': ('quantileExact', 'OrNull'), 'quantilesDeterministicOrNull': ('quantilesDeterministic', 'OrNull'), 'first_valueOrNull': ('first_value', 'OrNull'), 'stochasticLogisticRegressionOrNull': ('stochasticLogisticRegression', 'OrNull'), 'kurtSampOrNull': ('kurtSamp', 'OrNull'), 'cramersVOrNull': ('cramersV', 'OrNull'), 'quantilesGKOrNull': ('quantilesGK', 'OrNull'), 'uniqCombinedOrNull': ('uniqCombined', 'OrNull'), 'maxIntersectionsOrNull': ('maxIntersections', 'OrNull'), 'quantilesTimingWeightedOrNull': ('quantilesTimingWeighted', 'OrNull'), 'sumOrNull': ('sum', 'OrNull'), 'sumCountOrNull': ('sumCount', 'OrNull'), 'quantileGKOrNull': ('quantileGK', 'OrNull'), 'covarPopOrNull': ('covarPop', 'OrNull'), 'covarSampOrNull': ('covarSamp', 'OrNull'), 'sequenceNextNodeOrNull': ('sequenceNextNode', 'OrNull'), 'uniqCombined64OrNull': ('uniqCombined64', 'OrNull'), 'quantileTimingWeightedOrNull': ('quantileTimingWeighted', 'OrNull'), 'maxMapOrNull': ('maxMap', 'OrNull'), 'entropyOrNull': ('entropy', 'OrNull'), 'quantilesExactLowOrNull': ('quantilesExactLow', 'OrNull'), 'deltaSumOrNull': ('deltaSum', 'OrNull'), 'quantileDeterministicOrNull': ('quantileDeterministic', 'OrNull'), 'groupUniqArrayOrNull': ('groupUniqArray', 'OrNull'), 'categoricalInformationValueOrNull': ('categoricalInformationValue', 'OrNull'), 'deltaSumTimestampOrNull': ('deltaSumTimestamp', 'OrNull'), 'quantilesExactHighOrNull': ('quantilesExactHigh', 'OrNull'), 'uniqUpToOrNull': ('uniqUpTo', 'OrNull'), 'theilsUOrNull': ('theilsU', 'OrNull'), 'simpleLinearRegressionOrNull': ('simpleLinearRegression', 'OrNull'), 'anyLastOrNull': ('anyLast', 'OrNull'), 'anyHeavyOrNull': ('anyHeavy', 'OrNull'), 'topKWeightedOrNull': ('topKWeighted', 'OrNull'), 'exponentialTimeDecayedAvgOrNull': ('exponentialTimeDecayedAvg', 'OrNull'), 'meanZTestOrNull': ('meanZTest', 'OrNull'), 'largestTriangleThreeBucketsOrNull': ('largestTriangleThreeBuckets', 'OrNull'), 'groupArrayOrNull': ('groupArray', 'OrNull'), 'groupBitmapAndOrNull': ('groupBitmapAnd', 'OrNull'), 'groupArrayInsertAtOrNull': ('groupArrayInsertAt', 'OrNull'), 'varPopOrNull': ('varPop', 'OrNull'), 'exponentialMovingAverageOrNull': ('exponentialMovingAverage', 'OrNull'), 'quantilesExactWeightedOrNull': ('quantilesExactWeighted', 'OrNull'), 'maxIntersectionsPositionOrNull': ('maxIntersectionsPosition', 'OrNull'), 'uniqOrNull': ('uniq', 'OrNull'), 'contingencyOrNull': ('contingency', 'OrNull'), 'studentTTestOrNull': ('studentTTest', 'OrNull'), 'quantileTimingOrNull': ('quantileTiming', 'OrNull'), 'quantileBFloat16OrNull': ('quantileBFloat16', 'OrNull'), 'quantilesInterpolatedWeightedOrNull': ('quantilesInterpolatedWeighted', 'OrNull'), 'minOrNull': ('min', 'OrNull'), 'groupBitmapOrNull': ('groupBitmap', 'OrNull'), 'groupBitXorOrNull': ('groupBitXor', 'OrNull'), 'intervalLengthSumOrNull': ('intervalLengthSum', 'OrNull'), 'uniqHLL12OrNull': ('uniqHLL12', 'OrNull'), 'quantilesBFloat16OrNull': ('quantilesBFloat16', 'OrNull'), 'kurtPopOrNull': ('kurtPop', 'OrNull'), 'quantilesTDigestOrNull': ('quantilesTDigest', 'OrNull'), 'sumKahanOrNull': ('sumKahan', 'OrNull'), 'sumMapOrNull': ('sumMap', 'OrNull'), 'medianOrNull': ('median', 'OrNull'), 'welchTTestOrNull': ('welchTTest', 'OrNull'), 'sparkBarOrNull': ('sparkBar', 'OrNull'), 'retentionOrNull': ('retention', 'OrNull'), 'last_valueOrNull': ('last_value', 'OrNull'), 'corrOrNull': ('corr', 'OrNull'), 'skewSampOrNull': ('skewSamp', 'OrNull'), 'sumWithOverflowOrNull': ('sumWithOverflow', 'OrNull'), 'kolmogorovSmirnovTestOrNull': ('kolmogorovSmirnovTest', 'OrNull'), 'quantileExactLowOrNull': ('quantileExactLow', 'OrNull'), 'countOrNull': ('count', 'OrNull'), 'groupBitmapOrOrNull': ('groupBitmapOr', 'OrNull'), 'minMapOrNull': ('minMap', 'OrNull'), 'rankCorrOrNull': ('rankCorr', 'OrNull'), 'stddevSampOrNull': ('stddevSamp', 'OrNull'), 'cramersVBiasCorrectedOrNull': ('cramersVBiasCorrected', 'OrNull'), 'groupBitAndOrNull': ('groupBitAnd', 'OrNull'), 'groupArrayMovingAvgOrNull': ('groupArrayMovingAvg', 'OrNull'), 'groupBitOrOrNull': ('groupBitOr', 'OrNull'), 'quantileExactHighOrNull': ('quantileExactHigh', 'OrNull'), 'sequenceMatchOrNull': ('sequenceMatch', 'OrNull'), 'uniqExactOrNull': ('uniqExact', 'OrNull'), 'groupArrayLastOrNull': ('groupArrayLast', 'OrNull'), 'quantileExactWeightedOrNull': ('quantileExactWeighted', 'OrNull'), 'quantileInterpolatedWeightedOrNull': ('quantileInterpolatedWeighted', 'OrNull'), 'quantilesTDigestWeightedOrNull': ('quantilesTDigestWeighted', 'OrNull'), 'avgWeightedOrNull': ('avgWeighted', 'OrNull'), 'quantilesOrNull': ('quantiles', 'OrNull'), 'quantileTDigestOrNull': ('quantileTDigest', 'OrNull'), 'stochasticLinearRegressionOrNull': ('stochasticLinearRegression', 'OrNull'), 'groupBitmapXorOrNull': ('groupBitmapXor', 'OrNull'), 'quantilesExactOrNull': ('quantilesExact', 'OrNull'), 'quantilesBFloat16WeightedOrNull': ('quantilesBFloat16Weighted', 'OrNull'), 'histogramOrNull': ('histogram', 'OrNull'), 'uniqThetaOrNull': ('uniqTheta', 'OrNull'), 'stddevPopOrNull': ('stddevPop', 'OrNull'), 'anyOrNull': ('any', 'OrNull'), 'sequenceCountOrNull': ('sequenceCount', 'OrNull'), 'argMinOrNull': ('argMin', 'OrNull'), 'maxOrNull': ('max', 'OrNull'), 'windowFunnelOrNull': ('windowFunnel', 'OrNull'), 'varSampOrNull': ('varSamp', 'OrNull'), 'groupArraySampleOrNull': ('groupArraySample', 'OrNull'), 'boundingRatioOrNull': ('boundingRatio', 'OrNull'), 'groupArrayMovingSumOrNull': ('groupArrayMovingSum', 'OrNull'), 'mannWhitneyUTestOrNull': ('mannWhitneyUTest', 'OrNull'), 'quantilesTimingOrNull': ('quantilesTiming', 'OrNull'), 'skewPopOrNull': ('skewPop', 'OrNull'), 'topKOrNull': ('topK', 'OrNull'), 'quantileTDigestWeightedOrNull': ('quantileTDigestWeighted', 'OrNull'), 'quantileBFloat16WeightedOrNull': ('quantileBFloat16Weighted', 'OrNull'), 'avgOrNull': ('avg', 'OrNull'), 'quantileOrNull': ('quantile', 'OrNull'), 'argMaxResample': ('argMax', 'Resample'), 'quantileExactResample': ('quantileExact', 'Resample'), 'quantilesDeterministicResample': ('quantilesDeterministic', 'Resample'), 'first_valueResample': ('first_value', 'Resample'), 'stochasticLogisticRegressionResample': ('stochasticLogisticRegression', 'Resample'), 'kurtSampResample': ('kurtSamp', 'Resample'), 'cramersVResample': ('cramersV', 'Resample'), 'quantilesGKResample': ('quantilesGK', 'Resample'), 'uniqCombinedResample': ('uniqCombined', 'Resample'), 'maxIntersectionsResample': ('maxIntersections', 'Resample'), 'quantilesTimingWeightedResample': ('quantilesTimingWeighted', 'Resample'), 'sumResample': ('sum', 'Resample'), 'sumCountResample': ('sumCount', 'Resample'), 'quantileGKResample': ('quantileGK', 'Resample'), 'covarPopResample': ('covarPop', 'Resample'), 'covarSampResample': ('covarSamp', 'Resample'), 'sequenceNextNodeResample': ('sequenceNextNode', 'Resample'), 'uniqCombined64Resample': ('uniqCombined64', 'Resample'), 'quantileTimingWeightedResample': ('quantileTimingWeighted', 'Resample'), 'maxMapResample': ('maxMap', 'Resample'), 'entropyResample': ('entropy', 'Resample'), 'quantilesExactLowResample': ('quantilesExactLow', 'Resample'), 'deltaSumResample': ('deltaSum', 'Resample'), 'quantileDeterministicResample': ('quantileDeterministic', 'Resample'), 'groupUniqArrayResample': ('groupUniqArray', 'Resample'), 'categoricalInformationValueResample': ('categoricalInformationValue', 'Resample'), 'deltaSumTimestampResample': ('deltaSumTimestamp', 'Resample'), 'quantilesExactHighResample': ('quantilesExactHigh', 'Resample'), 'uniqUpToResample': ('uniqUpTo', 'Resample'), 'theilsUResample': ('theilsU', 'Resample'), 'simpleLinearRegressionResample': ('simpleLinearRegression', 'Resample'), 'anyLastResample': ('anyLast', 'Resample'), 'anyHeavyResample': ('anyHeavy', 'Resample'), 'topKWeightedResample': ('topKWeighted', 'Resample'), 'exponentialTimeDecayedAvgResample': ('exponentialTimeDecayedAvg', 'Resample'), 'meanZTestResample': ('meanZTest', 'Resample'), 'largestTriangleThreeBucketsResample': ('largestTriangleThreeBuckets', 'Resample'), 'groupArrayResample': ('groupArray', 'Resample'), 'groupBitmapAndResample': ('groupBitmapAnd', 'Resample'), 'groupArrayInsertAtResample': ('groupArrayInsertAt', 'Resample'), 'varPopResample': ('varPop', 'Resample'), 'exponentialMovingAverageResample': ('exponentialMovingAverage', 'Resample'), 'quantilesExactWeightedResample': ('quantilesExactWeighted', 'Resample'), 'maxIntersectionsPositionResample': ('maxIntersectionsPosition', 'Resample'), 'uniqResample': ('uniq', 'Resample'), 'contingencyResample': ('contingency', 'Resample'), 'studentTTestResample': ('studentTTest', 'Resample'), 'quantileTimingResample': ('quantileTiming', 'Resample'), 'quantileBFloat16Resample': ('quantileBFloat16', 'Resample'), 'quantilesInterpolatedWeightedResample': ('quantilesInterpolatedWeighted', 'Resample'), 'minResample': ('min', 'Resample'), 'groupBitmapResample': ('groupBitmap', 'Resample'), 'groupBitXorResample': ('groupBitXor', 'Resample'), 'intervalLengthSumResample': ('intervalLengthSum', 'Resample'), 'uniqHLL12Resample': ('uniqHLL12', 'Resample'), 'quantilesBFloat16Resample': ('quantilesBFloat16', 'Resample'), 'kurtPopResample': ('kurtPop', 'Resample'), 'quantilesTDigestResample': ('quantilesTDigest', 'Resample'), 'sumKahanResample': ('sumKahan', 'Resample'), 'sumMapResample': ('sumMap', 'Resample'), 'medianResample': ('median', 'Resample'), 'welchTTestResample': ('welchTTest', 'Resample'), 'sparkBarResample': ('sparkBar', 'Resample'), 'retentionResample': ('retention', 'Resample'), 'last_valueResample': ('last_value', 'Resample'), 'corrResample': ('corr', 'Resample'), 'skewSampResample': ('skewSamp', 'Resample'), 'sumWithOverflowResample': ('sumWithOverflow', 'Resample'), 'kolmogorovSmirnovTestResample': ('kolmogorovSmirnovTest', 'Resample'), 'quantileExactLowResample': ('quantileExactLow', 'Resample'), 'countResample': ('count', 'Resample'), 'groupBitmapOrResample': ('groupBitmapOr', 'Resample'), 'minMapResample': ('minMap', 'Resample'), 'rankCorrResample': ('rankCorr', 'Resample'), 'stddevSampResample': ('stddevSamp', 'Resample'), 'cramersVBiasCorrectedResample': ('cramersVBiasCorrected', 'Resample'), 'groupBitAndResample': ('groupBitAnd', 'Resample'), 'groupArrayMovingAvgResample': ('groupArrayMovingAvg', 'Resample'), 'groupBitOrResample': ('groupBitOr', 'Resample'), 'quantileExactHighResample': ('quantileExactHigh', 'Resample'), 'sequenceMatchResample': ('sequenceMatch', 'Resample'), 'uniqExactResample': ('uniqExact', 'Resample'), 'groupArrayLastResample': ('groupArrayLast', 'Resample'), 'quantileExactWeightedResample': ('quantileExactWeighted', 'Resample'), 'quantileInterpolatedWeightedResample': ('quantileInterpolatedWeighted', 'Resample'), 'quantilesTDigestWeightedResample': ('quantilesTDigestWeighted', 'Resample'), 'avgWeightedResample': ('avgWeighted', 'Resample'), 'quantilesResample': ('quantiles', 'Resample'), 'quantileTDigestResample': ('quantileTDigest', 'Resample'), 'stochasticLinearRegressionResample': ('stochasticLinearRegression', 'Resample'), 'groupBitmapXorResample': ('groupBitmapXor', 'Resample'), 'quantilesExactResample': ('quantilesExact', 'Resample'), 'quantilesBFloat16WeightedResample': ('quantilesBFloat16Weighted', 'Resample'), 'histogramResample': ('histogram', 'Resample'), 'uniqThetaResample': ('uniqTheta', 'Resample'), 'stddevPopResample': ('stddevPop', 'Resample'), 'anyResample': ('any', 'Resample'), 'sequenceCountResample': ('sequenceCount', 'Resample'), 'argMinResample': ('argMin', 'Resample'), 'maxResample': ('max', 'Resample'), 'windowFunnelResample': ('windowFunnel', 'Resample'), 'varSampResample': ('varSamp', 'Resample'), 'groupArraySampleResample': ('groupArraySample', 'Resample'), 'boundingRatioResample': ('boundingRatio', 'Resample'), 'groupArrayMovingSumResample': ('groupArrayMovingSum', 'Resample'), 'mannWhitneyUTestResample': ('mannWhitneyUTest', 'Resample'), 'quantilesTimingResample': ('quantilesTiming', 'Resample'), 'skewPopResample': ('skewPop', 'Resample'), 'topKResample': ('topK', 'Resample'), 'quantileTDigestWeightedResample': ('quantileTDigestWeighted', 'Resample'), 'quantileBFloat16WeightedResample': ('quantileBFloat16Weighted', 'Resample'), 'avgResample': ('avg', 'Resample'), 'quantileResample': ('quantile', 'Resample'), 'argMaxArgMin': ('argMax', 'ArgMin'), 'quantileExactArgMin': ('quantileExact', 'ArgMin'), 'quantilesDeterministicArgMin': ('quantilesDeterministic', 'ArgMin'), 'first_valueArgMin': ('first_value', 'ArgMin'), 'stochasticLogisticRegressionArgMin': ('stochasticLogisticRegression', 'ArgMin'), 'kurtSampArgMin': ('kurtSamp', 'ArgMin'), 'cramersVArgMin': ('cramersV', 'ArgMin'), 'quantilesGKArgMin': ('quantilesGK', 'ArgMin'), 'uniqCombinedArgMin': ('uniqCombined', 'ArgMin'), 'maxIntersectionsArgMin': ('maxIntersections', 'ArgMin'), 'quantilesTimingWeightedArgMin': ('quantilesTimingWeighted', 'ArgMin'), 'sumArgMin': ('sum', 'ArgMin'), 'sumCountArgMin': ('sumCount', 'ArgMin'), 'quantileGKArgMin': ('quantileGK', 'ArgMin'), 'covarPopArgMin': ('covarPop', 'ArgMin'), 'covarSampArgMin': ('covarSamp', 'ArgMin'), 'sequenceNextNodeArgMin': ('sequenceNextNode', 'ArgMin'), 'uniqCombined64ArgMin': ('uniqCombined64', 'ArgMin'), 'quantileTimingWeightedArgMin': ('quantileTimingWeighted', 'ArgMin'), 'maxMapArgMin': ('maxMap', 'ArgMin'), 'entropyArgMin': ('entropy', 'ArgMin'), 'quantilesExactLowArgMin': ('quantilesExactLow', 'ArgMin'), 'deltaSumArgMin': ('deltaSum', 'ArgMin'), 'quantileDeterministicArgMin': ('quantileDeterministic', 'ArgMin'), 'groupUniqArrayArgMin': ('groupUniqArray', 'ArgMin'), 'categoricalInformationValueArgMin': ('categoricalInformationValue', 'ArgMin'), 'deltaSumTimestampArgMin': ('deltaSumTimestamp', 'ArgMin'), 'quantilesExactHighArgMin': ('quantilesExactHigh', 'ArgMin'), 'uniqUpToArgMin': ('uniqUpTo', 'ArgMin'), 'theilsUArgMin': ('theilsU', 'ArgMin'), 'simpleLinearRegressionArgMin': ('simpleLinearRegression', 'ArgMin'), 'anyLastArgMin': ('anyLast', 'ArgMin'), 'anyHeavyArgMin': ('anyHeavy', 'ArgMin'), 'topKWeightedArgMin': ('topKWeighted', 'ArgMin'), 'exponentialTimeDecayedAvgArgMin': ('exponentialTimeDecayedAvg', 'ArgMin'), 'meanZTestArgMin': ('meanZTest', 'ArgMin'), 'largestTriangleThreeBucketsArgMin': ('largestTriangleThreeBuckets', 'ArgMin'), 'groupArrayArgMin': ('groupArray', 'ArgMin'), 'groupBitmapAndArgMin': ('groupBitmapAnd', 'ArgMin'), 'groupArrayInsertAtArgMin': ('groupArrayInsertAt', 'ArgMin'), 'varPopArgMin': ('varPop', 'ArgMin'), 'exponentialMovingAverageArgMin': ('exponentialMovingAverage', 'ArgMin'), 'quantilesExactWeightedArgMin': ('quantilesExactWeighted', 'ArgMin'), 'maxIntersectionsPositionArgMin': ('maxIntersectionsPosition', 'ArgMin'), 'uniqArgMin': ('uniq', 'ArgMin'), 'contingencyArgMin': ('contingency', 'ArgMin'), 'studentTTestArgMin': ('studentTTest', 'ArgMin'), 'quantileTimingArgMin': ('quantileTiming', 'ArgMin'), 'quantileBFloat16ArgMin': ('quantileBFloat16', 'ArgMin'), 'quantilesInterpolatedWeightedArgMin': ('quantilesInterpolatedWeighted', 'ArgMin'), 'minArgMin': ('min', 'ArgMin'), 'groupBitmapArgMin': ('groupBitmap', 'ArgMin'), 'groupBitXorArgMin': ('groupBitXor', 'ArgMin'), 'intervalLengthSumArgMin': ('intervalLengthSum', 'ArgMin'), 'uniqHLL12ArgMin': ('uniqHLL12', 'ArgMin'), 'quantilesBFloat16ArgMin': ('quantilesBFloat16', 'ArgMin'), 'kurtPopArgMin': ('kurtPop', 'ArgMin'), 'quantilesTDigestArgMin': ('quantilesTDigest', 'ArgMin'), 'sumKahanArgMin': ('sumKahan', 'ArgMin'), 'sumMapArgMin': ('sumMap', 'ArgMin'), 'medianArgMin': ('median', 'ArgMin'), 'welchTTestArgMin': ('welchTTest', 'ArgMin'), 'sparkBarArgMin': ('sparkBar', 'ArgMin'), 'retentionArgMin': ('retention', 'ArgMin'), 'last_valueArgMin': ('last_value', 'ArgMin'), 'corrArgMin': ('corr', 'ArgMin'), 'skewSampArgMin': ('skewSamp', 'ArgMin'), 'sumWithOverflowArgMin': ('sumWithOverflow', 'ArgMin'), 'kolmogorovSmirnovTestArgMin': ('kolmogorovSmirnovTest', 'ArgMin'), 'quantileExactLowArgMin': ('quantileExactLow', 'ArgMin'), 'countArgMin': ('count', 'ArgMin'), 'groupBitmapOrArgMin': ('groupBitmapOr', 'ArgMin'), 'minMapArgMin': ('minMap', 'ArgMin'), 'rankCorrArgMin': ('rankCorr', 'ArgMin'), 'stddevSampArgMin': ('stddevSamp', 'ArgMin'), 'cramersVBiasCorrectedArgMin': ('cramersVBiasCorrected', 'ArgMin'), 'groupBitAndArgMin': ('groupBitAnd', 'ArgMin'), 'groupArrayMovingAvgArgMin': ('groupArrayMovingAvg', 'ArgMin'), 'groupBitOrArgMin': ('groupBitOr', 'ArgMin'), 'quantileExactHighArgMin': ('quantileExactHigh', 'ArgMin'), 'sequenceMatchArgMin': ('sequenceMatch', 'ArgMin'), 'uniqExactArgMin': ('uniqExact', 'ArgMin'), 'groupArrayLastArgMin': ('groupArrayLast', 'ArgMin'), 'quantileExactWeightedArgMin': ('quantileExactWeighted', 'ArgMin'), 'quantileInterpolatedWeightedArgMin': ('quantileInterpolatedWeighted', 'ArgMin'), 'quantilesTDigestWeightedArgMin': ('quantilesTDigestWeighted', 'ArgMin'), 'avgWeightedArgMin': ('avgWeighted', 'ArgMin'), 'quantilesArgMin': ('quantiles', 'ArgMin'), 'quantileTDigestArgMin': ('quantileTDigest', 'ArgMin'), 'stochasticLinearRegressionArgMin': ('stochasticLinearRegression', 'ArgMin'), 'groupBitmapXorArgMin': ('groupBitmapXor', 'ArgMin'), 'quantilesExactArgMin': ('quantilesExact', 'ArgMin'), 'quantilesBFloat16WeightedArgMin': ('quantilesBFloat16Weighted', 'ArgMin'), 'histogramArgMin': ('histogram', 'ArgMin'), 'uniqThetaArgMin': ('uniqTheta', 'ArgMin'), 'stddevPopArgMin': ('stddevPop', 'ArgMin'), 'anyArgMin': ('any', 'ArgMin'), 'sequenceCountArgMin': ('sequenceCount', 'ArgMin'), 'argMinArgMin': ('argMin', 'ArgMin'), 'maxArgMin': ('max', 'ArgMin'), 'windowFunnelArgMin': ('windowFunnel', 'ArgMin'), 'varSampArgMin': ('varSamp', 'ArgMin'), 'groupArraySampleArgMin': ('groupArraySample', 'ArgMin'), 'boundingRatioArgMin': ('boundingRatio', 'ArgMin'), 'groupArrayMovingSumArgMin': ('groupArrayMovingSum', 'ArgMin'), 'mannWhitneyUTestArgMin': ('mannWhitneyUTest', 'ArgMin'), 'quantilesTimingArgMin': ('quantilesTiming', 'ArgMin'), 'skewPopArgMin': ('skewPop', 'ArgMin'), 'topKArgMin': ('topK', 'ArgMin'), 'quantileTDigestWeightedArgMin': ('quantileTDigestWeighted', 'ArgMin'), 'quantileBFloat16WeightedArgMin': ('quantileBFloat16Weighted', 'ArgMin'), 'avgArgMin': ('avg', 'ArgMin'), 'quantileArgMin': ('quantile', 'ArgMin'), 'argMaxArgMax': ('argMax', 'ArgMax'), 'quantileExactArgMax': ('quantileExact', 'ArgMax'), 'quantilesDeterministicArgMax': ('quantilesDeterministic', 'ArgMax'), 'first_valueArgMax': ('first_value', 'ArgMax'), 'stochasticLogisticRegressionArgMax': ('stochasticLogisticRegression', 'ArgMax'), 'kurtSampArgMax': ('kurtSamp', 'ArgMax'), 'cramersVArgMax': ('cramersV', 'ArgMax'), 'quantilesGKArgMax': ('quantilesGK', 'ArgMax'), 'uniqCombinedArgMax': ('uniqCombined', 'ArgMax'), 'maxIntersectionsArgMax': ('maxIntersections', 'ArgMax'), 'quantilesTimingWeightedArgMax': ('quantilesTimingWeighted', 'ArgMax'), 'sumArgMax': ('sum', 'ArgMax'), 'sumCountArgMax': ('sumCount', 'ArgMax'), 'quantileGKArgMax': ('quantileGK', 'ArgMax'), 'covarPopArgMax': ('covarPop', 'ArgMax'), 'covarSampArgMax': ('covarSamp', 'ArgMax'), 'sequenceNextNodeArgMax': ('sequenceNextNode', 'ArgMax'), 'uniqCombined64ArgMax': ('uniqCombined64', 'ArgMax'), 'quantileTimingWeightedArgMax': ('quantileTimingWeighted', 'ArgMax'), 'maxMapArgMax': ('maxMap', 'ArgMax'), 'entropyArgMax': ('entropy', 'ArgMax'), 'quantilesExactLowArgMax': ('quantilesExactLow', 'ArgMax'), 'deltaSumArgMax': ('deltaSum', 'ArgMax'), 'quantileDeterministicArgMax': ('quantileDeterministic', 'ArgMax'), 'groupUniqArrayArgMax': ('groupUniqArray', 'ArgMax'), 'categoricalInformationValueArgMax': ('categoricalInformationValue', 'ArgMax'), 'deltaSumTimestampArgMax': ('deltaSumTimestamp', 'ArgMax'), 'quantilesExactHighArgMax': ('quantilesExactHigh', 'ArgMax'), 'uniqUpToArgMax': ('uniqUpTo', 'ArgMax'), 'theilsUArgMax': ('theilsU', 'ArgMax'), 'simpleLinearRegressionArgMax': ('simpleLinearRegression', 'ArgMax'), 'anyLastArgMax': ('anyLast', 'ArgMax'), 'anyHeavyArgMax': ('anyHeavy', 'ArgMax'), 'topKWeightedArgMax': ('topKWeighted', 'ArgMax'), 'exponentialTimeDecayedAvgArgMax': ('exponentialTimeDecayedAvg', 'ArgMax'), 'meanZTestArgMax': ('meanZTest', 'ArgMax'), 'largestTriangleThreeBucketsArgMax': ('largestTriangleThreeBuckets', 'ArgMax'), 'groupArrayArgMax': ('groupArray', 'ArgMax'), 'groupBitmapAndArgMax': ('groupBitmapAnd', 'ArgMax'), 'groupArrayInsertAtArgMax': ('groupArrayInsertAt', 'ArgMax'), 'varPopArgMax': ('varPop', 'ArgMax'), 'exponentialMovingAverageArgMax': ('exponentialMovingAverage', 'ArgMax'), 'quantilesExactWeightedArgMax': ('quantilesExactWeighted', 'ArgMax'), 'maxIntersectionsPositionArgMax': ('maxIntersectionsPosition', 'ArgMax'), 'uniqArgMax': ('uniq', 'ArgMax'), 'contingencyArgMax': ('contingency', 'ArgMax'), 'studentTTestArgMax': ('studentTTest', 'ArgMax'), 'quantileTimingArgMax': ('quantileTiming', 'ArgMax'), 'quantileBFloat16ArgMax': ('quantileBFloat16', 'ArgMax'), 'quantilesInterpolatedWeightedArgMax': ('quantilesInterpolatedWeighted', 'ArgMax'), 'minArgMax': ('min', 'ArgMax'), 'groupBitmapArgMax': ('groupBitmap', 'ArgMax'), 'groupBitXorArgMax': ('groupBitXor', 'ArgMax'), 'intervalLengthSumArgMax': ('intervalLengthSum', 'ArgMax'), 'uniqHLL12ArgMax': ('uniqHLL12', 'ArgMax'), 'quantilesBFloat16ArgMax': ('quantilesBFloat16', 'ArgMax'), 'kurtPopArgMax': ('kurtPop', 'ArgMax'), 'quantilesTDigestArgMax': ('quantilesTDigest', 'ArgMax'), 'sumKahanArgMax': ('sumKahan', 'ArgMax'), 'sumMapArgMax': ('sumMap', 'ArgMax'), 'medianArgMax': ('median', 'ArgMax'), 'welchTTestArgMax': ('welchTTest', 'ArgMax'), 'sparkBarArgMax': ('sparkBar', 'ArgMax'), 'retentionArgMax': ('retention', 'ArgMax'), 'last_valueArgMax': ('last_value', 'ArgMax'), 'corrArgMax': ('corr', 'ArgMax'), 'skewSampArgMax': ('skewSamp', 'ArgMax'), 'sumWithOverflowArgMax': ('sumWithOverflow', 'ArgMax'), 'kolmogorovSmirnovTestArgMax': ('kolmogorovSmirnovTest', 'ArgMax'), 'quantileExactLowArgMax': ('quantileExactLow', 'ArgMax'), 'countArgMax': ('count', 'ArgMax'), 'groupBitmapOrArgMax': ('groupBitmapOr', 'ArgMax'), 'minMapArgMax': ('minMap', 'ArgMax'), 'rankCorrArgMax': ('rankCorr', 'ArgMax'), 'stddevSampArgMax': ('stddevSamp', 'ArgMax'), 'cramersVBiasCorrectedArgMax': ('cramersVBiasCorrected', 'ArgMax'), 'groupBitAndArgMax': ('groupBitAnd', 'ArgMax'), 'groupArrayMovingAvgArgMax': ('groupArrayMovingAvg', 'ArgMax'), 'groupBitOrArgMax': ('groupBitOr', 'ArgMax'), 'quantileExactHighArgMax': ('quantileExactHigh', 'ArgMax'), 'sequenceMatchArgMax': ('sequenceMatch', 'ArgMax'), 'uniqExactArgMax': ('uniqExact', 'ArgMax'), 'groupArrayLastArgMax': ('groupArrayLast', 'ArgMax'), 'quantileExactWeightedArgMax': ('quantileExactWeighted', 'ArgMax'), 'quantileInterpolatedWeightedArgMax': ('quantileInterpolatedWeighted', 'ArgMax'), 'quantilesTDigestWeightedArgMax': ('quantilesTDigestWeighted', 'ArgMax'), 'avgWeightedArgMax': ('avgWeighted', 'ArgMax'), 'quantilesArgMax': ('quantiles', 'ArgMax'), 'quantileTDigestArgMax': ('quantileTDigest', 'ArgMax'), 'stochasticLinearRegressionArgMax': ('stochasticLinearRegression', 'ArgMax'), 'groupBitmapXorArgMax': ('groupBitmapXor', 'ArgMax'), 'quantilesExactArgMax': ('quantilesExact', 'ArgMax'), 'quantilesBFloat16WeightedArgMax': ('quantilesBFloat16Weighted', 'ArgMax'), 'histogramArgMax': ('histogram', 'ArgMax'), 'uniqThetaArgMax': ('uniqTheta', 'ArgMax'), 'stddevPopArgMax': ('stddevPop', 'ArgMax'), 'anyArgMax': ('any', 'ArgMax'), 'sequenceCountArgMax': ('sequenceCount', 'ArgMax'), 'argMinArgMax': ('argMin', 'ArgMax'), 'maxArgMax': ('max', 'ArgMax'), 'windowFunnelArgMax': ('windowFunnel', 'ArgMax'), 'varSampArgMax': ('varSamp', 'ArgMax'), 'groupArraySampleArgMax': ('groupArraySample', 'ArgMax'), 'boundingRatioArgMax': ('boundingRatio', 'ArgMax'), 'groupArrayMovingSumArgMax': ('groupArrayMovingSum', 'ArgMax'), 'mannWhitneyUTestArgMax': ('mannWhitneyUTest', 'ArgMax'), 'quantilesTimingArgMax': ('quantilesTiming', 'ArgMax'), 'skewPopArgMax': ('skewPop', 'ArgMax'), 'topKArgMax': ('topK', 'ArgMax'), 'quantileTDigestWeightedArgMax': ('quantileTDigestWeighted', 'ArgMax'), 'quantileBFloat16WeightedArgMax': ('quantileBFloat16Weighted', 'ArgMax'), 'avgArgMax': ('avg', 'ArgMax'), 'quantileArgMax': ('quantile', 'ArgMax'), 'argMax': ('argMax', ''), 'quantileExact': ('quantileExact', ''), 'quantilesDeterministic': ('quantilesDeterministic', ''), 'first_value': ('first_value', ''), 'stochasticLogisticRegression': ('stochasticLogisticRegression', ''), 'kurtSamp': ('kurtSamp', ''), 'cramersV': ('cramersV', ''), 'quantilesGK': ('quantilesGK', ''), 'uniqCombined': ('uniqCombined', ''), 'maxIntersections': ('maxIntersections', ''), 'quantilesTimingWeighted': ('quantilesTimingWeighted', ''), 'sum': ('sum', ''), 'sumCount': ('sumCount', ''), 'quantileGK': ('quantileGK', ''), 'covarPop': ('covarPop', ''), 'covarSamp': ('covarSamp', ''), 'sequenceNextNode': ('sequenceNextNode', ''), 'uniqCombined64': ('uniqCombined64', ''), 'quantileTimingWeighted': ('quantileTimingWeighted', ''), 'entropy': ('entropy', ''), 'quantilesExactLow': ('quantilesExactLow', ''), 'deltaSum': ('deltaSum', ''), 'quantileDeterministic': ('quantileDeterministic', ''), 'groupUniqArray': ('groupUniqArray', ''), 'categoricalInformationValue': ('categoricalInformationValue', ''), 'deltaSumTimestamp': ('deltaSumTimestamp', ''), 'quantilesExactHigh': ('quantilesExactHigh', ''), 'uniqUpTo': ('uniqUpTo', ''), 'theilsU': ('theilsU', ''), 'simpleLinearRegression': ('simpleLinearRegression', ''), 'anyLast': ('anyLast', ''), 'anyHeavy': ('anyHeavy', ''), 'topKWeighted': ('topKWeighted', ''), 'exponentialTimeDecayedAvg': ('exponentialTimeDecayedAvg', ''), 'meanZTest': ('meanZTest', ''), 'largestTriangleThreeBuckets': ('largestTriangleThreeBuckets', ''), 'groupArray': ('groupArray', ''), 'groupBitmapAnd': ('groupBitmapAnd', ''), 'groupArrayInsertAt': ('groupArrayInsertAt', ''), 'varPop': ('varPop', ''), 'exponentialMovingAverage': ('exponentialMovingAverage', ''), 'quantilesExactWeighted': ('quantilesExactWeighted', ''), 'maxIntersectionsPosition': ('maxIntersectionsPosition', ''), 'uniq': ('uniq', ''), 'contingency': ('contingency', ''), 'studentTTest': ('studentTTest', ''), 'quantileTiming': ('quantileTiming', ''), 'quantileBFloat16': ('quantileBFloat16', ''), 'quantilesInterpolatedWeighted': ('quantilesInterpolatedWeighted', ''), 'min': ('min', ''), 'groupBitmap': ('groupBitmap', ''), 'groupBitXor': ('groupBitXor', ''), 'intervalLengthSum': ('intervalLengthSum', ''), 'uniqHLL12': ('uniqHLL12', ''), 'quantilesBFloat16': ('quantilesBFloat16', ''), 'kurtPop': ('kurtPop', ''), 'quantilesTDigest': ('quantilesTDigest', ''), 'sumKahan': ('sumKahan', ''), 'median': ('median', ''), 'welchTTest': ('welchTTest', ''), 'sparkBar': ('sparkBar', ''), 'retention': ('retention', ''), 'last_value': ('last_value', ''), 'corr': ('corr', ''), 'skewSamp': ('skewSamp', ''), 'sumWithOverflow': ('sumWithOverflow', ''), 'kolmogorovSmirnovTest': ('kolmogorovSmirnovTest', ''), 'quantileExactLow': ('quantileExactLow', ''), 'count': ('count', ''), 'groupBitmapOr': ('groupBitmapOr', ''), 'rankCorr': ('rankCorr', ''), 'stddevSamp': ('stddevSamp', ''), 'cramersVBiasCorrected': ('cramersVBiasCorrected', ''), 'groupBitAnd': ('groupBitAnd', ''), 'groupArrayMovingAvg': ('groupArrayMovingAvg', ''), 'groupBitOr': ('groupBitOr', ''), 'quantileExactHigh': ('quantileExactHigh', ''), 'sequenceMatch': ('sequenceMatch', ''), 'uniqExact': ('uniqExact', ''), 'groupArrayLast': ('groupArrayLast', ''), 'quantileExactWeighted': ('quantileExactWeighted', ''), 'quantileInterpolatedWeighted': ('quantileInterpolatedWeighted', ''), 'quantilesTDigestWeighted': ('quantilesTDigestWeighted', ''), 'avgWeighted': ('avgWeighted', ''), 'quantiles': ('quantiles', ''), 'quantileTDigest': ('quantileTDigest', ''), 'stochasticLinearRegression': ('stochasticLinearRegression', ''), 'groupBitmapXor': ('groupBitmapXor', ''), 'quantilesExact': ('quantilesExact', ''), 'quantilesBFloat16Weighted': ('quantilesBFloat16Weighted', ''), 'histogram': ('histogram', ''), 'uniqTheta': ('uniqTheta', ''), 'stddevPop': ('stddevPop', ''), 'any': ('any', ''), 'sequenceCount': ('sequenceCount', ''), 'argMin': ('argMin', ''), 'max': ('max', ''), 'windowFunnel': ('windowFunnel', ''), 'varSamp': ('varSamp', ''), 'groupArraySample': ('groupArraySample', ''), 'boundingRatio': ('boundingRatio', ''), 'groupArrayMovingSum': ('groupArrayMovingSum', ''), 'mannWhitneyUTest': ('mannWhitneyUTest', ''), 'quantilesTiming': ('quantilesTiming', ''), 'skewPop': ('skewPop', ''), 'topK': ('topK', ''), 'quantileTDigestWeighted': ('quantileTDigestWeighted', ''), 'quantileBFloat16Weighted': ('quantileBFloat16Weighted', ''), 'avg': ('avg', ''), 'quantile': ('quantile', '')}
FUNCTIONS_WITH_ALIASED_ARGS = {'TUPLE', 'STRUCT'}
FUNCTION_PARSERS = {'CAST': <function Parser.<lambda>>, 'CEIL': <function Parser.<lambda>>, 'CONVERT': <function Parser.<lambda>>, 'DECODE': <function Parser.<lambda>>, 'EXTRACT': <function Parser.<lambda>>, 'FLOOR': <function Parser.<lambda>>, 'GAP_FILL': <function Parser.<lambda>>, 'JSON_OBJECT': <function Parser.<lambda>>, 'JSON_OBJECTAGG': <function Parser.<lambda>>, 'JSON_TABLE': <function Parser.<lambda>>, 'NORMALIZE': <function Parser.<lambda>>, 'OPENJSON': <function Parser.<lambda>>, 'OVERLAY': <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>>, 'XMLELEMENT': <function Parser.<lambda>>, 'XMLTABLE': <function Parser.<lambda>>, 'ARRAYJOIN': <function ClickHouse.Parser.<lambda>>, 'QUANTILE': <function ClickHouse.Parser.<lambda>>, 'MEDIAN': <function ClickHouse.Parser.<lambda>>, 'COLUMNS': <function ClickHouse.Parser.<lambda>>}
PROPERTY_PARSERS = {'ALLOWED_VALUES': <function Parser.<lambda>>, 'ALGORITHM': <function Parser.<lambda>>, 'AUTO': <function Parser.<lambda>>, 'AUTO_INCREMENT': <function Parser.<lambda>>, 'BACKUP': <function Parser.<lambda>>, 'BLOCKCOMPRESSION': <function Parser.<lambda>>, 'CHARSET': <function Parser.<lambda>>, 'CHARACTER SET': <function Parser.<lambda>>, 'CHECKSUM': <function Parser.<lambda>>, 'CLUSTER BY': <function Parser.<lambda>>, 'CLUSTERED': <function Parser.<lambda>>, 'COLLATE': <function Parser.<lambda>>, 'COMMENT': <function Parser.<lambda>>, 'CONTAINS': <function Parser.<lambda>>, 'COPY': <function Parser.<lambda>>, 'DATABLOCKSIZE': <function Parser.<lambda>>, 'DATA_DELETION': <function Parser.<lambda>>, 'DEFINER': <function Parser.<lambda>>, 'DETERMINISTIC': <function Parser.<lambda>>, 'DISTRIBUTED': <function Parser.<lambda>>, 'DUPLICATE': <function Parser.<lambda>>, 'DISTKEY': <function Parser.<lambda>>, 'DISTSTYLE': <function Parser.<lambda>>, 'EMPTY': <function Parser.<lambda>>, 'ENGINE': <function Parser.<lambda>>, 'EXECUTE': <function Parser.<lambda>>, 'EXTERNAL': <function Parser.<lambda>>, 'FALLBACK': <function Parser.<lambda>>, 'FORMAT': <function Parser.<lambda>>, 'FREESPACE': <function Parser.<lambda>>, 'GLOBAL': <function Parser.<lambda>>, 'HEAP': <function Parser.<lambda>>, 'ICEBERG': <function Parser.<lambda>>, 'IMMUTABLE': <function Parser.<lambda>>, 'INHERITS': <function Parser.<lambda>>, 'INPUT': <function Parser.<lambda>>, 'JOURNAL': <function Parser.<lambda>>, 'LANGUAGE': <function Parser.<lambda>>, 'LAYOUT': <function Parser.<lambda>>, 'LIFETIME': <function Parser.<lambda>>, 'LIKE': <function Parser.<lambda>>, 'LOCATION': <function Parser.<lambda>>, 'LOCK': <function Parser.<lambda>>, 'LOCKING': <function Parser.<lambda>>, 'LOG': <function Parser.<lambda>>, 'MATERIALIZED': <function Parser.<lambda>>, 'MERGEBLOCKRATIO': <function Parser.<lambda>>, 'MODIFIES': <function Parser.<lambda>>, 'MULTISET': <function Parser.<lambda>>, 'NO': <function Parser.<lambda>>, 'ON': <function Parser.<lambda>>, 'ORDER BY': <function Parser.<lambda>>, 'OUTPUT': <function Parser.<lambda>>, 'PARTITION': <function Parser.<lambda>>, 'PARTITION BY': <function Parser.<lambda>>, 'PARTITIONED BY': <function Parser.<lambda>>, 'PARTITIONED_BY': <function Parser.<lambda>>, 'PRIMARY KEY': <function Parser.<lambda>>, 'RANGE': <function Parser.<lambda>>, 'READS': <function Parser.<lambda>>, 'REMOTE': <function Parser.<lambda>>, 'RETURNS': <function Parser.<lambda>>, 'STRICT': <function Parser.<lambda>>, 'STREAMING': <function Parser.<lambda>>, 'ROW': <function Parser.<lambda>>, 'ROW_FORMAT': <function Parser.<lambda>>, 'SAMPLE': <function Parser.<lambda>>, 'SECURE': <function Parser.<lambda>>, 'SECURITY': <function Parser.<lambda>>, 'SET': <function Parser.<lambda>>, 'SETTINGS': <function Parser.<lambda>>, 'SHARING': <function Parser.<lambda>>, 'SORTKEY': <function Parser.<lambda>>, 'SOURCE': <function Parser.<lambda>>, 'STABLE': <function Parser.<lambda>>, 'STORED': <function Parser.<lambda>>, 'SYSTEM_VERSIONING': <function Parser.<lambda>>, 'TBLPROPERTIES': <function Parser.<lambda>>, 'TEMP': <function Parser.<lambda>>, 'TEMPORARY': <function Parser.<lambda>>, 'TO': <function Parser.<lambda>>, 'TRANSIENT': <function Parser.<lambda>>, 'TRANSFORM': <function Parser.<lambda>>, 'TTL': <function Parser.<lambda>>, 'USING': <function Parser.<lambda>>, 'UNLOGGED': <function Parser.<lambda>>, 'VOLATILE': <function Parser.<lambda>>, 'WITH': <function Parser.<lambda>>}
NO_PAREN_FUNCTION_PARSERS = {'CASE': <function Parser.<lambda>>, 'CONNECT_BY_ROOT': <function Parser.<lambda>>, 'IF': <function Parser.<lambda>>}
NO_PAREN_FUNCTIONS = {<TokenType.CURRENT_DATE: 'CURRENT_DATE'>: <class 'sqlglot.expressions.CurrentDate'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>: <class 'sqlglot.expressions.CurrentDate'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>: <class 'sqlglot.expressions.CurrentTime'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>: <class 'sqlglot.expressions.CurrentUser'>}
RANGE_PARSERS = {<TokenType.AT_GT: 'AT_GT'>: <function binary_range_parser.<locals>._parse_binary_range>, <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.LT_AT: 'LT_AT'>: <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.OUTER: 'OUTER'>, <TokenType.SEMI: 'SEMI'>, <TokenType.INNER: 'INNER'>, <TokenType.STRAIGHT_JOIN: 'STRAIGHT_JOIN'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.ANTI: 'ANTI'>, <TokenType.CROSS: 'CROSS'>, <TokenType.ANY: 'ANY'>, <TokenType.ASOF: 'ASOF'>}
TABLE_ALIAS_TOKENS = {<TokenType.OBJECT: 'OBJECT'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.WAREHOUSE: 'WAREHOUSE'>, <TokenType.LIST: 'LIST'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.LIMIT: 'LIMIT'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.SET: 'SET'>, <TokenType.LOAD: 'LOAD'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.END: 'END'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.USE: 'USE'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.POINT: 'POINT'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.STRAIGHT_JOIN: 'STRAIGHT_JOIN'>, <TokenType.MODEL: 'MODEL'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.NAMESPACE: 'NAMESPACE'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.NEXT: 'NEXT'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.FALSE: 'FALSE'>, <TokenType.ASC: 'ASC'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.DELETE: 'DELETE'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.RENAME: 'RENAME'>, <TokenType.MULTILINESTRING: 'MULTILINESTRING'>, <TokenType.BINARY: 'BINARY'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.NAME: 'NAME'>, <TokenType.INT: 'INT'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.DECIMAL32: 'DECIMAL32'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.UINT: 'UINT'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.IPV6: 'IPV6'>, <TokenType.INDEX: 'INDEX'>, <TokenType.DYNAMIC: 'DYNAMIC'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.TOP: 'TOP'>, <TokenType.NESTED: 'NESTED'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.STREAMLIT: 'STREAMLIT'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.XML: 'XML'>, <TokenType.DECIMAL128: 'DECIMAL128'>, <TokenType.JSON: 'JSON'>, <TokenType.NULL: 'NULL'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.JSONB: 'JSONB'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.RING: 'RING'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.MAP: 'MAP'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.MERGE: 'MERGE'>, <TokenType.CASE: 'CASE'>, <TokenType.ROLLUP: 'ROLLUP'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.SINK: 'SINK'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.UUID: 'UUID'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.ROWS: 'ROWS'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.POLYGON: 'POLYGON'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.SUPER: 'SUPER'>, <TokenType.FILTER: 'FILTER'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.ATTACH: 'ATTACH'>, <TokenType.INET: 'INET'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.CHAR: 'CHAR'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.DATETIME2: 'DATETIME2'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.INT256: 'INT256'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.PROCEDURE: 'PROCEDURE'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.DATE32: 'DATE32'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.ALL: 'ALL'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.MULTIPOLYGON: 'MULTIPOLYGON'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.UINT256: 'UINT256'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.STORAGE_INTEGRATION: 'STORAGE_INTEGRATION'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.VIEW: 'VIEW'>, <TokenType.DECIMAL64: 'DECIMAL64'>, <TokenType.ORDINALITY: 'ORDINALITY'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.KILL: 'KILL'>, <TokenType.CACHE: 'CACHE'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.DATE: 'DATE'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.ENUM: 'ENUM'>, <TokenType.TAG: 'TAG'>, <TokenType.KEEP: 'KEEP'>, <TokenType.TABLE: 'TABLE'>, <TokenType.CUBE: 'CUBE'>, <TokenType.BIT: 'BIT'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.IS: 'IS'>, <TokenType.COPY: 'COPY'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.DECIMAL256: 'DECIMAL256'>, <TokenType.UINT128: 'UINT128'>, <TokenType.SOME: 'SOME'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.SMALLDATETIME: 'SMALLDATETIME'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.REFERENCES: 'REFERENCES'>, <TokenType.UNIQUE: 'UNIQUE'>, <TokenType.DETACH: 'DETACH'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.DESC: 'DESC'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.DIV: 'DIV'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.LINESTRING: 'LINESTRING'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.VAR: 'VAR'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.SOURCE: 'SOURCE'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.ROW: 'ROW'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.TIME: 'TIME'>, <TokenType.TRUE: 'TRUE'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.TEXT: 'TEXT'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.YEAR: 'YEAR'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.MONEY: 'MONEY'>, <TokenType.SHOW: 'SHOW'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.IPV4: 'IPV4'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.FIRST: 'FIRST'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.INT128: 'INT128'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.UNIQUEIDENTIFIER: 'UNIQUEIDENTIFIER'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.RANGE: 'RANGE'>}
ALIAS_TOKENS = {<TokenType.OBJECT: 'OBJECT'>, <TokenType.LEFT: 'LEFT'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.ANTI: 'ANTI'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.WAREHOUSE: 'WAREHOUSE'>, <TokenType.FINAL: 'FINAL'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.LIST: 'LIST'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.LIMIT: 'LIMIT'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.SET: 'SET'>, <TokenType.LOAD: 'LOAD'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.END: 'END'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.USE: 'USE'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.NATURAL: 'NATURAL'>, <TokenType.POINT: 'POINT'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.MODEL: 'MODEL'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.NAMESPACE: 'NAMESPACE'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.NEXT: 'NEXT'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.FALSE: 'FALSE'>, <TokenType.ASC: 'ASC'>, <TokenType.APPLY: 'APPLY'>, <TokenType.FULL: 'FULL'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.DELETE: 'DELETE'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.RENAME: 'RENAME'>, <TokenType.MULTILINESTRING: 'MULTILINESTRING'>, <TokenType.BINARY: 'BINARY'>, <TokenType.WINDOW: 'WINDOW'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.NAME: 'NAME'>, <TokenType.INT: 'INT'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.DECIMAL32: 'DECIMAL32'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.UINT: 'UINT'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.IPV6: 'IPV6'>, <TokenType.INDEX: 'INDEX'>, <TokenType.DYNAMIC: 'DYNAMIC'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.TOP: 'TOP'>, <TokenType.NESTED: 'NESTED'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.STREAMLIT: 'STREAMLIT'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.XML: 'XML'>, <TokenType.DECIMAL128: 'DECIMAL128'>, <TokenType.JSON: 'JSON'>, <TokenType.NULL: 'NULL'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.JSONB: 'JSONB'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.RING: 'RING'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.MAP: 'MAP'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.SETTINGS: 'SETTINGS'>, <TokenType.MERGE: 'MERGE'>, <TokenType.CASE: 'CASE'>, <TokenType.ROLLUP: 'ROLLUP'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.ASOF: 'ASOF'>, <TokenType.SINK: 'SINK'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.UUID: 'UUID'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.ROWS: 'ROWS'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.POLYGON: 'POLYGON'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.SUPER: 'SUPER'>, <TokenType.FILTER: 'FILTER'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.ATTACH: 'ATTACH'>, <TokenType.INET: 'INET'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.CHAR: 'CHAR'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.DATETIME2: 'DATETIME2'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.INT256: 'INT256'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.PROCEDURE: 'PROCEDURE'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.DATE32: 'DATE32'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.SEMI: 'SEMI'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.ALL: 'ALL'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.MULTIPOLYGON: 'MULTIPOLYGON'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.UINT256: 'UINT256'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.STORAGE_INTEGRATION: 'STORAGE_INTEGRATION'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.VIEW: 'VIEW'>, <TokenType.DECIMAL64: 'DECIMAL64'>, <TokenType.ORDINALITY: 'ORDINALITY'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.KILL: 'KILL'>, <TokenType.CACHE: 'CACHE'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.DATE: 'DATE'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.ENUM: 'ENUM'>, <TokenType.TAG: 'TAG'>, <TokenType.KEEP: 'KEEP'>, <TokenType.TABLE: 'TABLE'>, <TokenType.CUBE: 'CUBE'>, <TokenType.BIT: 'BIT'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.IS: 'IS'>, <TokenType.COPY: 'COPY'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.DECIMAL256: 'DECIMAL256'>, <TokenType.UINT128: 'UINT128'>, <TokenType.SOME: 'SOME'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.SMALLDATETIME: 'SMALLDATETIME'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.REFERENCES: 'REFERENCES'>, <TokenType.UNIQUE: 'UNIQUE'>, <TokenType.DETACH: 'DETACH'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.DESC: 'DESC'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.DIV: 'DIV'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.LINESTRING: 'LINESTRING'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.VAR: 'VAR'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.SOURCE: 'SOURCE'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.ROW: 'ROW'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.RIGHT: 'RIGHT'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.TIME: 'TIME'>, <TokenType.TRUE: 'TRUE'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.TEXT: 'TEXT'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.YEAR: 'YEAR'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.MONEY: 'MONEY'>, <TokenType.SHOW: 'SHOW'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.IPV4: 'IPV4'>, <TokenType.ANY: 'ANY'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.FIRST: 'FIRST'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.INT128: 'INT128'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.UNIQUEIDENTIFIER: 'UNIQUEIDENTIFIER'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.RANGE: 'RANGE'>}
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>>, 'WATERMARK': <function Parser.<lambda>>, 'WITH': <function Parser.<lambda>>, 'INDEX': <function ClickHouse.Parser.<lambda>>, 'CODEC': <function ClickHouse.Parser.<lambda>>}
ALTER_PARSERS = {'ADD': <function Parser.<lambda>>, 'AS': <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>>, 'SWAP': <function Parser.<lambda>>, 'REPLACE': <function ClickHouse.Parser.<lambda>>}
SCHEMA_UNNAMED_CONSTRAINTS = {'EXCLUDE', 'LIKE', 'UNIQUE', 'CHECK', 'WATERMARK', 'PERIOD', 'INDEX', 'PRIMARY KEY', 'FOREIGN KEY'}
PLACEHOLDER_PARSERS = {<TokenType.PLACEHOLDER: 'PLACEHOLDER'>: <function Parser.<lambda>>, <TokenType.PARAMETER: 'PARAMETER'>: <function Parser.<lambda>>, <TokenType.COLON: 'COLON'>: <function Parser.<lambda>>, <TokenType.L_BRACE: 'L_BRACE'>: <function ClickHouse.Parser.<lambda>>}
SHOW_TRIE: Dict = {}
SET_TRIE: Dict = {'GLOBAL': {0: True}, 'LOCAL': {0: True}, 'SESSION': {0: True}, 'TRANSACTION': {0: True}}

##### Inherited Members

sqlglot.parser.Parser
  Parser
  STRUCT_TYPE_TOKENS
  NESTED_TYPE_TOKENS
  ENUM_TYPE_TOKENS
  AGGREGATE_TYPE_TOKENS
  TYPE_TOKENS
  SIGNED_TO_UNSIGNED_TYPE_TOKEN
  SUBQUERY_PREDICATES
  DB_CREATABLES
  CREATABLES
  ALTERABLES
  INTERVAL_VARS
  ARRAY_CONSTRUCTORS
  COMMENT_TABLE_ALIAS_TOKENS
  UPDATE_ALIAS_TOKENS
  TRIM_TYPES
  CONJUNCTION
  ASSIGNMENT
  DISJUNCTION
  EQUALITY
  COMPARISON
  BITWISE
  TERM
  FACTOR
  EXPONENT
  TIMES
  TIMESTAMPS
  SET_OPERATIONS
  JOIN_METHODS
  JOIN_SIDES
  JOIN_HINTS
  LAMBDAS
  EXPRESSION_PARSERS
  STATEMENT_PARSERS
  UNARY_PARSERS
  STRING_PARSERS
  NUMERIC_PARSERS
  PRIMARY_PARSERS
  ALTER_ALTER_PARSERS
  INVALID_FUNC_NAME_TOKENS
  KEY_VALUE_DEFINITIONS
  SET_PARSERS
  SHOW_PARSERS
  TYPE_LITERAL_PARSERS
  TYPE_CONVERTERS
  DDL_SELECT_TOKENS
  PRE_VOLATILE_TOKENS
  TRANSACTION_KIND
  TRANSACTION_CHARACTERISTICS
  CONFLICT_ACTIONS
  CREATE_SEQUENCE
  ISOLATED_LOADING_OPTIONS
  USABLES
  CAST_ACTIONS
  SCHEMA_BINDING_OPTIONS
  PROCEDURE_OPTIONS
  EXECUTE_AS_OPTIONS
  KEY_CONSTRAINT_OPTIONS
  INSERT_ALTERNATIVES
  CLONE_KEYWORDS
  HISTORICAL_DATA_PREFIX
  HISTORICAL_DATA_KIND
  OPCLASS_FOLLOW_KEYWORDS
  OPTYPE_FOLLOW_TOKENS
  TABLE_INDEX_HINT_TOKENS
  VIEW_ATTRIBUTES
  WINDOW_ALIAS_TOKENS
  WINDOW_BEFORE_PAREN_TOKENS
  WINDOW_SIDES
  JSON_KEY_VALUE_SEPARATOR_TOKENS
  FETCH_TOKENS
  ADD_CONSTRAINT_TOKENS
  DISTINCT_TOKENS
  NULL_TOKENS
  UNNEST_OFFSET_ALIAS_TOKENS
  SELECT_START_TOKENS
  COPY_INTO_VARLEN_OPTIONS
  IS_JSON_PREDICATE_KIND
  ODBC_DATETIME_LITERALS
  ON_CONDITION_TOKENS
  PRIVILEGE_FOLLOW_TOKENS
  DESCRIBE_STYLES
  ANALYZE_STYLES
  ANALYZE_EXPRESSION_PARSERS
  PARTITION_KEYWORDS
  AMBIGUOUS_ALIAS_TOKENS
  OPERATION_MODIFIERS
  STRICT_CAST
  PREFIXED_PIVOT_COLUMNS
  IDENTIFY_PIVOT_STRINGS
  ALTER_TABLE_ADD_REQUIRED_FOR_EACH_COLUMN
  TABLESAMPLE_CSV
  DEFAULT_SAMPLING_METHOD
  SET_REQUIRES_ASSIGNMENT_DELIMITER
  TRIM_PATTERN_FIRST
  STRING_ALIASES
  SET_OP_MODIFIERS
  NO_PAREN_IF_COMMANDS
  JSON_ARROWS_REQUIRE_JSON_TYPE
  COLON_IS_VARIANT_EXTRACT
  VALUES_FOLLOWED_BY_PAREN
  SUPPORTS_IMPLICIT_UNNEST
  SUPPORTS_PARTITION_SELECTION
  WRAPPED_TRANSFORM_COLUMN_CONSTRAINT
  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

     875    class Generator(generator.Generator):
     876        QUERY_HINTS = False
     877        STRUCT_DELIMITER = ("(", ")")
     878        NVL2_SUPPORTED = False
     879        TABLESAMPLE_REQUIRES_PARENS = False
     880        TABLESAMPLE_SIZE_IS_ROWS = False
     881        TABLESAMPLE_KEYWORDS = "SAMPLE"
     882        LAST_DAY_SUPPORTS_DATE_PART = False
     883        CAN_IMPLEMENT_ARRAY_ANY = True
     884        SUPPORTS_TO_NUMBER = False
     885        JOIN_HINTS = False
     886        TABLE_HINTS = False
     887        GROUPINGS_SEP = ""
     888        SET_OP_MODIFIERS = False
     889        SUPPORTS_TABLE_ALIAS_COLUMNS = False
     890        VALUES_AS_TABLE = False
     891        ARRAY_SIZE_NAME = "LENGTH"
     892
     893        STRING_TYPE_MAPPING = {
     894            exp.DataType.Type.CHAR: "String",
     895            exp.DataType.Type.LONGBLOB: "String",
     896            exp.DataType.Type.LONGTEXT: "String",
     897            exp.DataType.Type.MEDIUMBLOB: "String",
     898            exp.DataType.Type.MEDIUMTEXT: "String",
     899            exp.DataType.Type.TINYBLOB: "String",
     900            exp.DataType.Type.TINYTEXT: "String",
     901            exp.DataType.Type.TEXT: "String",
     902            exp.DataType.Type.VARBINARY: "String",
     903            exp.DataType.Type.VARCHAR: "String",
     904        }
     905
     906        SUPPORTED_JSON_PATH_PARTS = {
     907            exp.JSONPathKey,
     908            exp.JSONPathRoot,
     909            exp.JSONPathSubscript,
     910        }
     911
     912        TYPE_MAPPING = {
     913            **generator.Generator.TYPE_MAPPING,
     914            **STRING_TYPE_MAPPING,
     915            exp.DataType.Type.ARRAY: "Array",
     916            exp.DataType.Type.BOOLEAN: "Bool",
     917            exp.DataType.Type.BIGINT: "Int64",
     918            exp.DataType.Type.DATE32: "Date32",
     919            exp.DataType.Type.DATETIME: "DateTime",
     920            exp.DataType.Type.DATETIME2: "DateTime",
     921            exp.DataType.Type.SMALLDATETIME: "DateTime",
     922            exp.DataType.Type.DATETIME64: "DateTime64",
     923            exp.DataType.Type.DECIMAL: "Decimal",
     924            exp.DataType.Type.DECIMAL32: "Decimal32",
     925            exp.DataType.Type.DECIMAL64: "Decimal64",
     926            exp.DataType.Type.DECIMAL128: "Decimal128",
     927            exp.DataType.Type.DECIMAL256: "Decimal256",
     928            exp.DataType.Type.TIMESTAMP: "DateTime",
     929            exp.DataType.Type.TIMESTAMPTZ: "DateTime",
     930            exp.DataType.Type.DOUBLE: "Float64",
     931            exp.DataType.Type.ENUM: "Enum",
     932            exp.DataType.Type.ENUM8: "Enum8",
     933            exp.DataType.Type.ENUM16: "Enum16",
     934            exp.DataType.Type.FIXEDSTRING: "FixedString",
     935            exp.DataType.Type.FLOAT: "Float32",
     936            exp.DataType.Type.INT: "Int32",
     937            exp.DataType.Type.MEDIUMINT: "Int32",
     938            exp.DataType.Type.INT128: "Int128",
     939            exp.DataType.Type.INT256: "Int256",
     940            exp.DataType.Type.LOWCARDINALITY: "LowCardinality",
     941            exp.DataType.Type.MAP: "Map",
     942            exp.DataType.Type.NESTED: "Nested",
     943            exp.DataType.Type.SMALLINT: "Int16",
     944            exp.DataType.Type.STRUCT: "Tuple",
     945            exp.DataType.Type.TINYINT: "Int8",
     946            exp.DataType.Type.UBIGINT: "UInt64",
     947            exp.DataType.Type.UINT: "UInt32",
     948            exp.DataType.Type.UINT128: "UInt128",
     949            exp.DataType.Type.UINT256: "UInt256",
     950            exp.DataType.Type.USMALLINT: "UInt16",
     951            exp.DataType.Type.UTINYINT: "UInt8",
     952            exp.DataType.Type.IPV4: "IPv4",
     953            exp.DataType.Type.IPV6: "IPv6",
     954            exp.DataType.Type.POINT: "Point",
     955            exp.DataType.Type.RING: "Ring",
     956            exp.DataType.Type.LINESTRING: "LineString",
     957            exp.DataType.Type.MULTILINESTRING: "MultiLineString",
     958            exp.DataType.Type.POLYGON: "Polygon",
     959            exp.DataType.Type.MULTIPOLYGON: "MultiPolygon",
     960            exp.DataType.Type.AGGREGATEFUNCTION: "AggregateFunction",
     961            exp.DataType.Type.SIMPLEAGGREGATEFUNCTION: "SimpleAggregateFunction",
     962            exp.DataType.Type.DYNAMIC: "Dynamic",
     963        }
     964
     965        TRANSFORMS = {
     966            **generator.Generator.TRANSFORMS,
     967            exp.AnyValue: rename_func("any"),
     968            exp.ApproxDistinct: rename_func("uniq"),
     969            exp.ArrayFilter: lambda self, e: self.func("arrayFilter", e.expression, e.this),
     970            exp.ArraySum: rename_func("arraySum"),
     971            exp.ArgMax: arg_max_or_min_no_count("argMax"),
     972            exp.ArgMin: arg_max_or_min_no_count("argMin"),
     973            exp.Array: inline_array_sql,
     974            exp.CastToStrType: rename_func("CAST"),
     975            exp.CountIf: rename_func("countIf"),
     976            exp.CompressColumnConstraint: lambda self,
     977            e: f"CODEC({self.expressions(e, key='this', flat=True)})",
     978            exp.ComputedColumnConstraint: lambda self,
     979            e: f"{'MATERIALIZED' if e.args.get('persisted') else 'ALIAS'} {self.sql(e, 'this')}",
     980            exp.CurrentDate: lambda self, e: self.func("CURRENT_DATE"),
     981            exp.DateAdd: _datetime_delta_sql("DATE_ADD"),
     982            exp.DateDiff: _datetime_delta_sql("DATE_DIFF"),
     983            exp.DateStrToDate: rename_func("toDate"),
     984            exp.DateSub: _datetime_delta_sql("DATE_SUB"),
     985            exp.Explode: rename_func("arrayJoin"),
     986            exp.Final: lambda self, e: f"{self.sql(e, 'this')} FINAL",
     987            exp.IsNan: rename_func("isNaN"),
     988            exp.JSONExtract: json_extract_segments("JSONExtractString", quoted_index=False),
     989            exp.JSONExtractScalar: json_extract_segments("JSONExtractString", quoted_index=False),
     990            exp.JSONPathKey: json_path_key_only_name,
     991            exp.JSONPathRoot: lambda *_: "",
     992            exp.Length: length_or_char_length_sql,
     993            exp.Map: lambda self, e: _lower_func(var_map_sql(self, e)),
     994            exp.Median: rename_func("median"),
     995            exp.Nullif: rename_func("nullIf"),
     996            exp.PartitionedByProperty: lambda self, e: f"PARTITION BY {self.sql(e, 'this')}",
     997            exp.Pivot: no_pivot_sql,
     998            exp.Quantile: _quantile_sql,
     999            exp.RegexpLike: lambda self, e: self.func("match", e.this, e.expression),
    1000            exp.Rand: rename_func("randCanonical"),
    1001            exp.StartsWith: rename_func("startsWith"),
    1002            exp.StrPosition: lambda self, e: strposition_sql(
    1003                self,
    1004                e,
    1005                func_name="POSITION",
    1006                supports_position=True,
    1007                use_ansi_position=False,
    1008            ),
    1009            exp.TimeToStr: lambda self, e: self.func(
    1010                "formatDateTime", e.this, self.format_time(e), e.args.get("zone")
    1011            ),
    1012            exp.TimeStrToTime: _timestrtotime_sql,
    1013            exp.TimestampAdd: _datetime_delta_sql("TIMESTAMP_ADD"),
    1014            exp.TimestampSub: _datetime_delta_sql("TIMESTAMP_SUB"),
    1015            exp.VarMap: lambda self, e: _lower_func(var_map_sql(self, e)),
    1016            exp.Xor: lambda self, e: self.func("xor", e.this, e.expression, *e.expressions),
    1017            exp.MD5Digest: rename_func("MD5"),
    1018            exp.MD5: lambda self, e: self.func("LOWER", self.func("HEX", self.func("MD5", e.this))),
    1019            exp.SHA: rename_func("SHA1"),
    1020            exp.SHA2: sha256_sql,
    1021            exp.UnixToTime: _unix_to_time_sql,
    1022            exp.TimestampTrunc: timestamptrunc_sql(zone=True),
    1023            exp.Trim: trim_sql,
    1024            exp.Variance: rename_func("varSamp"),
    1025            exp.SchemaCommentProperty: lambda self, e: self.naked_property(e),
    1026            exp.Stddev: rename_func("stddevSamp"),
    1027            exp.Chr: rename_func("CHAR"),
    1028            exp.Lag: lambda self, e: self.func(
    1029                "lagInFrame", e.this, e.args.get("offset"), e.args.get("default")
    1030            ),
    1031            exp.Lead: lambda self, e: self.func(
    1032                "leadInFrame", e.this, e.args.get("offset"), e.args.get("default")
    1033            ),
    1034            exp.Levenshtein: unsupported_args("ins_cost", "del_cost", "sub_cost", "max_dist")(
    1035                rename_func("editDistance")
    1036            ),
    1037        }
    1038
    1039        PROPERTIES_LOCATION = {
    1040            **generator.Generator.PROPERTIES_LOCATION,
    1041            exp.OnCluster: exp.Properties.Location.POST_NAME,
    1042            exp.PartitionedByProperty: exp.Properties.Location.POST_SCHEMA,
    1043            exp.ToTableProperty: exp.Properties.Location.POST_NAME,
    1044            exp.VolatileProperty: exp.Properties.Location.UNSUPPORTED,
    1045        }
    1046
    1047        # There's no list in docs, but it can be found in Clickhouse code
    1048        # see `ClickHouse/src/Parsers/ParserCreate*.cpp`
    1049        ON_CLUSTER_TARGETS = {
    1050            "SCHEMA",  # Transpiled CREATE SCHEMA may have OnCluster property set
    1051            "DATABASE",
    1052            "TABLE",
    1053            "VIEW",
    1054            "DICTIONARY",
    1055            "INDEX",
    1056            "FUNCTION",
    1057            "NAMED COLLECTION",
    1058        }
    1059
    1060        # https://clickhouse.com/docs/en/sql-reference/data-types/nullable
    1061        NON_NULLABLE_TYPES = {
    1062            exp.DataType.Type.ARRAY,
    1063            exp.DataType.Type.MAP,
    1064            exp.DataType.Type.STRUCT,
    1065            exp.DataType.Type.POINT,
    1066            exp.DataType.Type.RING,
    1067            exp.DataType.Type.LINESTRING,
    1068            exp.DataType.Type.MULTILINESTRING,
    1069            exp.DataType.Type.POLYGON,
    1070            exp.DataType.Type.MULTIPOLYGON,
    1071        }
    1072
    1073        def strtodate_sql(self, expression: exp.StrToDate) -> str:
    1074            strtodate_sql = self.function_fallback_sql(expression)
    1075
    1076            if not isinstance(expression.parent, exp.Cast):
    1077                # StrToDate returns DATEs in other dialects (eg. postgres), so
    1078                # this branch aims to improve the transpilation to clickhouse
    1079                return f"CAST({strtodate_sql} AS DATE)"
    1080
    1081            return strtodate_sql
    1082
    1083        def cast_sql(self, expression: exp.Cast, safe_prefix: t.Optional[str] = None) -> str:
    1084            this = expression.this
    1085
    1086            if isinstance(this, exp.StrToDate) and expression.to == exp.DataType.build("datetime"):
    1087                return self.sql(this)
    1088
    1089            return super().cast_sql(expression, safe_prefix=safe_prefix)
    1090
    1091        def trycast_sql(self, expression: exp.TryCast) -> str:
    1092            dtype = expression.to
    1093            if not dtype.is_type(*self.NON_NULLABLE_TYPES, check_nullable=True):
    1094                # Casting x into Nullable(T) appears to behave similarly to TRY_CAST(x AS T)
    1095                dtype.set("nullable", True)
    1096
    1097            return super().cast_sql(expression)
    1098
    1099        def _jsonpathsubscript_sql(self, expression: exp.JSONPathSubscript) -> str:
    1100            this = self.json_path_part(expression.this)
    1101            return str(int(this) + 1) if is_int(this) else this
    1102
    1103        def likeproperty_sql(self, expression: exp.LikeProperty) -> str:
    1104            return f"AS {self.sql(expression, 'this')}"
    1105
    1106        def _any_to_has(
    1107            self,
    1108            expression: exp.EQ | exp.NEQ,
    1109            default: t.Callable[[t.Any], str],
    1110            prefix: str = "",
    1111        ) -> str:
    1112            if isinstance(expression.left, exp.Any):
    1113                arr = expression.left
    1114                this = expression.right
    1115            elif isinstance(expression.right, exp.Any):
    1116                arr = expression.right
    1117                this = expression.left
    1118            else:
    1119                return default(expression)
    1120
    1121            return prefix + self.func("has", arr.this.unnest(), this)
    1122
    1123        def eq_sql(self, expression: exp.EQ) -> str:
    1124            return self._any_to_has(expression, super().eq_sql)
    1125
    1126        def neq_sql(self, expression: exp.NEQ) -> str:
    1127            return self._any_to_has(expression, super().neq_sql, "NOT ")
    1128
    1129        def regexpilike_sql(self, expression: exp.RegexpILike) -> str:
    1130            # Manually add a flag to make the search case-insensitive
    1131            regex = self.func("CONCAT", "'(?i)'", expression.expression)
    1132            return self.func("match", expression.this, regex)
    1133
    1134        def datatype_sql(self, expression: exp.DataType) -> str:
    1135            # String is the standard ClickHouse type, every other variant is just an alias.
    1136            # Additionally, any supplied length parameter will be ignored.
    1137            #
    1138            # https://clickhouse.com/docs/en/sql-reference/data-types/string
    1139            if expression.this in self.STRING_TYPE_MAPPING:
    1140                dtype = "String"
    1141            else:
    1142                dtype = super().datatype_sql(expression)
    1143
    1144            # This section changes the type to `Nullable(...)` if the following conditions hold:
    1145            # - It's marked as nullable - this ensures we won't wrap ClickHouse types with `Nullable`
    1146            #   and change their semantics
    1147            # - It's not the key type of a `Map`. This is because ClickHouse enforces the following
    1148            #   constraint: "Type of Map key must be a type, that can be represented by integer or
    1149            #   String or FixedString (possibly LowCardinality) or UUID or IPv6"
    1150            # - It's not a composite type, e.g. `Nullable(Array(...))` is not a valid type
    1151            parent = expression.parent
    1152            nullable = expression.args.get("nullable")
    1153            if nullable is True or (
    1154                nullable is None
    1155                and not (
    1156                    isinstance(parent, exp.DataType)
    1157                    and parent.is_type(exp.DataType.Type.MAP, check_nullable=True)
    1158                    and expression.index in (None, 0)
    1159                )
    1160                and not expression.is_type(*self.NON_NULLABLE_TYPES, check_nullable=True)
    1161            ):
    1162                dtype = f"Nullable({dtype})"
    1163
    1164            return dtype
    1165
    1166        def cte_sql(self, expression: exp.CTE) -> str:
    1167            if expression.args.get("scalar"):
    1168                this = self.sql(expression, "this")
    1169                alias = self.sql(expression, "alias")
    1170                return f"{this} AS {alias}"
    1171
    1172            return super().cte_sql(expression)
    1173
    1174        def after_limit_modifiers(self, expression: exp.Expression) -> t.List[str]:
    1175            return super().after_limit_modifiers(expression) + [
    1176                (
    1177                    self.seg("SETTINGS ") + self.expressions(expression, key="settings", flat=True)
    1178                    if expression.args.get("settings")
    1179                    else ""
    1180                ),
    1181                (
    1182                    self.seg("FORMAT ") + self.sql(expression, "format")
    1183                    if expression.args.get("format")
    1184                    else ""
    1185                ),
    1186            ]
    1187
    1188        def parameterizedagg_sql(self, expression: exp.ParameterizedAgg) -> str:
    1189            params = self.expressions(expression, key="params", flat=True)
    1190            return self.func(expression.name, *expression.expressions) + f"({params})"
    1191
    1192        def anonymousaggfunc_sql(self, expression: exp.AnonymousAggFunc) -> str:
    1193            return self.func(expression.name, *expression.expressions)
    1194
    1195        def combinedaggfunc_sql(self, expression: exp.CombinedAggFunc) -> str:
    1196            return self.anonymousaggfunc_sql(expression)
    1197
    1198        def combinedparameterizedagg_sql(self, expression: exp.CombinedParameterizedAgg) -> str:
    1199            return self.parameterizedagg_sql(expression)
    1200
    1201        def placeholder_sql(self, expression: exp.Placeholder) -> str:
    1202            return f"{{{expression.name}: {self.sql(expression, 'kind')}}}"
    1203
    1204        def oncluster_sql(self, expression: exp.OnCluster) -> str:
    1205            return f"ON CLUSTER {self.sql(expression, 'this')}"
    1206
    1207        def createable_sql(self, expression: exp.Create, locations: t.DefaultDict) -> str:
    1208            if expression.kind in self.ON_CLUSTER_TARGETS and locations.get(
    1209                exp.Properties.Location.POST_NAME
    1210            ):
    1211                this_name = self.sql(
    1212                    expression.this if isinstance(expression.this, exp.Schema) else expression,
    1213                    "this",
    1214                )
    1215                this_properties = " ".join(
    1216                    [self.sql(prop) for prop in locations[exp.Properties.Location.POST_NAME]]
    1217                )
    1218                this_schema = self.schema_columns_sql(expression.this)
    1219                this_schema = f"{self.sep()}{this_schema}" if this_schema else ""
    1220
    1221                return f"{this_name}{self.sep()}{this_properties}{this_schema}"
    1222
    1223            return super().createable_sql(expression, locations)
    1224
    1225        def create_sql(self, expression: exp.Create) -> str:
    1226            # The comment property comes last in CTAS statements, i.e. after the query
    1227            query = expression.expression
    1228            if isinstance(query, exp.Query):
    1229                comment_prop = expression.find(exp.SchemaCommentProperty)
    1230                if comment_prop:
    1231                    comment_prop.pop()
    1232                    query.replace(exp.paren(query))
    1233            else:
    1234                comment_prop = None
    1235
    1236            create_sql = super().create_sql(expression)
    1237
    1238            comment_sql = self.sql(comment_prop)
    1239            comment_sql = f" {comment_sql}" if comment_sql else ""
    1240
    1241            return f"{create_sql}{comment_sql}"
    1242
    1243        def prewhere_sql(self, expression: exp.PreWhere) -> str:
    1244            this = self.indent(self.sql(expression, "this"))
    1245            return f"{self.seg('PREWHERE')}{self.sep()}{this}"
    1246
    1247        def indexcolumnconstraint_sql(self, expression: exp.IndexColumnConstraint) -> str:
    1248            this = self.sql(expression, "this")
    1249            this = f" {this}" if this else ""
    1250            expr = self.sql(expression, "expression")
    1251            expr = f" {expr}" if expr else ""
    1252            index_type = self.sql(expression, "index_type")
    1253            index_type = f" TYPE {index_type}" if index_type else ""
    1254            granularity = self.sql(expression, "granularity")
    1255            granularity = f" GRANULARITY {granularity}" if granularity else ""
    1256
    1257            return f"INDEX{this}{expr}{index_type}{granularity}"
    1258
    1259        def partition_sql(self, expression: exp.Partition) -> str:
    1260            return f"PARTITION {self.expressions(expression, flat=True)}"
    1261
    1262        def partitionid_sql(self, expression: exp.PartitionId) -> str:
    1263            return f"ID {self.sql(expression.this)}"
    1264
    1265        def replacepartition_sql(self, expression: exp.ReplacePartition) -> str:
    1266            return (
    1267                f"REPLACE {self.sql(expression.expression)} FROM {self.sql(expression, 'source')}"
    1268            )
    1269
    1270        def projectiondef_sql(self, expression: exp.ProjectionDef) -> str:
    1271            return f"PROJECTION {self.sql(expression.this)} {self.wrap(expression.expression)}"
    1272
    1273        def is_sql(self, expression: exp.Is) -> str:
    1274            is_sql = super().is_sql(expression)
    1275
    1276            if isinstance(expression.parent, exp.Not):
    1277                # value IS NOT NULL -> NOT (value IS NULL)
    1278                is_sql = self.wrap(is_sql)
    1279
    1280            return is_sql

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

###### Arguments:

- pretty: Whether to format the produced SQL string. Default: False.
- identify: Determines when an identifier should be quoted. Possible values are: False (default): Never quote, except in cases where it's mandatory by the dialect. True or 'always': Always quote. 'safe': Only quote identifiers that are case insensitive.
- normalize: Whether to normalize identifiers to lowercase. Default: False.
- pad: The pad size in a formatted string. For example, this affects the indentation of a projection in a query, relative to its nesting level. Default: 2.
- indent: The indentation size in a formatted string. For example, this affects the indentation of subqueries and filters under a `WHERE` clause. Default: 2.
- normalize_functions: How to normalize function names. Possible values are: "upper" or True (default): Convert names to uppercase. "lower": Convert names to lowercase. False: Disables function name normalization.
- unsupported_level: Determines the generator's behavior when it encounters unsupported expressions. Default ErrorLevel.WARN.
- max_unsupported: Maximum number of unsupported messages to include in a raised UnsupportedError. This is only relevant if unsupported_level is ErrorLevel.RAISE. Default: 3
- leading_comma: Whether the comma is leading or trailing in select expressions. This is only relevant when generating in pretty mode. Default: False
- max_text_width: The max number of characters in a segment before creating new lines in pretty mode. The default is on the smaller end because the length only represents a segment and not the true line length. Default: 80
- comments: Whether to preserve comments in the output SQL code. Default: True

QUERY_HINTS = False
STRUCT_DELIMITER = ('(', ')')
NVL2_SUPPORTED = False
TABLESAMPLE_REQUIRES_PARENS = False
TABLESAMPLE_SIZE_IS_ROWS = False
TABLESAMPLE_KEYWORDS = 'SAMPLE'
LAST_DAY_SUPPORTS_DATE_PART = False
CAN_IMPLEMENT_ARRAY_ANY = True
SUPPORTS_TO_NUMBER = False
JOIN_HINTS = False
TABLE_HINTS = False
GROUPINGS_SEP = ''
SET_OP_MODIFIERS = False
SUPPORTS_TABLE_ALIAS_COLUMNS = False
VALUES_AS_TABLE = False
ARRAY_SIZE_NAME = 'LENGTH'
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.JSONPathSubscript'>, <class 'sqlglot.expressions.JSONPathKey'>, <class 'sqlglot.expressions.JSONPathRoot'>}
TYPE_MAPPING = {<Type.DATETIME2: 'DATETIME2'>: 'DateTime', <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.SMALLDATETIME: 'SMALLDATETIME'>: 'DateTime', <Type.CHAR: 'CHAR'>: 'String', <Type.TEXT: 'TEXT'>: 'String', <Type.VARBINARY: 'VARBINARY'>: 'String', <Type.VARCHAR: 'VARCHAR'>: 'String', <Type.ARRAY: 'ARRAY'>: 'Array', <Type.BOOLEAN: 'BOOLEAN'>: 'Bool', <Type.BIGINT: 'BIGINT'>: 'Int64', <Type.DATE32: 'DATE32'>: 'Date32', <Type.DATETIME: 'DATETIME'>: 'DateTime', <Type.DATETIME64: 'DATETIME64'>: 'DateTime64', <Type.DECIMAL: 'DECIMAL'>: 'Decimal', <Type.DECIMAL32: 'DECIMAL32'>: 'Decimal32', <Type.DECIMAL64: 'DECIMAL64'>: 'Decimal64', <Type.DECIMAL128: 'DECIMAL128'>: 'Decimal128', <Type.DECIMAL256: 'DECIMAL256'>: 'Decimal256', <Type.TIMESTAMP: 'TIMESTAMP'>: 'DateTime', <Type.TIMESTAMPTZ: 'TIMESTAMPTZ'>: 'DateTime', <Type.DOUBLE: 'DOUBLE'>: 'Float64', <Type.ENUM: 'ENUM'>: 'Enum', <Type.ENUM8: 'ENUM8'>: 'Enum8', <Type.ENUM16: 'ENUM16'>: 'Enum16', <Type.FIXEDSTRING: 'FIXEDSTRING'>: 'FixedString', <Type.FLOAT: 'FLOAT'>: 'Float32', <Type.INT: 'INT'>: 'Int32', <Type.MEDIUMINT: 'MEDIUMINT'>: 'Int32', <Type.INT128: 'INT128'>: 'Int128', <Type.INT256: 'INT256'>: 'Int256', <Type.LOWCARDINALITY: 'LOWCARDINALITY'>: 'LowCardinality', <Type.MAP: 'MAP'>: 'Map', <Type.NESTED: 'NESTED'>: 'Nested', <Type.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.POINT: 'POINT'>: 'Point', <Type.RING: 'RING'>: 'Ring', <Type.LINESTRING: 'LINESTRING'>: 'LineString', <Type.MULTILINESTRING: 'MULTILINESTRING'>: 'MultiLineString', <Type.POLYGON: 'POLYGON'>: 'Polygon', <Type.MULTIPOLYGON: 'MULTIPOLYGON'>: 'MultiPolygon', <Type.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>: 'AggregateFunction', <Type.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>: 'SimpleAggregateFunction', <Type.DYNAMIC: 'DYNAMIC'>: 'Dynamic'}
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.AnalyzeColumns'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.AnalyzeWith'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ArrayContainsAll'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ArrayOverlaps'>: <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.Ceil'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CharacterSetColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CharacterSetProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ClusteredColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CollateColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CommentColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ConnectByRoot'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CopyGrantsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.DateFormatColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.DefaultColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.DynamicProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.EmptyProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.EncodeColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.EphemeralColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ExcludeColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ExecuteAsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Except'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ExternalProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Floor'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.GlobalProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.HeapProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.IcebergProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.InheritsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.InlineLengthColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.InputModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Intersect'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.IntervalSpan'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Int64'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.LanguageProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.LocationProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.LogProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.MaterializedProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.NonClusteredColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.NoPrimaryIndexProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.NotForReplicationColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.OnCommitProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.OnProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.OnUpdateColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Operator'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.OutputModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.PathColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.PivotAny'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ProjectionPolicyColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.RemoteWithConnectionModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ReturnsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SampleProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SecureProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SecurityProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SetConfigProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SetProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SettingsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SharingProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SqlReadWriteProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SqlSecurityProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.StabilityProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Stream'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.StreamingTableProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.StrictProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SwapTable'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TemporaryProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Tags'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TitleColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ToMap'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ToTableProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TransformModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TransientProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Union'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.UnloggedProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.UsingData'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Uuid'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.UppercaseColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.VarMap'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.ViewAttributeProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.VolatileProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WithJournalTableProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WithProcedureOptions'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WithSchemaBindingProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WithOperator'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.AnyValue'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.ApproxDistinct'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.ArrayFilter'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.ArraySum'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.ArgMax'>: <function arg_max_or_min_no_count.<locals>._arg_max_or_min_sql>, <class 'sqlglot.expressions.ArgMin'>: <function arg_max_or_min_no_count.<locals>._arg_max_or_min_sql>, <class 'sqlglot.expressions.Array'>: <function inline_array_sql>, <class 'sqlglot.expressions.CastToStrType'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.CountIf'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.CompressColumnConstraint'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.ComputedColumnConstraint'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.CurrentDate'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.DateAdd'>: <function _datetime_delta_sql.<locals>._delta_sql>, <class 'sqlglot.expressions.DateDiff'>: <function _datetime_delta_sql.<locals>._delta_sql>, <class 'sqlglot.expressions.DateStrToDate'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.DateSub'>: <function _datetime_delta_sql.<locals>._delta_sql>, <class 'sqlglot.expressions.Explode'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.Final'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.IsNan'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.JSONExtract'>: <function json_extract_segments.<locals>._json_extract_segments>, <class 'sqlglot.expressions.JSONExtractScalar'>: <function json_extract_segments.<locals>._json_extract_segments>, <class 'sqlglot.expressions.Length'>: <function length_or_char_length_sql>, <class 'sqlglot.expressions.Map'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.Median'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.Nullif'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.PartitionedByProperty'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.Pivot'>: <function no_pivot_sql>, <class 'sqlglot.expressions.Quantile'>: <function _quantile_sql>, <class 'sqlglot.expressions.RegexpLike'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.Rand'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.StartsWith'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.StrPosition'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.TimeToStr'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.TimeStrToTime'>: <function _timestrtotime_sql>, <class 'sqlglot.expressions.TimestampAdd'>: <function _datetime_delta_sql.<locals>._delta_sql>, <class 'sqlglot.expressions.TimestampSub'>: <function _datetime_delta_sql.<locals>._delta_sql>, <class 'sqlglot.expressions.Xor'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.MD5Digest'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.MD5'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.SHA'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.SHA2'>: <function sha256_sql>, <class 'sqlglot.expressions.UnixToTime'>: <function _unix_to_time_sql>, <class 'sqlglot.expressions.TimestampTrunc'>: <function timestamptrunc_sql.<locals>._timestamptrunc_sql>, <class 'sqlglot.expressions.Trim'>: <function trim_sql>, <class 'sqlglot.expressions.Variance'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.SchemaCommentProperty'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.Stddev'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.Chr'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.Lag'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.Lead'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.Levenshtein'>: <function rename_func.<locals>.<lambda>>}
PROPERTIES_LOCATION = {<class 'sqlglot.expressions.AllowedValuesProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.AlgorithmProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.AutoIncrementProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.AutoRefreshProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.BackupProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.BlockCompressionProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.CharacterSetProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ChecksumProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.CollateProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.CopyGrantsProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.Cluster'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ClusteredByProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DistributedByProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DuplicateKeyProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DataBlocksizeProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.DataDeletionProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DefinerProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.DictRange'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DictProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DynamicProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.DistKeyProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DistStyleProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.EmptyProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.EncodeProperty'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <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.IncludeProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.InputModelProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.IsolatedLoadingProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.JournalProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.LanguageProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.LikeProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.LocationProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.LockProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.LockingProperty'>: <Location.POST_ALIAS: 'POST_ALIAS'>, <class 'sqlglot.expressions.LogProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.MaterializedProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.MergeBlockRatioProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.NoPrimaryIndexProperty'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.OnProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.OnCommitProperty'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.Order'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.OutputModelProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.PartitionedByProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.PartitionedOfProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.PrimaryKey'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.Property'>: <Location.POST_WITH: 'POST_WITH'>, <class 'sqlglot.expressions.RemoteWithConnectionModelProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ReturnsProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.RowFormatProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.RowFormatDelimitedProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.RowFormatSerdeProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SampleProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SchemaCommentProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SecureProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.SecurityProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SerdeProperties'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.Set'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SettingsProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SetProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.SetConfigProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SharingProperty'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.SequenceProperties'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.SortKeyProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SqlReadWriteProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SqlSecurityProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.StabilityProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.StreamingTableProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.StrictProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.Tags'>: <Location.POST_WITH: 'POST_WITH'>, <class 'sqlglot.expressions.TemporaryProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.ToTableProperty'>: <Location.POST_NAME: 'POST_NAME'>, <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.WithProcedureOptions'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.WithSchemaBindingProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.WithSystemVersioningProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.OnCluster'>: <Location.POST_NAME: 'POST_NAME'>}
ON_CLUSTER_TARGETS = {'VIEW', 'NAMED COLLECTION', 'SCHEMA', 'DATABASE', 'INDEX', 'FUNCTION', 'DICTIONARY', 'TABLE'}
NON_NULLABLE_TYPES = {<Type.ARRAY: 'ARRAY'>, <Type.STRUCT: 'STRUCT'>, <Type.MULTILINESTRING: 'MULTILINESTRING'>, <Type.POINT: 'POINT'>, <Type.RING: 'RING'>, <Type.MAP: 'MAP'>, <Type.LINESTRING: 'LINESTRING'>, <Type.MULTIPOLYGON: 'MULTIPOLYGON'>, <Type.POLYGON: 'POLYGON'>}
def strtodate_sql(self, expression: sqlglot.expressions.StrToDate) -> str: View Source

    1073        def strtodate_sql(self, expression: exp.StrToDate) -> str:
    1074            strtodate_sql = self.function_fallback_sql(expression)
    1075
    1076            if not isinstance(expression.parent, exp.Cast):
    1077                # StrToDate returns DATEs in other dialects (eg. postgres), so
    1078                # this branch aims to improve the transpilation to clickhouse
    1079                return f"CAST({strtodate_sql} AS DATE)"
    1080
    1081            return strtodate_sql

def cast_sql( self, expression: sqlglot.expressions.Cast, safe_prefix: Optional[str] = None) -> str: View Source

    1083        def cast_sql(self, expression: exp.Cast, safe_prefix: t.Optional[str] = None) -> str:
    1084            this = expression.this
    1085
    1086            if isinstance(this, exp.StrToDate) and expression.to == exp.DataType.build("datetime"):
    1087                return self.sql(this)
    1088
    1089            return super().cast_sql(expression, safe_prefix=safe_prefix)

def trycast_sql(self, expression: sqlglot.expressions.TryCast) -> str: View Source

    1091        def trycast_sql(self, expression: exp.TryCast) -> str:
    1092            dtype = expression.to
    1093            if not dtype.is_type(*self.NON_NULLABLE_TYPES, check_nullable=True):
    1094                # Casting x into Nullable(T) appears to behave similarly to TRY_CAST(x AS T)
    1095                dtype.set("nullable", True)
    1096
    1097            return super().cast_sql(expression)

def likeproperty_sql(self, expression: sqlglot.expressions.LikeProperty) -> str: View Source

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

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

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

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

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

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

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

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

    1134        def datatype_sql(self, expression: exp.DataType) -> str:
    1135            # String is the standard ClickHouse type, every other variant is just an alias.
    1136            # Additionally, any supplied length parameter will be ignored.
    1137            #
    1138            # https://clickhouse.com/docs/en/sql-reference/data-types/string
    1139            if expression.this in self.STRING_TYPE_MAPPING:
    1140                dtype = "String"
    1141            else:
    1142                dtype = super().datatype_sql(expression)
    1143
    1144            # This section changes the type to `Nullable(...)` if the following conditions hold:
    1145            # - It's marked as nullable - this ensures we won't wrap ClickHouse types with `Nullable`
    1146            #   and change their semantics
    1147            # - It's not the key type of a `Map`. This is because ClickHouse enforces the following
    1148            #   constraint: "Type of Map key must be a type, that can be represented by integer or
    1149            #   String or FixedString (possibly LowCardinality) or UUID or IPv6"
    1150            # - It's not a composite type, e.g. `Nullable(Array(...))` is not a valid type
    1151            parent = expression.parent
    1152            nullable = expression.args.get("nullable")
    1153            if nullable is True or (
    1154                nullable is None
    1155                and not (
    1156                    isinstance(parent, exp.DataType)
    1157                    and parent.is_type(exp.DataType.Type.MAP, check_nullable=True)
    1158                    and expression.index in (None, 0)
    1159                )
    1160                and not expression.is_type(*self.NON_NULLABLE_TYPES, check_nullable=True)
    1161            ):
    1162                dtype = f"Nullable({dtype})"
    1163
    1164            return dtype

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

    1166        def cte_sql(self, expression: exp.CTE) -> str:
    1167            if expression.args.get("scalar"):
    1168                this = self.sql(expression, "this")
    1169                alias = self.sql(expression, "alias")
    1170                return f"{this} AS {alias}"
    1171
    1172            return super().cte_sql(expression)

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

    1174        def after_limit_modifiers(self, expression: exp.Expression) -> t.List[str]:
    1175            return super().after_limit_modifiers(expression) + [
    1176                (
    1177                    self.seg("SETTINGS ") + self.expressions(expression, key="settings", flat=True)
    1178                    if expression.args.get("settings")
    1179                    else ""
    1180                ),
    1181                (
    1182                    self.seg("FORMAT ") + self.sql(expression, "format")
    1183                    if expression.args.get("format")
    1184                    else ""
    1185                ),
    1186            ]

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

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

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

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

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

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

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

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

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

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

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

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

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

    1207        def createable_sql(self, expression: exp.Create, locations: t.DefaultDict) -> str:
    1208            if expression.kind in self.ON_CLUSTER_TARGETS and locations.get(
    1209                exp.Properties.Location.POST_NAME
    1210            ):
    1211                this_name = self.sql(
    1212                    expression.this if isinstance(expression.this, exp.Schema) else expression,
    1213                    "this",
    1214                )
    1215                this_properties = " ".join(
    1216                    [self.sql(prop) for prop in locations[exp.Properties.Location.POST_NAME]]
    1217                )
    1218                this_schema = self.schema_columns_sql(expression.this)
    1219                this_schema = f"{self.sep()}{this_schema}" if this_schema else ""
    1220
    1221                return f"{this_name}{self.sep()}{this_properties}{this_schema}"
    1222
    1223            return super().createable_sql(expression, locations)

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

    1225        def create_sql(self, expression: exp.Create) -> str:
    1226            # The comment property comes last in CTAS statements, i.e. after the query
    1227            query = expression.expression
    1228            if isinstance(query, exp.Query):
    1229                comment_prop = expression.find(exp.SchemaCommentProperty)
    1230                if comment_prop:
    1231                    comment_prop.pop()
    1232                    query.replace(exp.paren(query))
    1233            else:
    1234                comment_prop = None
    1235
    1236            create_sql = super().create_sql(expression)
    1237
    1238            comment_sql = self.sql(comment_prop)
    1239            comment_sql = f" {comment_sql}" if comment_sql else ""
    1240
    1241            return f"{create_sql}{comment_sql}"

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

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

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

    1247        def indexcolumnconstraint_sql(self, expression: exp.IndexColumnConstraint) -> str:
    1248            this = self.sql(expression, "this")
    1249            this = f" {this}" if this else ""
    1250            expr = self.sql(expression, "expression")
    1251            expr = f" {expr}" if expr else ""
    1252            index_type = self.sql(expression, "index_type")
    1253            index_type = f" TYPE {index_type}" if index_type else ""
    1254            granularity = self.sql(expression, "granularity")
    1255            granularity = f" GRANULARITY {granularity}" if granularity else ""
    1256
    1257            return f"INDEX{this}{expr}{index_type}{granularity}"

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

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

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

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

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

    1265        def replacepartition_sql(self, expression: exp.ReplacePartition) -> str:
    1266            return (
    1267                f"REPLACE {self.sql(expression.expression)} FROM {self.sql(expression, 'source')}"
    1268            )

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

    1270        def projectiondef_sql(self, expression: exp.ProjectionDef) -> str:
    1271            return f"PROJECTION {self.sql(expression.this)} {self.wrap(expression.expression)}"

def is_sql(self, expression: sqlglot.expressions.Is) -> str: View Source

    1273        def is_sql(self, expression: exp.Is) -> str:
    1274            is_sql = super().is_sql(expression)
    1275
    1276            if isinstance(expression.parent, exp.Not):
    1277                # value IS NOT NULL -> NOT (value IS NULL)
    1278                is_sql = self.wrap(is_sql)
    1279
    1280            return is_sql

SELECT_KINDS: Tuple[str, ...] = ()
TRY_SUPPORTED = False
SUPPORTS_UESCAPE = False
AFTER_HAVING_MODIFIER_TRANSFORMS = {'windows': <function Generator.<lambda>>, 'qualify': <function Generator.<lambda>>}

##### Inherited Members

sqlglot.generator.Generator
  Generator
  NULL_ORDERING_SUPPORTED
  IGNORE_NULLS_IN_FUNC
  LOCKING_READS_SUPPORTED
  EXCEPT_INTERSECT_SUPPORT_ALL_CLAUSE
  WRAP_DERIVED_VALUES
  CREATE_FUNCTION_RETURN_AS
  MATCHED_BY_SOURCE
  SINGLE_STRING_INTERVAL
  INTERVAL_ALLOWS_PLURAL_FORM
  LIMIT_FETCH
  LIMIT_ONLY_LITERALS
  RENAME_TABLE_WITH_DB
  INDEX_ON
  QUERY_HINT_SEP
  IS_BOOL_ALLOWED
  DUPLICATE_KEY_UPDATE_WITH_SET
  LIMIT_IS_TOP
  RETURNING_END
  EXTRACT_ALLOWS_QUOTES
  TZ_TO_WITH_TIME_ZONE
  ALTER_TABLE_INCLUDE_COLUMN_KEYWORD
  UNNEST_WITH_ORDINALITY
  AGGREGATE_FILTER_SUPPORTED
  SEMI_ANTI_JOIN_WITH_SIDE
  COMPUTED_COLUMN_WITH_TYPE
  SUPPORTS_TABLE_COPY
  TABLESAMPLE_WITH_METHOD
  TABLESAMPLE_SEED_KEYWORD
  COLLATE_IS_FUNC
  DATA_TYPE_SPECIFIERS_ALLOWED
  ENSURE_BOOLS
  CTE_RECURSIVE_KEYWORD_REQUIRED
  SUPPORTS_SINGLE_ARG_CONCAT
  UNPIVOT_ALIASES_ARE_IDENTIFIERS
  JSON_KEY_VALUE_PAIR_SEP
  INSERT_OVERWRITE
  SUPPORTS_SELECT_INTO
  SUPPORTS_UNLOGGED_TABLES
  SUPPORTS_CREATE_TABLE_LIKE
  LIKE_PROPERTY_INSIDE_SCHEMA
  MULTI_ARG_DISTINCT
  JSON_TYPE_REQUIRED_FOR_EXTRACTION
  JSON_PATH_BRACKETED_KEY_SUPPORTED
  JSON_PATH_SINGLE_QUOTE_ESCAPE
  COPY_PARAMS_ARE_WRAPPED
  COPY_PARAMS_EQ_REQUIRED
  COPY_HAS_INTO_KEYWORD
  STAR_EXCEPT
  HEX_FUNC
  WITH_PROPERTIES_PREFIX
  QUOTE_JSON_PATH
  PAD_FILL_PATTERN_IS_REQUIRED
  SUPPORTS_EXPLODING_PROJECTIONS
  ARRAY_CONCAT_IS_VAR_LEN
  SUPPORTS_CONVERT_TIMEZONE
  SUPPORTS_MEDIAN
  SUPPORTS_UNIX_SECONDS
  PARSE_JSON_NAME
  ARRAY_SIZE_DIM_REQUIRED
  TIME_PART_SINGULARS
  TOKEN_MAPPING
  PARAMETER_TOKEN
  NAMED_PLACEHOLDER_TOKEN
  EXPRESSION_PRECEDES_PROPERTIES_CREATABLES
  RESERVED_KEYWORDS
  WITH_SEPARATED_COMMENTS
  EXCLUDE_COMMENTS
  UNWRAPPED_INTERVAL_VALUES
  PARAMETERIZABLE_TEXT_TYPES
  EXPRESSIONS_WITHOUT_NESTED_CTES
  SENTINEL_LINE_BREAK
  pretty
  identify
  normalize
  pad
  unsupported_level
  max_unsupported
  leading_comma
  max_text_width
  comments
  dialect
  normalize_functions
  unsupported_messages
  generate
  preprocess
  unsupported
  sep
  seg
  pad_comment
  maybe_comment
  wrap
  no_identify
  normalize_func
  indent
  sql
  uncache_sql
  cache_sql
  characterset_sql
  column_parts
  column_sql
  columnposition_sql
  columndef_sql
  columnconstraint_sql
  computedcolumnconstraint_sql
  autoincrementcolumnconstraint_sql
  compresscolumnconstraint_sql
  generatedasidentitycolumnconstraint_sql
  generatedasrowcolumnconstraint_sql
  periodforsystemtimeconstraint_sql
  notnullcolumnconstraint_sql
  transformcolumnconstraint_sql
  primarykeycolumnconstraint_sql
  uniquecolumnconstraint_sql
  sequenceproperties_sql
  clone_sql
  describe_sql
  heredoc_sql
  prepend_ctes
  with_sql
  tablealias_sql
  bitstring_sql
  hexstring_sql
  bytestring_sql
  unicodestring_sql
  rawstring_sql
  datatypeparam_sql
  directory_sql
  delete_sql
  drop_sql
  set_operation
  set_operations
  fetch_sql
  filter_sql
  hint_sql
  indexparameters_sql
  index_sql
  identifier_sql
  hex_sql
  lowerhex_sql
  inputoutputformat_sql
  national_sql
  properties_sql
  root_properties
  properties
  with_properties
  locate_properties
  property_name
  property_sql
  fallbackproperty_sql
  journalproperty_sql
  freespaceproperty_sql
  checksumproperty_sql
  mergeblockratioproperty_sql
  datablocksizeproperty_sql
  blockcompressionproperty_sql
  isolatedloadingproperty_sql
  partitionboundspec_sql
  partitionedofproperty_sql
  lockingproperty_sql
  withdataproperty_sql
  withsystemversioningproperty_sql
  insert_sql
  introducer_sql
  kill_sql
  pseudotype_sql
  objectidentifier_sql
  onconflict_sql
  returning_sql
  rowformatdelimitedproperty_sql
  withtablehint_sql
  indextablehint_sql
  historicaldata_sql
  table_parts
  table_sql
  tablesample_sql
  pivot_sql
  version_sql
  tuple_sql
  update_sql
  values_sql
  var_sql
  into_sql
  from_sql
  groupingsets_sql
  rollup_sql
  cube_sql
  group_sql
  having_sql
  connect_sql
  prior_sql
  join_sql
  lambda_sql
  lateral_op
  lateral_sql
  limit_sql
  offset_sql
  setitem_sql
  set_sql
  pragma_sql
  lock_sql
  literal_sql
  escape_str
  loaddata_sql
  null_sql
  boolean_sql
  order_sql
  withfill_sql
  cluster_sql
  distribute_sql
  sort_sql
  ordered_sql
  matchrecognizemeasure_sql
  matchrecognize_sql
  query_modifiers
  options_modifier
  queryoption_sql
  offset_limit_modifiers
  select_sql
  schema_sql
  schema_columns_sql
  star_sql
  parameter_sql
  sessionparameter_sql
  subquery_sql
  qualify_sql
  unnest_sql
  where_sql
  window_sql
  partition_by_sql
  windowspec_sql
  withingroup_sql
  between_sql
  bracket_offset_expressions
  bracket_sql
  all_sql
  any_sql
  exists_sql
  case_sql
  constraint_sql
  nextvaluefor_sql
  extract_sql
  trim_sql
  convert_concat_args
  concat_sql
  concatws_sql
  check_sql
  foreignkey_sql
  primarykey_sql
  if_sql
  matchagainst_sql
  jsonkeyvalue_sql
  jsonpath_sql
  json_path_part
  formatjson_sql
  jsonobject_sql
  jsonobjectagg_sql
  jsonarray_sql
  jsonarrayagg_sql
  jsoncolumndef_sql
  jsonschema_sql
  jsontable_sql
  openjsoncolumndef_sql
  openjson_sql
  in_sql
  in_unnest_op
  interval_sql
  return_sql
  reference_sql
  anonymous_sql
  paren_sql
  neg_sql
  not_sql
  alias_sql
  pivotalias_sql
  aliases_sql
  atindex_sql
  attimezone_sql
  fromtimezone_sql
  add_sql
  and_sql
  or_sql
  xor_sql
  connector_sql
  bitwiseand_sql
  bitwiseleftshift_sql
  bitwisenot_sql
  bitwiseor_sql
  bitwiserightshift_sql
  bitwisexor_sql
  currentdate_sql
  collate_sql
  command_sql
  comment_sql
  mergetreettlaction_sql
  mergetreettl_sql
  transaction_sql
  commit_sql
  rollback_sql
  altercolumn_sql
  alterdiststyle_sql
  altersortkey_sql
  alterrename_sql
  renamecolumn_sql
  alterset_sql
  alter_sql
  add_column_sql
  droppartition_sql
  addconstraint_sql
  distinct_sql
  ignorenulls_sql
  respectnulls_sql
  havingmax_sql
  intdiv_sql
  dpipe_sql
  div_sql
  safedivide_sql
  overlaps_sql
  distance_sql
  dot_sql
  propertyeq_sql
  escape_sql
  glob_sql
  gt_sql
  gte_sql
  ilike_sql
  ilikeany_sql
  like_sql
  likeany_sql
  similarto_sql
  lt_sql
  lte_sql
  mod_sql
  mul_sql
  nullsafeeq_sql
  nullsafeneq_sql
  slice_sql
  sub_sql
  try_sql
  log_sql
  use_sql
  binary
  ceil_floor
  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
  whens_sql
  merge_sql
  tochar_sql
  tonumber_sql
  dictproperty_sql
  dictrange_sql
  dictsubproperty_sql
  duplicatekeyproperty_sql
  uniquekeyproperty_sql
  distributedbyproperty_sql
  clusteredbyproperty_sql
  anyvalue_sql
  querytransform_sql
  indexconstraintoption_sql
  checkcolumnconstraint_sql
  nvl2_sql
  comprehension_sql
  columnprefix_sql
  opclass_sql
  predict_sql
  forin_sql
  refresh_sql
  toarray_sql
  tsordstotime_sql
  tsordstotimestamp_sql
  tsordstodatetime_sql
  tsordstodate_sql
  unixdate_sql
  lastday_sql
  dateadd_sql
  arrayany_sql
  struct_sql
  partitionrange_sql
  truncatetable_sql
  convert_sql
  copyparameter_sql
  credentials_sql
  copy_sql
  semicolon_sql
  datadeletionproperty_sql
  maskingpolicycolumnconstraint_sql
  gapfill_sql
  scope_resolution
  scoperesolution_sql
  parsejson_sql
  rand_sql
  changes_sql
  pad_sql
  summarize_sql
  explodinggenerateseries_sql
  arrayconcat_sql
  converttimezone_sql
  json_sql
  jsonvalue_sql
  conditionalinsert_sql
  multitableinserts_sql
  oncondition_sql
  jsonextractquote_sql
  jsonexists_sql
  arrayagg_sql
  apply_sql
  grant_sql
  grantprivilege_sql
  grantprincipal_sql
  columns_sql
  overlay_sql
  todouble_sql
  string_sql
  median_sql
  overflowtruncatebehavior_sql
  unixseconds_sql
  arraysize_sql
  attach_sql
  detach_sql
  attachoption_sql
  featuresattime_sql
  watermarkcolumnconstraint_sql
  encodeproperty_sql
  includeproperty_sql
  xmlelement_sql
  partitionbyrangeproperty_sql
  partitionbyrangepropertydynamic_sql
  unpivotcolumns_sql
  analyzesample_sql
  analyzestatistics_sql
  analyzehistogram_sql
  analyzedelete_sql
  analyzelistchainedrows_sql
  analyzevalidate_sql
  analyze_sql
  xmltable_sql
  xmlnamespace_sql