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

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

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

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.

HEX_STRING_IS_INTEGER_TYPE = True

Whether hex strings such as x'CC' evaluate to integer or binary/blob type

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.

def generate_values_aliases( self, expression: sqlglot.expressions.Values) -> List[sqlglot.expressions.Identifier]: View Source

    213    def generate_values_aliases(self, expression: exp.Values) -> t.List[exp.Identifier]:
    214        # Clickhouse allows VALUES to have an embedded structure e.g:
    215        # VALUES('person String, place String', ('Noah', 'Paris'), ...)
    216        # In this case, we don't want to qualify the columns
    217        values = expression.expressions[0].expressions
    218
    219        structure = (
    220            values[0]
    221            if (len(values) > 1 and values[0].is_string and isinstance(values[1], exp.Tuple))
    222            else None
    223        )
    224        if structure:
    225            # Split each column definition into the column name e.g:
    226            # 'person String, place String' -> ['person', 'place']
    227            structure_coldefs = [coldef.strip() for coldef in structure.name.split(",")]
    228            column_aliases = [
    229                exp.to_identifier(coldef.split(" ")[0]) for coldef in structure_coldefs
    230            ]
    231        else:
    232            # Default column aliases in CH are "c1", "c2", etc.
    233            column_aliases = [
    234                exp.to_identifier(f"c{i + 1}") for i in range(len(values[0].expressions))
    235            ]
    236
    237        return column_aliases

SUPPORTS_COLUMN_JOIN_MARKS = False

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

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

    239    class Tokenizer(tokens.Tokenizer):
    240        COMMENTS = ["--", "#", "#!", ("/*", "*/")]
    241        IDENTIFIERS = ['"', "`"]
    242        IDENTIFIER_ESCAPES = ["\\"]
    243        STRING_ESCAPES = ["'", "\\"]
    244        BIT_STRINGS = [("0b", "")]
    245        HEX_STRINGS = [("0x", ""), ("0X", "")]
    246        HEREDOC_STRINGS = ["$"]
    247
    248        KEYWORDS = {
    249            **tokens.Tokenizer.KEYWORDS,
    250            ".:": TokenType.DOTCOLON,
    251            "ATTACH": TokenType.COMMAND,
    252            "DATE32": TokenType.DATE32,
    253            "DATETIME64": TokenType.DATETIME64,
    254            "DICTIONARY": TokenType.DICTIONARY,
    255            "DYNAMIC": TokenType.DYNAMIC,
    256            "ENUM8": TokenType.ENUM8,
    257            "ENUM16": TokenType.ENUM16,
    258            "EXCHANGE": TokenType.COMMAND,
    259            "FINAL": TokenType.FINAL,
    260            "FIXEDSTRING": TokenType.FIXEDSTRING,
    261            "FLOAT32": TokenType.FLOAT,
    262            "FLOAT64": TokenType.DOUBLE,
    263            "GLOBAL": TokenType.GLOBAL,
    264            "LOWCARDINALITY": TokenType.LOWCARDINALITY,
    265            "MAP": TokenType.MAP,
    266            "NESTED": TokenType.NESTED,
    267            "NOTHING": TokenType.NOTHING,
    268            "SAMPLE": TokenType.TABLE_SAMPLE,
    269            "TUPLE": TokenType.STRUCT,
    270            "UINT16": TokenType.USMALLINT,
    271            "UINT32": TokenType.UINT,
    272            "UINT64": TokenType.UBIGINT,
    273            "UINT8": TokenType.UTINYINT,
    274            "IPV4": TokenType.IPV4,
    275            "IPV6": TokenType.IPV6,
    276            "POINT": TokenType.POINT,
    277            "RING": TokenType.RING,
    278            "LINESTRING": TokenType.LINESTRING,
    279            "MULTILINESTRING": TokenType.MULTILINESTRING,
    280            "POLYGON": TokenType.POLYGON,
    281            "MULTIPOLYGON": TokenType.MULTIPOLYGON,
    282            "AGGREGATEFUNCTION": TokenType.AGGREGATEFUNCTION,
    283            "SIMPLEAGGREGATEFUNCTION": TokenType.SIMPLEAGGREGATEFUNCTION,
    284            "SYSTEM": TokenType.COMMAND,
    285            "PREWHERE": TokenType.PREWHERE,
    286        }
    287        KEYWORDS.pop("/*+")
    288
    289        SINGLE_TOKENS = {
    290            **tokens.Tokenizer.SINGLE_TOKENS,
    291            "$": TokenType.HEREDOC_STRING,
    292        }

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.PIPE_GT: 'PIPE_GT'>, '>=': <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_SCHEMA': <TokenType.CURRENT_SCHEMA: 'CURRENT_SCHEMA'>, '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'>, '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'>, 'INT128': <TokenType.INT128: 'INT128'>, 'INT256': <TokenType.INT256: 'INT256'>, 'LONG': <TokenType.BIGINT: 'BIGINT'>, 'BIGINT': <TokenType.BIGINT: 'BIGINT'>, 'INT8': <TokenType.TINYINT: 'TINYINT'>, 'UINT': <TokenType.UINT: 'UINT'>, 'UINT128': <TokenType.UINT128: 'UINT128'>, 'UINT256': <TokenType.UINT256: 'UINT256'>, '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'>, 'CHAR VARYING': <TokenType.VARCHAR: 'VARCHAR'>, 'CHARACTER VARYING': <TokenType.VARCHAR: 'VARCHAR'>, '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'>, '.:': <TokenType.DOTCOLON: 'DOTCOLON'>, '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'>, 'EXCHANGE': <TokenType.COMMAND: 'COMMAND'>, 'FINAL': <TokenType.FINAL: 'FINAL'>, 'FIXEDSTRING': <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, 'FLOAT32': <TokenType.FLOAT: 'FLOAT'>, 'FLOAT64': <TokenType.DOUBLE: 'DOUBLE'>, 'GLOBAL': <TokenType.GLOBAL: 'GLOBAL'>, 'LOWCARDINALITY': <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, 'NESTED': <TokenType.NESTED: 'NESTED'>, 'NOTHING': <TokenType.NOTHING: 'NOTHING'>, 'SAMPLE': <TokenType.TABLE_SAMPLE: 'TABLE_SAMPLE'>, 'TUPLE': <TokenType.STRUCT: 'STRUCT'>, 'UINT16': <TokenType.USMALLINT: 'USMALLINT'>, '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

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

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

##### Inherited Members

sqlglot.parser.Parser
  Parser
  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
  COLON_PLACEHOLDER_TOKENS
  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
  PIPE_SYNTAX_TRANSFORM_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
  WINDOW_EXCLUDE_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
  RECURSIVE_CTE_SEARCH_KIND
  MODIFIABLES
  STRICT_CAST
  PREFIXED_PIVOT_COLUMNS
  IDENTIFY_PIVOT_STRINGS
  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
  ALTER_RENAME_REQUIRES_COLUMN
  ZONE_AWARE_TIMESTAMP_CONSTRUCTOR
  error_level
  error_message_context
  max_errors
  dialect
  reset
  parse
  parse_into
  check_errors
  raise_error
  expression
  validate_expression
  parse_set_operation
  errors
  sql

class ClickHouse.Generator(sqlglot.generator.Generator): View Source

     970    class Generator(generator.Generator):
     971        QUERY_HINTS = False
     972        STRUCT_DELIMITER = ("(", ")")
     973        NVL2_SUPPORTED = False
     974        TABLESAMPLE_REQUIRES_PARENS = False
     975        TABLESAMPLE_SIZE_IS_ROWS = False
     976        TABLESAMPLE_KEYWORDS = "SAMPLE"
     977        LAST_DAY_SUPPORTS_DATE_PART = False
     978        CAN_IMPLEMENT_ARRAY_ANY = True
     979        SUPPORTS_TO_NUMBER = False
     980        JOIN_HINTS = False
     981        TABLE_HINTS = False
     982        GROUPINGS_SEP = ""
     983        SET_OP_MODIFIERS = False
     984        ARRAY_SIZE_NAME = "LENGTH"
     985        WRAP_DERIVED_VALUES = False
     986
     987        STRING_TYPE_MAPPING = {
     988            exp.DataType.Type.BLOB: "String",
     989            exp.DataType.Type.CHAR: "String",
     990            exp.DataType.Type.LONGBLOB: "String",
     991            exp.DataType.Type.LONGTEXT: "String",
     992            exp.DataType.Type.MEDIUMBLOB: "String",
     993            exp.DataType.Type.MEDIUMTEXT: "String",
     994            exp.DataType.Type.TINYBLOB: "String",
     995            exp.DataType.Type.TINYTEXT: "String",
     996            exp.DataType.Type.TEXT: "String",
     997            exp.DataType.Type.VARBINARY: "String",
     998            exp.DataType.Type.VARCHAR: "String",
     999        }
    1000
    1001        SUPPORTED_JSON_PATH_PARTS = {
    1002            exp.JSONPathKey,
    1003            exp.JSONPathRoot,
    1004            exp.JSONPathSubscript,
    1005        }
    1006
    1007        TYPE_MAPPING = {
    1008            **generator.Generator.TYPE_MAPPING,
    1009            **STRING_TYPE_MAPPING,
    1010            exp.DataType.Type.ARRAY: "Array",
    1011            exp.DataType.Type.BOOLEAN: "Bool",
    1012            exp.DataType.Type.BIGINT: "Int64",
    1013            exp.DataType.Type.DATE32: "Date32",
    1014            exp.DataType.Type.DATETIME: "DateTime",
    1015            exp.DataType.Type.DATETIME2: "DateTime",
    1016            exp.DataType.Type.SMALLDATETIME: "DateTime",
    1017            exp.DataType.Type.DATETIME64: "DateTime64",
    1018            exp.DataType.Type.DECIMAL: "Decimal",
    1019            exp.DataType.Type.DECIMAL32: "Decimal32",
    1020            exp.DataType.Type.DECIMAL64: "Decimal64",
    1021            exp.DataType.Type.DECIMAL128: "Decimal128",
    1022            exp.DataType.Type.DECIMAL256: "Decimal256",
    1023            exp.DataType.Type.TIMESTAMP: "DateTime",
    1024            exp.DataType.Type.TIMESTAMPNTZ: "DateTime",
    1025            exp.DataType.Type.TIMESTAMPTZ: "DateTime",
    1026            exp.DataType.Type.DOUBLE: "Float64",
    1027            exp.DataType.Type.ENUM: "Enum",
    1028            exp.DataType.Type.ENUM8: "Enum8",
    1029            exp.DataType.Type.ENUM16: "Enum16",
    1030            exp.DataType.Type.FIXEDSTRING: "FixedString",
    1031            exp.DataType.Type.FLOAT: "Float32",
    1032            exp.DataType.Type.INT: "Int32",
    1033            exp.DataType.Type.MEDIUMINT: "Int32",
    1034            exp.DataType.Type.INT128: "Int128",
    1035            exp.DataType.Type.INT256: "Int256",
    1036            exp.DataType.Type.LOWCARDINALITY: "LowCardinality",
    1037            exp.DataType.Type.MAP: "Map",
    1038            exp.DataType.Type.NESTED: "Nested",
    1039            exp.DataType.Type.NOTHING: "Nothing",
    1040            exp.DataType.Type.SMALLINT: "Int16",
    1041            exp.DataType.Type.STRUCT: "Tuple",
    1042            exp.DataType.Type.TINYINT: "Int8",
    1043            exp.DataType.Type.UBIGINT: "UInt64",
    1044            exp.DataType.Type.UINT: "UInt32",
    1045            exp.DataType.Type.UINT128: "UInt128",
    1046            exp.DataType.Type.UINT256: "UInt256",
    1047            exp.DataType.Type.USMALLINT: "UInt16",
    1048            exp.DataType.Type.UTINYINT: "UInt8",
    1049            exp.DataType.Type.IPV4: "IPv4",
    1050            exp.DataType.Type.IPV6: "IPv6",
    1051            exp.DataType.Type.POINT: "Point",
    1052            exp.DataType.Type.RING: "Ring",
    1053            exp.DataType.Type.LINESTRING: "LineString",
    1054            exp.DataType.Type.MULTILINESTRING: "MultiLineString",
    1055            exp.DataType.Type.POLYGON: "Polygon",
    1056            exp.DataType.Type.MULTIPOLYGON: "MultiPolygon",
    1057            exp.DataType.Type.AGGREGATEFUNCTION: "AggregateFunction",
    1058            exp.DataType.Type.SIMPLEAGGREGATEFUNCTION: "SimpleAggregateFunction",
    1059            exp.DataType.Type.DYNAMIC: "Dynamic",
    1060        }
    1061
    1062        TRANSFORMS = {
    1063            **generator.Generator.TRANSFORMS,
    1064            exp.AnyValue: rename_func("any"),
    1065            exp.ApproxDistinct: rename_func("uniq"),
    1066            exp.ArrayConcat: rename_func("arrayConcat"),
    1067            exp.ArrayFilter: lambda self, e: self.func("arrayFilter", e.expression, e.this),
    1068            exp.ArrayRemove: remove_from_array_using_filter,
    1069            exp.ArraySum: rename_func("arraySum"),
    1070            exp.ArgMax: arg_max_or_min_no_count("argMax"),
    1071            exp.ArgMin: arg_max_or_min_no_count("argMin"),
    1072            exp.Array: inline_array_sql,
    1073            exp.CastToStrType: rename_func("CAST"),
    1074            exp.CountIf: rename_func("countIf"),
    1075            exp.CompressColumnConstraint: lambda self,
    1076            e: f"CODEC({self.expressions(e, key='this', flat=True)})",
    1077            exp.ComputedColumnConstraint: lambda self,
    1078            e: f"{'MATERIALIZED' if e.args.get('persisted') else 'ALIAS'} {self.sql(e, 'this')}",
    1079            exp.CurrentDate: lambda self, e: self.func("CURRENT_DATE"),
    1080            exp.DateAdd: _datetime_delta_sql("DATE_ADD"),
    1081            exp.DateDiff: _datetime_delta_sql("DATE_DIFF"),
    1082            exp.DateStrToDate: rename_func("toDate"),
    1083            exp.DateSub: _datetime_delta_sql("DATE_SUB"),
    1084            exp.Explode: rename_func("arrayJoin"),
    1085            exp.Final: lambda self, e: f"{self.sql(e, 'this')} FINAL",
    1086            exp.IsNan: rename_func("isNaN"),
    1087            exp.JSONCast: lambda self, e: f"{self.sql(e, 'this')}.:{self.sql(e, 'to')}",
    1088            exp.JSONExtract: json_extract_segments("JSONExtractString", quoted_index=False),
    1089            exp.JSONExtractScalar: json_extract_segments("JSONExtractString", quoted_index=False),
    1090            exp.JSONPathKey: json_path_key_only_name,
    1091            exp.JSONPathRoot: lambda *_: "",
    1092            exp.Length: length_or_char_length_sql,
    1093            exp.Map: _map_sql,
    1094            exp.Median: rename_func("median"),
    1095            exp.Nullif: rename_func("nullIf"),
    1096            exp.PartitionedByProperty: lambda self, e: f"PARTITION BY {self.sql(e, 'this')}",
    1097            exp.Pivot: no_pivot_sql,
    1098            exp.Quantile: _quantile_sql,
    1099            exp.RegexpLike: lambda self, e: self.func("match", e.this, e.expression),
    1100            exp.Rand: rename_func("randCanonical"),
    1101            exp.StartsWith: rename_func("startsWith"),
    1102            exp.EndsWith: rename_func("endsWith"),
    1103            exp.StrPosition: lambda self, e: strposition_sql(
    1104                self,
    1105                e,
    1106                func_name="POSITION",
    1107                supports_position=True,
    1108                use_ansi_position=False,
    1109            ),
    1110            exp.TimeToStr: lambda self, e: self.func(
    1111                "formatDateTime", e.this, self.format_time(e), e.args.get("zone")
    1112            ),
    1113            exp.TimeStrToTime: _timestrtotime_sql,
    1114            exp.TimestampAdd: _datetime_delta_sql("TIMESTAMP_ADD"),
    1115            exp.TimestampSub: _datetime_delta_sql("TIMESTAMP_SUB"),
    1116            exp.VarMap: _map_sql,
    1117            exp.Xor: lambda self, e: self.func("xor", e.this, e.expression, *e.expressions),
    1118            exp.MD5Digest: rename_func("MD5"),
    1119            exp.MD5: lambda self, e: self.func("LOWER", self.func("HEX", self.func("MD5", e.this))),
    1120            exp.SHA: rename_func("SHA1"),
    1121            exp.SHA2: sha256_sql,
    1122            exp.UnixToTime: _unix_to_time_sql,
    1123            exp.TimestampTrunc: timestamptrunc_sql(zone=True),
    1124            exp.Trim: lambda self, e: trim_sql(self, e, default_trim_type="BOTH"),
    1125            exp.Variance: rename_func("varSamp"),
    1126            exp.SchemaCommentProperty: lambda self, e: self.naked_property(e),
    1127            exp.Stddev: rename_func("stddevSamp"),
    1128            exp.Chr: rename_func("CHAR"),
    1129            exp.Lag: lambda self, e: self.func(
    1130                "lagInFrame", e.this, e.args.get("offset"), e.args.get("default")
    1131            ),
    1132            exp.Lead: lambda self, e: self.func(
    1133                "leadInFrame", e.this, e.args.get("offset"), e.args.get("default")
    1134            ),
    1135            exp.Levenshtein: unsupported_args("ins_cost", "del_cost", "sub_cost", "max_dist")(
    1136                rename_func("editDistance")
    1137            ),
    1138        }
    1139
    1140        PROPERTIES_LOCATION = {
    1141            **generator.Generator.PROPERTIES_LOCATION,
    1142            exp.OnCluster: exp.Properties.Location.POST_NAME,
    1143            exp.PartitionedByProperty: exp.Properties.Location.POST_SCHEMA,
    1144            exp.ToTableProperty: exp.Properties.Location.POST_NAME,
    1145            exp.VolatileProperty: exp.Properties.Location.UNSUPPORTED,
    1146        }
    1147
    1148        # There's no list in docs, but it can be found in Clickhouse code
    1149        # see `ClickHouse/src/Parsers/ParserCreate*.cpp`
    1150        ON_CLUSTER_TARGETS = {
    1151            "SCHEMA",  # Transpiled CREATE SCHEMA may have OnCluster property set
    1152            "DATABASE",
    1153            "TABLE",
    1154            "VIEW",
    1155            "DICTIONARY",
    1156            "INDEX",
    1157            "FUNCTION",
    1158            "NAMED COLLECTION",
    1159        }
    1160
    1161        # https://clickhouse.com/docs/en/sql-reference/data-types/nullable
    1162        NON_NULLABLE_TYPES = {
    1163            exp.DataType.Type.ARRAY,
    1164            exp.DataType.Type.MAP,
    1165            exp.DataType.Type.STRUCT,
    1166            exp.DataType.Type.POINT,
    1167            exp.DataType.Type.RING,
    1168            exp.DataType.Type.LINESTRING,
    1169            exp.DataType.Type.MULTILINESTRING,
    1170            exp.DataType.Type.POLYGON,
    1171            exp.DataType.Type.MULTIPOLYGON,
    1172        }
    1173
    1174        def strtodate_sql(self, expression: exp.StrToDate) -> str:
    1175            strtodate_sql = self.function_fallback_sql(expression)
    1176
    1177            if not isinstance(expression.parent, exp.Cast):
    1178                # StrToDate returns DATEs in other dialects (eg. postgres), so
    1179                # this branch aims to improve the transpilation to clickhouse
    1180                return self.cast_sql(exp.cast(expression, "DATE"))
    1181
    1182            return strtodate_sql
    1183
    1184        def cast_sql(self, expression: exp.Cast, safe_prefix: t.Optional[str] = None) -> str:
    1185            this = expression.this
    1186
    1187            if isinstance(this, exp.StrToDate) and expression.to == exp.DataType.build("datetime"):
    1188                return self.sql(this)
    1189
    1190            return super().cast_sql(expression, safe_prefix=safe_prefix)
    1191
    1192        def trycast_sql(self, expression: exp.TryCast) -> str:
    1193            dtype = expression.to
    1194            if not dtype.is_type(*self.NON_NULLABLE_TYPES, check_nullable=True):
    1195                # Casting x into Nullable(T) appears to behave similarly to TRY_CAST(x AS T)
    1196                dtype.set("nullable", True)
    1197
    1198            return super().cast_sql(expression)
    1199
    1200        def _jsonpathsubscript_sql(self, expression: exp.JSONPathSubscript) -> str:
    1201            this = self.json_path_part(expression.this)
    1202            return str(int(this) + 1) if is_int(this) else this
    1203
    1204        def likeproperty_sql(self, expression: exp.LikeProperty) -> str:
    1205            return f"AS {self.sql(expression, 'this')}"
    1206
    1207        def _any_to_has(
    1208            self,
    1209            expression: exp.EQ | exp.NEQ,
    1210            default: t.Callable[[t.Any], str],
    1211            prefix: str = "",
    1212        ) -> str:
    1213            if isinstance(expression.left, exp.Any):
    1214                arr = expression.left
    1215                this = expression.right
    1216            elif isinstance(expression.right, exp.Any):
    1217                arr = expression.right
    1218                this = expression.left
    1219            else:
    1220                return default(expression)
    1221
    1222            return prefix + self.func("has", arr.this.unnest(), this)
    1223
    1224        def eq_sql(self, expression: exp.EQ) -> str:
    1225            return self._any_to_has(expression, super().eq_sql)
    1226
    1227        def neq_sql(self, expression: exp.NEQ) -> str:
    1228            return self._any_to_has(expression, super().neq_sql, "NOT ")
    1229
    1230        def regexpilike_sql(self, expression: exp.RegexpILike) -> str:
    1231            # Manually add a flag to make the search case-insensitive
    1232            regex = self.func("CONCAT", "'(?i)'", expression.expression)
    1233            return self.func("match", expression.this, regex)
    1234
    1235        def datatype_sql(self, expression: exp.DataType) -> str:
    1236            # String is the standard ClickHouse type, every other variant is just an alias.
    1237            # Additionally, any supplied length parameter will be ignored.
    1238            #
    1239            # https://clickhouse.com/docs/en/sql-reference/data-types/string
    1240            if expression.this in self.STRING_TYPE_MAPPING:
    1241                dtype = "String"
    1242            else:
    1243                dtype = super().datatype_sql(expression)
    1244
    1245            # This section changes the type to `Nullable(...)` if the following conditions hold:
    1246            # - It's marked as nullable - this ensures we won't wrap ClickHouse types with `Nullable`
    1247            #   and change their semantics
    1248            # - It's not the key type of a `Map`. This is because ClickHouse enforces the following
    1249            #   constraint: "Type of Map key must be a type, that can be represented by integer or
    1250            #   String or FixedString (possibly LowCardinality) or UUID or IPv6"
    1251            # - It's not a composite type, e.g. `Nullable(Array(...))` is not a valid type
    1252            parent = expression.parent
    1253            nullable = expression.args.get("nullable")
    1254            if nullable is True or (
    1255                nullable is None
    1256                and not (
    1257                    isinstance(parent, exp.DataType)
    1258                    and parent.is_type(exp.DataType.Type.MAP, check_nullable=True)
    1259                    and expression.index in (None, 0)
    1260                )
    1261                and not expression.is_type(*self.NON_NULLABLE_TYPES, check_nullable=True)
    1262            ):
    1263                dtype = f"Nullable({dtype})"
    1264
    1265            return dtype
    1266
    1267        def cte_sql(self, expression: exp.CTE) -> str:
    1268            if expression.args.get("scalar"):
    1269                this = self.sql(expression, "this")
    1270                alias = self.sql(expression, "alias")
    1271                return f"{this} AS {alias}"
    1272
    1273            return super().cte_sql(expression)
    1274
    1275        def after_limit_modifiers(self, expression: exp.Expression) -> t.List[str]:
    1276            return super().after_limit_modifiers(expression) + [
    1277                (
    1278                    self.seg("SETTINGS ") + self.expressions(expression, key="settings", flat=True)
    1279                    if expression.args.get("settings")
    1280                    else ""
    1281                ),
    1282                (
    1283                    self.seg("FORMAT ") + self.sql(expression, "format")
    1284                    if expression.args.get("format")
    1285                    else ""
    1286                ),
    1287            ]
    1288
    1289        def placeholder_sql(self, expression: exp.Placeholder) -> str:
    1290            return f"{{{expression.name}: {self.sql(expression, 'kind')}}}"
    1291
    1292        def oncluster_sql(self, expression: exp.OnCluster) -> str:
    1293            return f"ON CLUSTER {self.sql(expression, 'this')}"
    1294
    1295        def createable_sql(self, expression: exp.Create, locations: t.DefaultDict) -> str:
    1296            if expression.kind in self.ON_CLUSTER_TARGETS and locations.get(
    1297                exp.Properties.Location.POST_NAME
    1298            ):
    1299                this_name = self.sql(
    1300                    expression.this if isinstance(expression.this, exp.Schema) else expression,
    1301                    "this",
    1302                )
    1303                this_properties = " ".join(
    1304                    [self.sql(prop) for prop in locations[exp.Properties.Location.POST_NAME]]
    1305                )
    1306                this_schema = self.schema_columns_sql(expression.this)
    1307                this_schema = f"{self.sep()}{this_schema}" if this_schema else ""
    1308
    1309                return f"{this_name}{self.sep()}{this_properties}{this_schema}"
    1310
    1311            return super().createable_sql(expression, locations)
    1312
    1313        def create_sql(self, expression: exp.Create) -> str:
    1314            # The comment property comes last in CTAS statements, i.e. after the query
    1315            query = expression.expression
    1316            if isinstance(query, exp.Query):
    1317                comment_prop = expression.find(exp.SchemaCommentProperty)
    1318                if comment_prop:
    1319                    comment_prop.pop()
    1320                    query.replace(exp.paren(query))
    1321            else:
    1322                comment_prop = None
    1323
    1324            create_sql = super().create_sql(expression)
    1325
    1326            comment_sql = self.sql(comment_prop)
    1327            comment_sql = f" {comment_sql}" if comment_sql else ""
    1328
    1329            return f"{create_sql}{comment_sql}"
    1330
    1331        def prewhere_sql(self, expression: exp.PreWhere) -> str:
    1332            this = self.indent(self.sql(expression, "this"))
    1333            return f"{self.seg('PREWHERE')}{self.sep()}{this}"
    1334
    1335        def indexcolumnconstraint_sql(self, expression: exp.IndexColumnConstraint) -> str:
    1336            this = self.sql(expression, "this")
    1337            this = f" {this}" if this else ""
    1338            expr = self.sql(expression, "expression")
    1339            expr = f" {expr}" if expr else ""
    1340            index_type = self.sql(expression, "index_type")
    1341            index_type = f" TYPE {index_type}" if index_type else ""
    1342            granularity = self.sql(expression, "granularity")
    1343            granularity = f" GRANULARITY {granularity}" if granularity else ""
    1344
    1345            return f"INDEX{this}{expr}{index_type}{granularity}"
    1346
    1347        def partition_sql(self, expression: exp.Partition) -> str:
    1348            return f"PARTITION {self.expressions(expression, flat=True)}"
    1349
    1350        def partitionid_sql(self, expression: exp.PartitionId) -> str:
    1351            return f"ID {self.sql(expression.this)}"
    1352
    1353        def replacepartition_sql(self, expression: exp.ReplacePartition) -> str:
    1354            return (
    1355                f"REPLACE {self.sql(expression.expression)} FROM {self.sql(expression, 'source')}"
    1356            )
    1357
    1358        def projectiondef_sql(self, expression: exp.ProjectionDef) -> str:
    1359            return f"PROJECTION {self.sql(expression.this)} {self.wrap(expression.expression)}"
    1360
    1361        def is_sql(self, expression: exp.Is) -> str:
    1362            is_sql = super().is_sql(expression)
    1363
    1364            if isinstance(expression.parent, exp.Not):
    1365                # value IS NOT NULL -> NOT (value IS NULL)
    1366                is_sql = self.wrap(is_sql)
    1367
    1368            return is_sql
    1369
    1370        def in_sql(self, expression: exp.In) -> str:
    1371            in_sql = super().in_sql(expression)
    1372
    1373            if isinstance(expression.parent, exp.Not) and expression.args.get("is_global"):
    1374                in_sql = in_sql.replace("GLOBAL IN", "GLOBAL NOT IN", 1)
    1375
    1376            return in_sql
    1377
    1378        def not_sql(self, expression: exp.Not) -> str:
    1379            if isinstance(expression.this, exp.In) and expression.this.args.get("is_global"):
    1380                # let `GLOBAL IN` child interpose `NOT`
    1381                return self.sql(expression, "this")
    1382
    1383            return super().not_sql(expression)
    1384
    1385        def values_sql(self, expression: exp.Values, values_as_table: bool = True) -> str:
    1386            # If the VALUES clause contains tuples of expressions, we need to treat it
    1387            # as a table since Clickhouse will automatically alias it as such.
    1388            alias = expression.args.get("alias")
    1389
    1390            if alias and alias.args.get("columns") and expression.expressions:
    1391                values = expression.expressions[0].expressions
    1392                values_as_table = any(isinstance(value, exp.Tuple) for value in values)
    1393            else:
    1394                values_as_table = True
    1395
    1396            return super().values_sql(expression, values_as_table=values_as_table)

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
ARRAY_SIZE_NAME = 'LENGTH'
WRAP_DERIVED_VALUES = False
STRING_TYPE_MAPPING = {<Type.BLOB: 'BLOB'>: 'String', <Type.CHAR: 'CHAR'>: 'String', <Type.LONGBLOB: 'LONGBLOB'>: 'String', <Type.LONGTEXT: 'LONGTEXT'>: 'String', <Type.MEDIUMBLOB: 'MEDIUMBLOB'>: 'String', <Type.MEDIUMTEXT: 'MEDIUMTEXT'>: 'String', <Type.TINYBLOB: 'TINYBLOB'>: 'String', <Type.TINYTEXT: 'TINYTEXT'>: 'String', <Type.TEXT: 'TEXT'>: 'String', <Type.VARBINARY: 'VARBINARY'>: 'String', <Type.VARCHAR: 'VARCHAR'>: 'String'}
SUPPORTED_JSON_PATH_PARTS = {<class 'sqlglot.expressions.JSONPathKey'>, <class 'sqlglot.expressions.JSONPathRoot'>, <class 'sqlglot.expressions.JSONPathSubscript'>}
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.BLOB: 'BLOB'>: '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.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>: '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.NOTHING: 'NOTHING'>: 'Nothing', <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.ConvertToCharset'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CopyGrantsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CredentialsProperty'>: <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.EnviromentProperty'>: <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.Get'>: <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.PartitionedByBucket'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.PartitionByTruncate'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.PivotAny'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ProjectionPolicyColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Put'>: <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.TableColumn'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Tags'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TemporaryProperty'>: <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.UsingTemplateProperty'>: <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 _map_sql>, <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.ForceProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.AnyValue'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.ApproxDistinct'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.ArrayConcat'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.ArrayFilter'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.ArrayRemove'>: <function remove_from_array_using_filter>, <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.JSONCast'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.JSONExtract'>: <function json_extract_segments.<locals>._json_extract_segments>, <class 'sqlglot.expressions.JSONExtractScalar'>: <function json_extract_segments.<locals>._json_extract_segments>, <class 'sqlglot.expressions.Length'>: <function length_or_char_length_sql>, <class 'sqlglot.expressions.Map'>: <function _map_sql>, <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.EndsWith'>: <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 ClickHouse.Generator.<lambda>>, <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.EnviromentProperty'>: <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.StorageHandlerProperty'>: <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.UsingTemplateProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <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.ForceProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.OnCluster'>: <Location.POST_NAME: 'POST_NAME'>}
ON_CLUSTER_TARGETS = {'VIEW', 'DATABASE', 'INDEX', 'TABLE', 'FUNCTION', 'NAMED COLLECTION', 'SCHEMA', 'DICTIONARY'}
NON_NULLABLE_TYPES = {<Type.POLYGON: 'POLYGON'>, <Type.MULTIPOLYGON: 'MULTIPOLYGON'>, <Type.LINESTRING: 'LINESTRING'>, <Type.STRUCT: 'STRUCT'>, <Type.RING: 'RING'>, <Type.ARRAY: 'ARRAY'>, <Type.MAP: 'MAP'>, <Type.POINT: 'POINT'>, <Type.MULTILINESTRING: 'MULTILINESTRING'>}
def strtodate_sql(self, expression: sqlglot.expressions.StrToDate) -> str: View Source

    1174        def strtodate_sql(self, expression: exp.StrToDate) -> str:
    1175            strtodate_sql = self.function_fallback_sql(expression)
    1176
    1177            if not isinstance(expression.parent, exp.Cast):
    1178                # StrToDate returns DATEs in other dialects (eg. postgres), so
    1179                # this branch aims to improve the transpilation to clickhouse
    1180                return self.cast_sql(exp.cast(expression, "DATE"))
    1181
    1182            return strtodate_sql

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

    1184        def cast_sql(self, expression: exp.Cast, safe_prefix: t.Optional[str] = None) -> str:
    1185            this = expression.this
    1186
    1187            if isinstance(this, exp.StrToDate) and expression.to == exp.DataType.build("datetime"):
    1188                return self.sql(this)
    1189
    1190            return super().cast_sql(expression, safe_prefix=safe_prefix)

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

    1192        def trycast_sql(self, expression: exp.TryCast) -> str:
    1193            dtype = expression.to
    1194            if not dtype.is_type(*self.NON_NULLABLE_TYPES, check_nullable=True):
    1195                # Casting x into Nullable(T) appears to behave similarly to TRY_CAST(x AS T)
    1196                dtype.set("nullable", True)
    1197
    1198            return super().cast_sql(expression)

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

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

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

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

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

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

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

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

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

    1235        def datatype_sql(self, expression: exp.DataType) -> str:
    1236            # String is the standard ClickHouse type, every other variant is just an alias.
    1237            # Additionally, any supplied length parameter will be ignored.
    1238            #
    1239            # https://clickhouse.com/docs/en/sql-reference/data-types/string
    1240            if expression.this in self.STRING_TYPE_MAPPING:
    1241                dtype = "String"
    1242            else:
    1243                dtype = super().datatype_sql(expression)
    1244
    1245            # This section changes the type to `Nullable(...)` if the following conditions hold:
    1246            # - It's marked as nullable - this ensures we won't wrap ClickHouse types with `Nullable`
    1247            #   and change their semantics
    1248            # - It's not the key type of a `Map`. This is because ClickHouse enforces the following
    1249            #   constraint: "Type of Map key must be a type, that can be represented by integer or
    1250            #   String or FixedString (possibly LowCardinality) or UUID or IPv6"
    1251            # - It's not a composite type, e.g. `Nullable(Array(...))` is not a valid type
    1252            parent = expression.parent
    1253            nullable = expression.args.get("nullable")
    1254            if nullable is True or (
    1255                nullable is None
    1256                and not (
    1257                    isinstance(parent, exp.DataType)
    1258                    and parent.is_type(exp.DataType.Type.MAP, check_nullable=True)
    1259                    and expression.index in (None, 0)
    1260                )
    1261                and not expression.is_type(*self.NON_NULLABLE_TYPES, check_nullable=True)
    1262            ):
    1263                dtype = f"Nullable({dtype})"
    1264
    1265            return dtype

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

    1267        def cte_sql(self, expression: exp.CTE) -> str:
    1268            if expression.args.get("scalar"):
    1269                this = self.sql(expression, "this")
    1270                alias = self.sql(expression, "alias")
    1271                return f"{this} AS {alias}"
    1272
    1273            return super().cte_sql(expression)

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

    1275        def after_limit_modifiers(self, expression: exp.Expression) -> t.List[str]:
    1276            return super().after_limit_modifiers(expression) + [
    1277                (
    1278                    self.seg("SETTINGS ") + self.expressions(expression, key="settings", flat=True)
    1279                    if expression.args.get("settings")
    1280                    else ""
    1281                ),
    1282                (
    1283                    self.seg("FORMAT ") + self.sql(expression, "format")
    1284                    if expression.args.get("format")
    1285                    else ""
    1286                ),
    1287            ]

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

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

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

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

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

    1295        def createable_sql(self, expression: exp.Create, locations: t.DefaultDict) -> str:
    1296            if expression.kind in self.ON_CLUSTER_TARGETS and locations.get(
    1297                exp.Properties.Location.POST_NAME
    1298            ):
    1299                this_name = self.sql(
    1300                    expression.this if isinstance(expression.this, exp.Schema) else expression,
    1301                    "this",
    1302                )
    1303                this_properties = " ".join(
    1304                    [self.sql(prop) for prop in locations[exp.Properties.Location.POST_NAME]]
    1305                )
    1306                this_schema = self.schema_columns_sql(expression.this)
    1307                this_schema = f"{self.sep()}{this_schema}" if this_schema else ""
    1308
    1309                return f"{this_name}{self.sep()}{this_properties}{this_schema}"
    1310
    1311            return super().createable_sql(expression, locations)

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

    1313        def create_sql(self, expression: exp.Create) -> str:
    1314            # The comment property comes last in CTAS statements, i.e. after the query
    1315            query = expression.expression
    1316            if isinstance(query, exp.Query):
    1317                comment_prop = expression.find(exp.SchemaCommentProperty)
    1318                if comment_prop:
    1319                    comment_prop.pop()
    1320                    query.replace(exp.paren(query))
    1321            else:
    1322                comment_prop = None
    1323
    1324            create_sql = super().create_sql(expression)
    1325
    1326            comment_sql = self.sql(comment_prop)
    1327            comment_sql = f" {comment_sql}" if comment_sql else ""
    1328
    1329            return f"{create_sql}{comment_sql}"

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

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

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

    1335        def indexcolumnconstraint_sql(self, expression: exp.IndexColumnConstraint) -> str:
    1336            this = self.sql(expression, "this")
    1337            this = f" {this}" if this else ""
    1338            expr = self.sql(expression, "expression")
    1339            expr = f" {expr}" if expr else ""
    1340            index_type = self.sql(expression, "index_type")
    1341            index_type = f" TYPE {index_type}" if index_type else ""
    1342            granularity = self.sql(expression, "granularity")
    1343            granularity = f" GRANULARITY {granularity}" if granularity else ""
    1344
    1345            return f"INDEX{this}{expr}{index_type}{granularity}"

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

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

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

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

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

    1353        def replacepartition_sql(self, expression: exp.ReplacePartition) -> str:
    1354            return (
    1355                f"REPLACE {self.sql(expression.expression)} FROM {self.sql(expression, 'source')}"
    1356            )

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

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

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

    1361        def is_sql(self, expression: exp.Is) -> str:
    1362            is_sql = super().is_sql(expression)
    1363
    1364            if isinstance(expression.parent, exp.Not):
    1365                # value IS NOT NULL -> NOT (value IS NULL)
    1366                is_sql = self.wrap(is_sql)
    1367
    1368            return is_sql

def in_sql(self, expression: sqlglot.expressions.In) -> str: View Source

    1370        def in_sql(self, expression: exp.In) -> str:
    1371            in_sql = super().in_sql(expression)
    1372
    1373            if isinstance(expression.parent, exp.Not) and expression.args.get("is_global"):
    1374                in_sql = in_sql.replace("GLOBAL IN", "GLOBAL NOT IN", 1)
    1375
    1376            return in_sql

def not_sql(self, expression: sqlglot.expressions.Not) -> str: View Source

    1378        def not_sql(self, expression: exp.Not) -> str:
    1379            if isinstance(expression.this, exp.In) and expression.this.args.get("is_global"):
    1380                # let `GLOBAL IN` child interpose `NOT`
    1381                return self.sql(expression, "this")
    1382
    1383            return super().not_sql(expression)

def values_sql( self, expression: sqlglot.expressions.Values, values_as_table: bool = True) -> str: View Source

    1385        def values_sql(self, expression: exp.Values, values_as_table: bool = True) -> str:
    1386            # If the VALUES clause contains tuples of expressions, we need to treat it
    1387            # as a table since Clickhouse will automatically alias it as such.
    1388            alias = expression.args.get("alias")
    1389
    1390            if alias and alias.args.get("columns") and expression.expressions:
    1391                values = expression.expressions[0].expressions
    1392                values_as_table = any(isinstance(value, exp.Tuple) for value in values)
    1393            else:
    1394                values_as_table = True
    1395
    1396            return super().values_sql(expression, values_as_table=values_as_table)

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
  CREATE_FUNCTION_RETURN_AS
  MATCHED_BY_SOURCE
  SINGLE_STRING_INTERVAL
  INTERVAL_ALLOWS_PLURAL_FORM
  LIMIT_FETCH
  LIMIT_ONLY_LITERALS
  RENAME_TABLE_WITH_DB
  INDEX_ON
  QUERY_HINT_SEP
  IS_BOOL_ALLOWED
  DUPLICATE_KEY_UPDATE_WITH_SET
  LIMIT_IS_TOP
  RETURNING_END
  EXTRACT_ALLOWS_QUOTES
  TZ_TO_WITH_TIME_ZONE
  VALUES_AS_TABLE
  ALTER_TABLE_INCLUDE_COLUMN_KEYWORD
  UNNEST_WITH_ORDINALITY
  AGGREGATE_FILTER_SUPPORTED
  SEMI_ANTI_JOIN_WITH_SIDE
  COMPUTED_COLUMN_WITH_TYPE
  SUPPORTS_TABLE_COPY
  TABLESAMPLE_WITH_METHOD
  TABLESAMPLE_SEED_KEYWORD
  COLLATE_IS_FUNC
  DATA_TYPE_SPECIFIERS_ALLOWED
  ENSURE_BOOLS
  CTE_RECURSIVE_KEYWORD_REQUIRED
  SUPPORTS_SINGLE_ARG_CONCAT
  SUPPORTS_TABLE_ALIAS_COLUMNS
  UNPIVOT_ALIASES_ARE_IDENTIFIERS
  JSON_KEY_VALUE_PAIR_SEP
  INSERT_OVERWRITE
  SUPPORTS_SELECT_INTO
  SUPPORTS_UNLOGGED_TABLES
  SUPPORTS_CREATE_TABLE_LIKE
  LIKE_PROPERTY_INSIDE_SCHEMA
  MULTI_ARG_DISTINCT
  JSON_TYPE_REQUIRED_FOR_EXTRACTION
  JSON_PATH_BRACKETED_KEY_SUPPORTED
  JSON_PATH_SINGLE_QUOTE_ESCAPE
  SUPPORTS_WINDOW_EXCLUDE
  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
  ALTER_SET_WRAPPED
  NORMALIZE_EXTRACT_DATE_PARTS
  PARSE_JSON_NAME
  ALTER_SET_TYPE
  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
  RESPECT_IGNORE_NULLS_UNSUPPORTED_EXPRESSIONS
  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
  sanitize_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
  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
  limitoptions_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
  tablefromrows_sql
  tablesample_sql
  pivot_sql
  version_sql
  tuple_sql
  update_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
  for_modifiers
  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_unnest_op
  interval_sql
  return_sql
  reference_sql
  anonymous_sql
  paren_sql
  neg_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
  alterindex_sql
  alterdiststyle_sql
  altersortkey_sql
  alterrename_sql
  renamecolumn_sql
  alterset_sql
  alter_sql
  add_column_sql
  droppartition_sql
  addconstraint_sql
  addpartition_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
  jsoncast_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
  xmlkeyvalueoption_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
  export_sql
  declare_sql
  declareitem_sql
  recursivewithsearch_sql
  parameterizedagg_sql
  anonymousaggfunc_sql
  combinedaggfunc_sql
  combinedparameterizedagg_sql
  show_sql
  get_put_sql
  translatecharacters_sql