Edit on GitHub

# sqlglot.dialects.clickhouse

View Source

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

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

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

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

COMMENTS = ['--', '#', '#!', ('/*', '*/')]
IDENTIFIERS = ['"', '`']
IDENTIFIER_ESCAPES = ['\\']
STRING_ESCAPES = ["'", '\\']
BIT_STRINGS = [('0b', '')]
HEX_STRINGS = [('0x', ''), ('0X', '')]
HEREDOC_STRINGS = ['$']
KEYWORDS = {'{%': <TokenType.BLOCK_START: 'BLOCK_START'>, '{%+': <TokenType.BLOCK_START: 'BLOCK_START'>, '{%-': <TokenType.BLOCK_START: 'BLOCK_START'>, '%}': <TokenType.BLOCK_END: 'BLOCK_END'>, '+%}': <TokenType.BLOCK_END: 'BLOCK_END'>, '-%}': <TokenType.BLOCK_END: 'BLOCK_END'>, '{{+': <TokenType.BLOCK_START: 'BLOCK_START'>, '{{-': <TokenType.BLOCK_START: 'BLOCK_START'>, '+}}': <TokenType.BLOCK_END: 'BLOCK_END'>, '-}}': <TokenType.BLOCK_END: 'BLOCK_END'>, '==': <TokenType.EQ: 'EQ'>, '::': <TokenType.DCOLON: 'DCOLON'>, '||': <TokenType.DPIPE: 'DPIPE'>, '>=': <TokenType.GTE: 'GTE'>, '<=': <TokenType.LTE: 'LTE'>, '<>': <TokenType.NEQ: 'NEQ'>, '!=': <TokenType.NEQ: 'NEQ'>, ':=': <TokenType.COLON_EQ: 'COLON_EQ'>, '<=>': <TokenType.NULLSAFE_EQ: 'NULLSAFE_EQ'>, '->': <TokenType.ARROW: 'ARROW'>, '->>': <TokenType.DARROW: 'DARROW'>, '=>': <TokenType.FARROW: 'FARROW'>, '#>': <TokenType.HASH_ARROW: 'HASH_ARROW'>, '#>>': <TokenType.DHASH_ARROW: 'DHASH_ARROW'>, '<->': <TokenType.LR_ARROW: 'LR_ARROW'>, '&&': <TokenType.DAMP: 'DAMP'>, '??': <TokenType.DQMARK: 'DQMARK'>, '~~~': <TokenType.GLOB: 'GLOB'>, '~~': <TokenType.LIKE: 'LIKE'>, '~~*': <TokenType.ILIKE: 'ILIKE'>, '~*': <TokenType.IRLIKE: 'IRLIKE'>, 'ALL': <TokenType.ALL: 'ALL'>, 'ALWAYS': <TokenType.ALWAYS: 'ALWAYS'>, 'AND': <TokenType.AND: 'AND'>, 'ANTI': <TokenType.ANTI: 'ANTI'>, 'ANY': <TokenType.ANY: 'ANY'>, 'ASC': <TokenType.ASC: 'ASC'>, 'AS': <TokenType.ALIAS: 'ALIAS'>, 'ASOF': <TokenType.ASOF: 'ASOF'>, 'AUTOINCREMENT': <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, 'AUTO_INCREMENT': <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, 'BEGIN': <TokenType.BEGIN: 'BEGIN'>, 'BETWEEN': <TokenType.BETWEEN: 'BETWEEN'>, 'CACHE': <TokenType.CACHE: 'CACHE'>, 'UNCACHE': <TokenType.UNCACHE: 'UNCACHE'>, 'CASE': <TokenType.CASE: 'CASE'>, 'CHARACTER SET': <TokenType.CHARACTER_SET: 'CHARACTER_SET'>, 'CLUSTER BY': <TokenType.CLUSTER_BY: 'CLUSTER_BY'>, 'COLLATE': <TokenType.COLLATE: 'COLLATE'>, 'COLUMN': <TokenType.COLUMN: 'COLUMN'>, 'COMMIT': <TokenType.COMMIT: 'COMMIT'>, 'CONNECT BY': <TokenType.CONNECT_BY: 'CONNECT_BY'>, 'CONSTRAINT': <TokenType.CONSTRAINT: 'CONSTRAINT'>, 'COPY': <TokenType.COPY: 'COPY'>, 'CREATE': <TokenType.CREATE: 'CREATE'>, 'CROSS': <TokenType.CROSS: 'CROSS'>, 'CUBE': <TokenType.CUBE: 'CUBE'>, 'CURRENT_DATE': <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, 'CURRENT_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'>, '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'>, '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'>, '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

    290    class Parser(parser.Parser):
    291        # Tested in ClickHouse's playground, it seems that the following two queries do the same thing
    292        # * select x from t1 union all select x from t2 limit 1;
    293        # * select x from t1 union all (select x from t2 limit 1);
    294        MODIFIERS_ATTACHED_TO_SET_OP = False
    295        INTERVAL_SPANS = False
    296        OPTIONAL_ALIAS_TOKEN_CTE = False
    297
    298        FUNCTIONS = {
    299            **parser.Parser.FUNCTIONS,
    300            "ANY": exp.AnyValue.from_arg_list,
    301            "ARRAYSUM": exp.ArraySum.from_arg_list,
    302            "COUNTIF": _build_count_if,
    303            "DATE_ADD": build_date_delta(exp.DateAdd, default_unit=None),
    304            "DATEADD": build_date_delta(exp.DateAdd, default_unit=None),
    305            "DATE_DIFF": build_date_delta(exp.DateDiff, default_unit=None),
    306            "DATEDIFF": build_date_delta(exp.DateDiff, default_unit=None),
    307            "DATE_FORMAT": _build_date_format,
    308            "DATE_SUB": build_date_delta(exp.DateSub, default_unit=None),
    309            "DATESUB": build_date_delta(exp.DateSub, default_unit=None),
    310            "FORMATDATETIME": _build_date_format,
    311            "JSONEXTRACTSTRING": build_json_extract_path(
    312                exp.JSONExtractScalar, zero_based_indexing=False
    313            ),
    314            "LENGTH": lambda args: exp.Length(this=seq_get(args, 0), binary=True),
    315            "MAP": parser.build_var_map,
    316            "MATCH": exp.RegexpLike.from_arg_list,
    317            "RANDCANONICAL": exp.Rand.from_arg_list,
    318            "STR_TO_DATE": _build_str_to_date,
    319            "TUPLE": exp.Struct.from_arg_list,
    320            "TIMESTAMP_SUB": build_date_delta(exp.TimestampSub, default_unit=None),
    321            "TIMESTAMPSUB": build_date_delta(exp.TimestampSub, default_unit=None),
    322            "TIMESTAMP_ADD": build_date_delta(exp.TimestampAdd, default_unit=None),
    323            "TIMESTAMPADD": build_date_delta(exp.TimestampAdd, default_unit=None),
    324            "UNIQ": exp.ApproxDistinct.from_arg_list,
    325            "XOR": lambda args: exp.Xor(expressions=args),
    326            "MD5": exp.MD5Digest.from_arg_list,
    327            "SHA256": lambda args: exp.SHA2(this=seq_get(args, 0), length=exp.Literal.number(256)),
    328            "SHA512": lambda args: exp.SHA2(this=seq_get(args, 0), length=exp.Literal.number(512)),
    329            "EDITDISTANCE": exp.Levenshtein.from_arg_list,
    330            "LEVENSHTEINDISTANCE": exp.Levenshtein.from_arg_list,
    331        }
    332        FUNCTIONS.pop("TRANSFORM")
    333
    334        AGG_FUNCTIONS = {
    335            "count",
    336            "min",
    337            "max",
    338            "sum",
    339            "avg",
    340            "any",
    341            "stddevPop",
    342            "stddevSamp",
    343            "varPop",
    344            "varSamp",
    345            "corr",
    346            "covarPop",
    347            "covarSamp",
    348            "entropy",
    349            "exponentialMovingAverage",
    350            "intervalLengthSum",
    351            "kolmogorovSmirnovTest",
    352            "mannWhitneyUTest",
    353            "median",
    354            "rankCorr",
    355            "sumKahan",
    356            "studentTTest",
    357            "welchTTest",
    358            "anyHeavy",
    359            "anyLast",
    360            "boundingRatio",
    361            "first_value",
    362            "last_value",
    363            "argMin",
    364            "argMax",
    365            "avgWeighted",
    366            "topK",
    367            "topKWeighted",
    368            "deltaSum",
    369            "deltaSumTimestamp",
    370            "groupArray",
    371            "groupArrayLast",
    372            "groupUniqArray",
    373            "groupArrayInsertAt",
    374            "groupArrayMovingAvg",
    375            "groupArrayMovingSum",
    376            "groupArraySample",
    377            "groupBitAnd",
    378            "groupBitOr",
    379            "groupBitXor",
    380            "groupBitmap",
    381            "groupBitmapAnd",
    382            "groupBitmapOr",
    383            "groupBitmapXor",
    384            "sumWithOverflow",
    385            "sumMap",
    386            "minMap",
    387            "maxMap",
    388            "skewSamp",
    389            "skewPop",
    390            "kurtSamp",
    391            "kurtPop",
    392            "uniq",
    393            "uniqExact",
    394            "uniqCombined",
    395            "uniqCombined64",
    396            "uniqHLL12",
    397            "uniqTheta",
    398            "quantile",
    399            "quantiles",
    400            "quantileExact",
    401            "quantilesExact",
    402            "quantileExactLow",
    403            "quantilesExactLow",
    404            "quantileExactHigh",
    405            "quantilesExactHigh",
    406            "quantileExactWeighted",
    407            "quantilesExactWeighted",
    408            "quantileTiming",
    409            "quantilesTiming",
    410            "quantileTimingWeighted",
    411            "quantilesTimingWeighted",
    412            "quantileDeterministic",
    413            "quantilesDeterministic",
    414            "quantileTDigest",
    415            "quantilesTDigest",
    416            "quantileTDigestWeighted",
    417            "quantilesTDigestWeighted",
    418            "quantileBFloat16",
    419            "quantilesBFloat16",
    420            "quantileBFloat16Weighted",
    421            "quantilesBFloat16Weighted",
    422            "simpleLinearRegression",
    423            "stochasticLinearRegression",
    424            "stochasticLogisticRegression",
    425            "categoricalInformationValue",
    426            "contingency",
    427            "cramersV",
    428            "cramersVBiasCorrected",
    429            "theilsU",
    430            "maxIntersections",
    431            "maxIntersectionsPosition",
    432            "meanZTest",
    433            "quantileInterpolatedWeighted",
    434            "quantilesInterpolatedWeighted",
    435            "quantileGK",
    436            "quantilesGK",
    437            "sparkBar",
    438            "sumCount",
    439            "largestTriangleThreeBuckets",
    440            "histogram",
    441            "sequenceMatch",
    442            "sequenceCount",
    443            "windowFunnel",
    444            "retention",
    445            "uniqUpTo",
    446            "sequenceNextNode",
    447            "exponentialTimeDecayedAvg",
    448        }
    449
    450        AGG_FUNCTIONS_SUFFIXES = [
    451            "If",
    452            "Array",
    453            "ArrayIf",
    454            "Map",
    455            "SimpleState",
    456            "State",
    457            "Merge",
    458            "MergeState",
    459            "ForEach",
    460            "Distinct",
    461            "OrDefault",
    462            "OrNull",
    463            "Resample",
    464            "ArgMin",
    465            "ArgMax",
    466        ]
    467
    468        FUNC_TOKENS = {
    469            *parser.Parser.FUNC_TOKENS,
    470            TokenType.AND,
    471            TokenType.OR,
    472            TokenType.SET,
    473        }
    474
    475        RESERVED_TOKENS = parser.Parser.RESERVED_TOKENS - {TokenType.SELECT}
    476
    477        ID_VAR_TOKENS = {
    478            *parser.Parser.ID_VAR_TOKENS,
    479            TokenType.LIKE,
    480        }
    481
    482        AGG_FUNC_MAPPING = (
    483            lambda functions, suffixes: {
    484                f"{f}{sfx}": (f, sfx) for sfx in (suffixes + [""]) for f in functions
    485            }
    486        )(AGG_FUNCTIONS, AGG_FUNCTIONS_SUFFIXES)
    487
    488        FUNCTIONS_WITH_ALIASED_ARGS = {*parser.Parser.FUNCTIONS_WITH_ALIASED_ARGS, "TUPLE"}
    489
    490        FUNCTION_PARSERS = {
    491            **parser.Parser.FUNCTION_PARSERS,
    492            "ARRAYJOIN": lambda self: self.expression(exp.Explode, this=self._parse_expression()),
    493            "QUANTILE": lambda self: self._parse_quantile(),
    494            "MEDIAN": lambda self: self._parse_quantile(),
    495            "COLUMNS": lambda self: self._parse_columns(),
    496        }
    497
    498        FUNCTION_PARSERS.pop("MATCH")
    499
    500        PROPERTY_PARSERS = parser.Parser.PROPERTY_PARSERS.copy()
    501        PROPERTY_PARSERS.pop("DYNAMIC")
    502
    503        NO_PAREN_FUNCTION_PARSERS = parser.Parser.NO_PAREN_FUNCTION_PARSERS.copy()
    504        NO_PAREN_FUNCTION_PARSERS.pop("ANY")
    505
    506        NO_PAREN_FUNCTIONS = parser.Parser.NO_PAREN_FUNCTIONS.copy()
    507        NO_PAREN_FUNCTIONS.pop(TokenType.CURRENT_TIMESTAMP)
    508
    509        RANGE_PARSERS = {
    510            **parser.Parser.RANGE_PARSERS,
    511            TokenType.GLOBAL: lambda self, this: self._parse_global_in(this),
    512        }
    513
    514        # The PLACEHOLDER entry is popped because 1) it doesn't affect Clickhouse (it corresponds to
    515        # the postgres-specific JSONBContains parser) and 2) it makes parsing the ternary op simpler.
    516        COLUMN_OPERATORS = parser.Parser.COLUMN_OPERATORS.copy()
    517        COLUMN_OPERATORS.pop(TokenType.PLACEHOLDER)
    518
    519        JOIN_KINDS = {
    520            *parser.Parser.JOIN_KINDS,
    521            TokenType.ANY,
    522            TokenType.ASOF,
    523            TokenType.ARRAY,
    524        }
    525
    526        TABLE_ALIAS_TOKENS = parser.Parser.TABLE_ALIAS_TOKENS - {
    527            TokenType.ANY,
    528            TokenType.ARRAY,
    529            TokenType.FINAL,
    530            TokenType.FORMAT,
    531            TokenType.SETTINGS,
    532        }
    533
    534        ALIAS_TOKENS = parser.Parser.ALIAS_TOKENS - {
    535            TokenType.FORMAT,
    536        }
    537
    538        LOG_DEFAULTS_TO_LN = True
    539
    540        QUERY_MODIFIER_PARSERS = {
    541            **parser.Parser.QUERY_MODIFIER_PARSERS,
    542            TokenType.SETTINGS: lambda self: (
    543                "settings",
    544                self._advance() or self._parse_csv(self._parse_assignment),
    545            ),
    546            TokenType.FORMAT: lambda self: ("format", self._advance() or self._parse_id_var()),
    547        }
    548
    549        CONSTRAINT_PARSERS = {
    550            **parser.Parser.CONSTRAINT_PARSERS,
    551            "INDEX": lambda self: self._parse_index_constraint(),
    552            "CODEC": lambda self: self._parse_compress(),
    553        }
    554
    555        ALTER_PARSERS = {
    556            **parser.Parser.ALTER_PARSERS,
    557            "REPLACE": lambda self: self._parse_alter_table_replace(),
    558        }
    559
    560        SCHEMA_UNNAMED_CONSTRAINTS = {
    561            *parser.Parser.SCHEMA_UNNAMED_CONSTRAINTS,
    562            "INDEX",
    563        }
    564
    565        PLACEHOLDER_PARSERS = {
    566            **parser.Parser.PLACEHOLDER_PARSERS,
    567            TokenType.L_BRACE: lambda self: self._parse_query_parameter(),
    568        }
    569
    570        # https://clickhouse.com/docs/en/sql-reference/statements/create/function
    571        def _parse_user_defined_function_expression(self) -> t.Optional[exp.Expression]:
    572            return self._parse_lambda()
    573
    574        def _parse_types(
    575            self, check_func: bool = False, schema: bool = False, allow_identifiers: bool = True
    576        ) -> t.Optional[exp.Expression]:
    577            dtype = super()._parse_types(
    578                check_func=check_func, schema=schema, allow_identifiers=allow_identifiers
    579            )
    580            if isinstance(dtype, exp.DataType) and dtype.args.get("nullable") is not True:
    581                # Mark every type as non-nullable which is ClickHouse's default, unless it's
    582                # already marked as nullable. This marker helps us transpile types from other
    583                # dialects to ClickHouse, so that we can e.g. produce `CAST(x AS Nullable(String))`
    584                # from `CAST(x AS TEXT)`. If there is a `NULL` value in `x`, the former would
    585                # fail in ClickHouse without the `Nullable` type constructor.
    586                dtype.set("nullable", False)
    587
    588            return dtype
    589
    590        def _parse_extract(self) -> exp.Extract | exp.Anonymous:
    591            index = self._index
    592            this = self._parse_bitwise()
    593            if self._match(TokenType.FROM):
    594                self._retreat(index)
    595                return super()._parse_extract()
    596
    597            # We return Anonymous here because extract and regexpExtract have different semantics,
    598            # so parsing extract(foo, bar) into RegexpExtract can potentially break queries. E.g.,
    599            # `extract('foobar', 'b')` works, but ClickHouse crashes for `regexpExtract('foobar', 'b')`.
    600            #
    601            # TODO: can we somehow convert the former into an equivalent `regexpExtract` call?
    602            self._match(TokenType.COMMA)
    603            return self.expression(
    604                exp.Anonymous, this="extract", expressions=[this, self._parse_bitwise()]
    605            )
    606
    607        def _parse_assignment(self) -> t.Optional[exp.Expression]:
    608            this = super()._parse_assignment()
    609
    610            if self._match(TokenType.PLACEHOLDER):
    611                return self.expression(
    612                    exp.If,
    613                    this=this,
    614                    true=self._parse_assignment(),
    615                    false=self._match(TokenType.COLON) and self._parse_assignment(),
    616                )
    617
    618            return this
    619
    620        def _parse_query_parameter(self) -> t.Optional[exp.Expression]:
    621            """
    622            Parse a placeholder expression like SELECT {abc: UInt32} or FROM {table: Identifier}
    623            https://clickhouse.com/docs/en/sql-reference/syntax#defining-and-using-query-parameters
    624            """
    625            index = self._index
    626
    627            this = self._parse_id_var()
    628            self._match(TokenType.COLON)
    629            kind = self._parse_types(check_func=False, allow_identifiers=False) or (
    630                self._match_text_seq("IDENTIFIER") and "Identifier"
    631            )
    632
    633            if not kind:
    634                self._retreat(index)
    635                return None
    636            elif not self._match(TokenType.R_BRACE):
    637                self.raise_error("Expecting }")
    638
    639            if isinstance(this, exp.Identifier) and not this.quoted:
    640                this = exp.var(this.name)
    641
    642            return self.expression(exp.Placeholder, this=this, kind=kind)
    643
    644        def _parse_bracket(
    645            self, this: t.Optional[exp.Expression] = None
    646        ) -> t.Optional[exp.Expression]:
    647            l_brace = self._match(TokenType.L_BRACE, advance=False)
    648            bracket = super()._parse_bracket(this)
    649
    650            if l_brace and isinstance(bracket, exp.Struct):
    651                varmap = exp.VarMap(keys=exp.Array(), values=exp.Array())
    652                for expression in bracket.expressions:
    653                    if not isinstance(expression, exp.PropertyEQ):
    654                        break
    655
    656                    varmap.args["keys"].append("expressions", exp.Literal.string(expression.name))
    657                    varmap.args["values"].append("expressions", expression.expression)
    658
    659                return varmap
    660
    661            return bracket
    662
    663        def _parse_in(self, this: t.Optional[exp.Expression], is_global: bool = False) -> exp.In:
    664            this = super()._parse_in(this)
    665            this.set("is_global", is_global)
    666            return this
    667
    668        def _parse_global_in(self, this: t.Optional[exp.Expression]) -> exp.Not | exp.In:
    669            is_negated = self._match(TokenType.NOT)
    670            this = self._match(TokenType.IN) and self._parse_in(this, is_global=True)
    671            return self.expression(exp.Not, this=this) if is_negated else this
    672
    673        def _parse_table(
    674            self,
    675            schema: bool = False,
    676            joins: bool = False,
    677            alias_tokens: t.Optional[t.Collection[TokenType]] = None,
    678            parse_bracket: bool = False,
    679            is_db_reference: bool = False,
    680            parse_partition: bool = False,
    681        ) -> t.Optional[exp.Expression]:
    682            this = super()._parse_table(
    683                schema=schema,
    684                joins=joins,
    685                alias_tokens=alias_tokens,
    686                parse_bracket=parse_bracket,
    687                is_db_reference=is_db_reference,
    688            )
    689
    690            if isinstance(this, exp.Table):
    691                inner = this.this
    692                alias = this.args.get("alias")
    693
    694                if isinstance(inner, exp.GenerateSeries) and alias and not alias.columns:
    695                    alias.set("columns", [exp.to_identifier("generate_series")])
    696
    697            if self._match(TokenType.FINAL):
    698                this = self.expression(exp.Final, this=this)
    699
    700            return this
    701
    702        def _parse_position(self, haystack_first: bool = False) -> exp.StrPosition:
    703            return super()._parse_position(haystack_first=True)
    704
    705        # https://clickhouse.com/docs/en/sql-reference/statements/select/with/
    706        def _parse_cte(self) -> t.Optional[exp.CTE]:
    707            # WITH <identifier> AS <subquery expression>
    708            cte: t.Optional[exp.CTE] = self._try_parse(super()._parse_cte)
    709
    710            if not cte:
    711                # WITH <expression> AS <identifier>
    712                cte = self.expression(
    713                    exp.CTE,
    714                    this=self._parse_assignment(),
    715                    alias=self._parse_table_alias(),
    716                    scalar=True,
    717                )
    718
    719            return cte
    720
    721        def _parse_join_parts(
    722            self,
    723        ) -> t.Tuple[t.Optional[Token], t.Optional[Token], t.Optional[Token]]:
    724            is_global = self._match(TokenType.GLOBAL) and self._prev
    725            kind_pre = self._match_set(self.JOIN_KINDS, advance=False) and self._prev
    726
    727            if kind_pre:
    728                kind = self._match_set(self.JOIN_KINDS) and self._prev
    729                side = self._match_set(self.JOIN_SIDES) and self._prev
    730                return is_global, side, kind
    731
    732            return (
    733                is_global,
    734                self._match_set(self.JOIN_SIDES) and self._prev,
    735                self._match_set(self.JOIN_KINDS) and self._prev,
    736            )
    737
    738        def _parse_join(
    739            self, skip_join_token: bool = False, parse_bracket: bool = False
    740        ) -> t.Optional[exp.Join]:
    741            join = super()._parse_join(skip_join_token=skip_join_token, parse_bracket=True)
    742            if join:
    743                join.set("global", join.args.pop("method", None))
    744
    745                # tbl ARRAY JOIN arr <-- this should be a `Column` reference, not a `Table`
    746                # https://clickhouse.com/docs/en/sql-reference/statements/select/array-join
    747                if join.kind == "ARRAY":
    748                    for table in join.find_all(exp.Table):
    749                        table.replace(table.to_column())
    750
    751            return join
    752
    753        def _parse_function(
    754            self,
    755            functions: t.Optional[t.Dict[str, t.Callable]] = None,
    756            anonymous: bool = False,
    757            optional_parens: bool = True,
    758            any_token: bool = False,
    759        ) -> t.Optional[exp.Expression]:
    760            expr = super()._parse_function(
    761                functions=functions,
    762                anonymous=anonymous,
    763                optional_parens=optional_parens,
    764                any_token=any_token,
    765            )
    766
    767            func = expr.this if isinstance(expr, exp.Window) else expr
    768
    769            # Aggregate functions can be split in 2 parts: <func_name><suffix>
    770            parts = (
    771                self.AGG_FUNC_MAPPING.get(func.this) if isinstance(func, exp.Anonymous) else None
    772            )
    773
    774            if parts:
    775                anon_func: exp.Anonymous = t.cast(exp.Anonymous, func)
    776                params = self._parse_func_params(anon_func)
    777
    778                kwargs = {
    779                    "this": anon_func.this,
    780                    "expressions": anon_func.expressions,
    781                }
    782                if parts[1]:
    783                    exp_class: t.Type[exp.Expression] = (
    784                        exp.CombinedParameterizedAgg if params else exp.CombinedAggFunc
    785                    )
    786                else:
    787                    exp_class = exp.ParameterizedAgg if params else exp.AnonymousAggFunc
    788
    789                kwargs["exp_class"] = exp_class
    790                if params:
    791                    kwargs["params"] = params
    792
    793                func = self.expression(**kwargs)
    794
    795                if isinstance(expr, exp.Window):
    796                    # The window's func was parsed as Anonymous in base parser, fix its
    797                    # type to be ClickHouse style CombinedAnonymousAggFunc / AnonymousAggFunc
    798                    expr.set("this", func)
    799                elif params:
    800                    # Params have blocked super()._parse_function() from parsing the following window
    801                    # (if that exists) as they're standing between the function call and the window spec
    802                    expr = self._parse_window(func)
    803                else:
    804                    expr = func
    805
    806            return expr
    807
    808        def _parse_func_params(
    809            self, this: t.Optional[exp.Func] = None
    810        ) -> t.Optional[t.List[exp.Expression]]:
    811            if self._match_pair(TokenType.R_PAREN, TokenType.L_PAREN):
    812                return self._parse_csv(self._parse_lambda)
    813
    814            if self._match(TokenType.L_PAREN):
    815                params = self._parse_csv(self._parse_lambda)
    816                self._match_r_paren(this)
    817                return params
    818
    819            return None
    820
    821        def _parse_quantile(self) -> exp.Quantile:
    822            this = self._parse_lambda()
    823            params = self._parse_func_params()
    824            if params:
    825                return self.expression(exp.Quantile, this=params[0], quantile=this)
    826            return self.expression(exp.Quantile, this=this, quantile=exp.Literal.number(0.5))
    827
    828        def _parse_wrapped_id_vars(self, optional: bool = False) -> t.List[exp.Expression]:
    829            return super()._parse_wrapped_id_vars(optional=True)
    830
    831        def _parse_primary_key(
    832            self, wrapped_optional: bool = False, in_props: bool = False
    833        ) -> exp.PrimaryKeyColumnConstraint | exp.PrimaryKey:
    834            return super()._parse_primary_key(
    835                wrapped_optional=wrapped_optional or in_props, in_props=in_props
    836            )
    837
    838        def _parse_on_property(self) -> t.Optional[exp.Expression]:
    839            index = self._index
    840            if self._match_text_seq("CLUSTER"):
    841                this = self._parse_string() or self._parse_id_var()
    842                if this:
    843                    return self.expression(exp.OnCluster, this=this)
    844                else:
    845                    self._retreat(index)
    846            return None
    847
    848        def _parse_index_constraint(
    849            self, kind: t.Optional[str] = None
    850        ) -> exp.IndexColumnConstraint:
    851            # INDEX name1 expr TYPE type1(args) GRANULARITY value
    852            this = self._parse_id_var()
    853            expression = self._parse_assignment()
    854
    855            index_type = self._match_text_seq("TYPE") and (
    856                self._parse_function() or self._parse_var()
    857            )
    858
    859            granularity = self._match_text_seq("GRANULARITY") and self._parse_term()
    860
    861            return self.expression(
    862                exp.IndexColumnConstraint,
    863                this=this,
    864                expression=expression,
    865                index_type=index_type,
    866                granularity=granularity,
    867            )
    868
    869        def _parse_partition(self) -> t.Optional[exp.Partition]:
    870            # https://clickhouse.com/docs/en/sql-reference/statements/alter/partition#how-to-set-partition-expression
    871            if not self._match(TokenType.PARTITION):
    872                return None
    873
    874            if self._match_text_seq("ID"):
    875                # Corresponds to the PARTITION ID <string_value> syntax
    876                expressions: t.List[exp.Expression] = [
    877                    self.expression(exp.PartitionId, this=self._parse_string())
    878                ]
    879            else:
    880                expressions = self._parse_expressions()
    881
    882            return self.expression(exp.Partition, expressions=expressions)
    883
    884        def _parse_alter_table_replace(self) -> t.Optional[exp.Expression]:
    885            partition = self._parse_partition()
    886
    887            if not partition or not self._match(TokenType.FROM):
    888                return None
    889
    890            return self.expression(
    891                exp.ReplacePartition, expression=partition, source=self._parse_table_parts()
    892            )
    893
    894        def _parse_projection_def(self) -> t.Optional[exp.ProjectionDef]:
    895            if not self._match_text_seq("PROJECTION"):
    896                return None
    897
    898            return self.expression(
    899                exp.ProjectionDef,
    900                this=self._parse_id_var(),
    901                expression=self._parse_wrapped(self._parse_statement),
    902            )
    903
    904        def _parse_constraint(self) -> t.Optional[exp.Expression]:
    905            return super()._parse_constraint() or self._parse_projection_def()
    906
    907        def _parse_alias(
    908            self, this: t.Optional[exp.Expression], explicit: bool = False
    909        ) -> t.Optional[exp.Expression]:
    910            # In clickhouse "SELECT <expr> APPLY(...)" is a query modifier,
    911            # so "APPLY" shouldn't be parsed as <expr>'s alias. However, "SELECT <expr> apply" is a valid alias
    912            if self._match_pair(TokenType.APPLY, TokenType.L_PAREN, advance=False):
    913                return this
    914
    915            return super()._parse_alias(this=this, explicit=explicit)
    916
    917        def _parse_expression(self) -> t.Optional[exp.Expression]:
    918            this = super()._parse_expression()
    919
    920            # Clickhouse allows "SELECT <expr> [APPLY(func)] [...]]" modifier
    921            while self._match_pair(TokenType.APPLY, TokenType.L_PAREN):
    922                this = exp.Apply(this=this, expression=self._parse_var(any_token=True))
    923                self._match(TokenType.R_PAREN)
    924
    925            return this
    926
    927        def _parse_columns(self) -> exp.Expression:
    928            this: exp.Expression = self.expression(exp.Columns, this=self._parse_lambda())
    929
    930            while self._next and self._match_text_seq(")", "APPLY", "("):
    931                self._match(TokenType.R_PAREN)
    932                this = exp.Apply(this=this, expression=self._parse_var(any_token=True))
    933            return this
    934
    935        def _parse_value(self, values: bool = True) -> t.Optional[exp.Tuple]:
    936            value = super()._parse_value(values=values)
    937            if not value:
    938                return None
    939
    940            # In Clickhouse "SELECT * FROM VALUES (1, 2, 3)" generates a table with a single column, in contrast
    941            # to other dialects. For this case, we canonicalize the values into a tuple-of-tuples AST if it's not already one.
    942            # In INSERT INTO statements the same clause actually references multiple columns (opposite semantics),
    943            # but the final result is not altered by the extra parentheses.
    944            # Note: Clickhouse allows VALUES([structure], value, ...) so the branch checks for the last expression
    945            expressions = value.expressions
    946            if values and not isinstance(expressions[-1], exp.Tuple):
    947                value.set(
    948                    "expressions",
    949                    [self.expression(exp.Tuple, expressions=[expr]) for expr in expressions],
    950                )
    951
    952            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
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_CONSTRUCT_COMPACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayConstructCompact'>>, 'ARRAY_CONTAINS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayContains'>>, 'ARRAY_HAS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayContains'>>, 'ARRAY_CONTAINS_ALL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayContainsAll'>>, 'ARRAY_HAS_ALL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayContainsAll'>>, 'FILTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayFilter'>>, 'ARRAY_FILTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayFilter'>>, 'ARRAY_OVERLAPS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayOverlaps'>>, 'ARRAY_SIZE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySize'>>, 'ARRAY_LENGTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySize'>>, 'ARRAY_SORT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySort'>>, 'ARRAY_SUM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySum'>>, 'ARRAY_TO_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayToString'>>, 'ARRAY_JOIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayToString'>>, 'ARRAY_UNION_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayUnionAgg'>>, 'ARRAY_UNIQUE_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayUniqueAgg'>>, 'AVG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Avg'>>, 'CASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Case'>>, 'CAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Cast'>>, 'CAST_TO_STR_TYPE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CastToStrType'>>, 'CBRT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Cbrt'>>, 'CEIL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Ceil'>>, 'CEILING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Ceil'>>, 'CHR': <function Parser.<lambda>>, 'CHAR': <function Parser.<lambda>>, 'COALESCE': <function build_coalesce>, 'IFNULL': <function build_coalesce>, 'NVL': <function build_coalesce>, 'COLLATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Collate'>>, 'COLUMNS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Columns'>>, 'COMBINED_AGG_FUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CombinedAggFunc'>>, 'COMBINED_PARAMETERIZED_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CombinedParameterizedAgg'>>, 'CONCAT': <function Parser.<lambda>>, 'CONCAT_WS': <function Parser.<lambda>>, 'CONNECT_BY_ROOT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ConnectByRoot'>>, 'CONTAINS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Contains'>>, 'CONVERT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Convert'>>, 'CONVERT_TIMEZONE': <function build_convert_timezone>, 'CORR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Corr'>>, 'COUNT': <function Parser.<lambda>>, 'COUNT_IF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CountIf'>>, 'COUNTIF': <function _build_count_if>, 'COVAR_POP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CovarPop'>>, 'COVAR_SAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CovarSamp'>>, 'CURRENT_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentDate'>>, 'CURRENT_DATETIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentDatetime'>>, 'CURRENT_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_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'>>, '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'>>, 'RIGHT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Right'>>, 'ROUND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Round'>>, 'ROW_NUMBER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RowNumber'>>, 'SHA': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SHA'>>, 'SHA1': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SHA'>>, 'SHA2': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SHA2'>>, 'SAFE_DIVIDE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SafeDivide'>>, 'SIGN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sign'>>, 'SIGNUM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sign'>>, 'SORT_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SortArray'>>, 'SPLIT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Split'>>, 'SPLIT_PART': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SplitPart'>>, 'SQRT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sqrt'>>, 'STANDARD_HASH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StandardHash'>>, 'STAR_MAP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StarMap'>>, 'STARTS_WITH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StartsWith'>>, 'STARTSWITH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StartsWith'>>, 'STDDEV': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Stddev'>>, 'STDEV': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Stddev'>>, 'STDDEV_POP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StddevPop'>>, 'STDDEV_SAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StddevSamp'>>, 'STR_POSITION': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrPosition'>>, 'STR_TO_DATE': <function _build_str_to_date>, 'STR_TO_MAP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrToMap'>>, 'STR_TO_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrToTime'>>, 'STR_TO_UNIX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrToUnix'>>, 'STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.String'>>, 'STRING_TO_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StringToArray'>>, 'SPLIT_BY_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StringToArray'>>, 'STRUCT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Struct'>>, 'STRUCT_EXTRACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StructExtract'>>, 'STUFF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Stuff'>>, 'INSERT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Stuff'>>, 'SUBSTRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Substring'>>, 'SUBSTR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Substring'>>, 'SUM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sum'>>, 'TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Time'>>, 'TIME_ADD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeAdd'>>, 'TIME_DIFF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeDiff'>>, 'TIME_FROM_PARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeFromParts'>>, 'TIMEFROMPARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeFromParts'>>, 'TIME_STR_TO_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeStrToDate'>>, 'TIME_STR_TO_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeStrToTime'>>, 'TIME_STR_TO_UNIX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeStrToUnix'>>, 'TIME_SUB': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeSub'>>, 'TIME_TO_STR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeToStr'>>, 'TIME_TO_TIME_STR': <function Parser.<lambda>>, 'TIME_TO_UNIX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeToUnix'>>, 'TIME_TRUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeTrunc'>>, 'TIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Timestamp'>>, 'TIMESTAMP_ADD': <function build_date_delta.<locals>._builder>, 'TIMESTAMPDIFF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampDiff'>>, 'TIMESTAMP_DIFF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampDiff'>>, 'TIMESTAMP_FROM_PARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampFromParts'>>, 'TIMESTAMPFROMPARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampFromParts'>>, 'TIMESTAMP_SUB': <function build_date_delta.<locals>._builder>, 'TIMESTAMP_TRUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampTrunc'>>, 'TO_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToArray'>>, 'TO_BASE64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToBase64'>>, 'TO_CHAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToChar'>>, 'TO_DAYS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToDays'>>, 'TO_DOUBLE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToDouble'>>, 'TO_MAP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToMap'>>, 'TO_NUMBER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToNumber'>>, 'TRIM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Trim'>>, 'TRY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Try'>>, 'TRY_CAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TryCast'>>, 'TS_OR_DI_TO_DI': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDiToDi'>>, 'TS_OR_DS_ADD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsAdd'>>, 'TS_OR_DS_DIFF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsDiff'>>, 'TS_OR_DS_TO_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsToDate'>>, 'TS_OR_DS_TO_DATE_STR': <function Parser.<lambda>>, 'TS_OR_DS_TO_DATETIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsToDatetime'>>, 'TS_OR_DS_TO_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsToTime'>>, 'TS_OR_DS_TO_TIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsToTimestamp'>>, 'UNHEX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Unhex'>>, 'UNICODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Unicode'>>, 'UNIX_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixDate'>>, 'UNIX_SECONDS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixSeconds'>>, 'UNIX_TO_STR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixToStr'>>, 'UNIX_TO_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixToTime'>>, 'UNIX_TO_TIME_STR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixToTimeStr'>>, 'UNNEST': <function Parser.<lambda>>, 'UPPER': <function build_upper>, 'UCASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Upper'>>, 'UUID': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Uuid'>>, 'GEN_RANDOM_UUID': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Uuid'>>, 'GENERATE_UUID': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Uuid'>>, 'UUID_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Uuid'>>, 'VAR_MAP': <function build_var_map>, 'VARIANCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Variance'>>, 'VARIANCE_SAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Variance'>>, 'VAR_SAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Variance'>>, 'VARIANCE_POP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.VariancePop'>>, 'VAR_POP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.VariancePop'>>, 'WEEK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Week'>>, 'WEEK_OF_YEAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.WeekOfYear'>>, 'WEEKOFYEAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.WeekOfYear'>>, 'XMLELEMENT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.XMLElement'>>, 'X_M_L_TABLE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.XMLTable'>>, 'XOR': <function ClickHouse.Parser.<lambda>>, 'YEAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Year'>>, 'ARRAYAGG': <function Parser.<lambda>>, 'GLOB': <function Parser.<lambda>>, 'JSON_EXTRACT_PATH_TEXT': <function build_extract_json_with_path.<locals>._builder>, 'LIKE': <function build_like>, 'LOG2': <function Parser.<lambda>>, 'LOG10': <function Parser.<lambda>>, 'LPAD': <function Parser.<lambda>>, 'LEFTPAD': <function Parser.<lambda>>, 'LTRIM': <function Parser.<lambda>>, 'MOD': <function build_mod>, 'RIGHTPAD': <function Parser.<lambda>>, 'RPAD': <function Parser.<lambda>>, 'RTRIM': <function Parser.<lambda>>, 'SCOPE_RESOLUTION': <function Parser.<lambda>>, 'STRPOS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrPosition'>>, 'CHARINDEX': <function Parser.<lambda>>, 'INSTR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrPosition'>>, 'LOCATE': <function Parser.<lambda>>, 'TO_HEX': <function build_hex>, 'ANY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.AnyValue'>>, 'ARRAYSUM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySum'>>, 'DATEADD': <function build_date_delta.<locals>._builder>, 'DATE_FORMAT': <function _build_date_format>, 'DATESUB': <function build_date_delta.<locals>._builder>, 'FORMATDATETIME': <function _build_date_format>, 'JSONEXTRACTSTRING': <function build_json_extract_path.<locals>._builder>, 'MATCH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpLike'>>, 'RANDCANONICAL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Rand'>>, 'TUPLE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Struct'>>, 'TIMESTAMPSUB': <function build_date_delta.<locals>._builder>, 'TIMESTAMPADD': <function build_date_delta.<locals>._builder>, 'UNIQ': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxDistinct'>>, 'SHA256': <function ClickHouse.Parser.<lambda>>, 'SHA512': <function ClickHouse.Parser.<lambda>>, 'EDITDISTANCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Levenshtein'>>, 'LEVENSHTEINDISTANCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Levenshtein'>>}
AGG_FUNCTIONS = {'anyHeavy', 'groupBitXor', 'quantileInterpolatedWeighted', 'theilsU', 'groupBitmapOr', 'sequenceNextNode', 'uniqUpTo', 'quantileExactWeighted', 'cramersV', 'covarPop', 'uniqCombined64', 'sumKahan', 'meanZTest', 'sum', 'quantileTDigestWeighted', 'retention', 'mannWhitneyUTest', 'groupArray', 'groupBitmapAnd', 'uniqExact', 'quantilesExact', 'avg', 'sumWithOverflow', 'windowFunnel', 'studentTTest', 'skewSamp', 'boundingRatio', 'groupBitAnd', 'quantilesExactHigh', 'covarSamp', 'uniqTheta', 'varPop', 'quantileGK', 'quantilesExactLow', 'groupArrayLast', 'sumMap', 'quantilesExactWeighted', 'deltaSum', 'contingency', 'minMap', 'anyLast', 'groupBitmap', 'quantileBFloat16Weighted', 'entropy', 'exponentialTimeDecayedAvg', 'quantilesTimingWeighted', 'maxIntersectionsPosition', 'quantilesDeterministic', 'sequenceMatch', 'quantileExact', 'kurtPop', 'groupArraySample', 'quantilesGK', 'quantilesBFloat16Weighted', 'kolmogorovSmirnovTest', 'stddevSamp', 'sumCount', 'cramersVBiasCorrected', 'quantilesTDigestWeighted', 'stochasticLogisticRegression', 'quantiles', 'deltaSumTimestamp', 'quantilesInterpolatedWeighted', 'maxIntersections', 'quantilesTDigest', 'count', 'last_value', 'varSamp', 'categoricalInformationValue', 'quantile', 'simpleLinearRegression', 'sequenceCount', 'histogram', 'quantilesBFloat16', 'quantilesTiming', 'exponentialMovingAverage', 'kurtSamp', 'stochasticLinearRegression', 'stddevPop', 'quantileTimingWeighted', 'any', 'corr', 'groupBitOr', 'sparkBar', 'min', 'avgWeighted', 'rankCorr', 'skewPop', 'largestTriangleThreeBuckets', 'quantileExactLow', 'quantileDeterministic', 'argMax', 'welchTTest', 'uniqHLL12', 'groupArrayMovingAvg', 'first_value', 'groupArrayInsertAt', 'maxMap', 'quantileExactHigh', 'uniqCombined', 'groupBitmapXor', 'groupUniqArray', 'topK', 'argMin', 'uniq', 'quantileTiming', 'max', 'topKWeighted', 'quantileBFloat16', 'quantileTDigest', 'groupArrayMovingSum', 'median', 'intervalLengthSum'}
AGG_FUNCTIONS_SUFFIXES = ['If', 'Array', 'ArrayIf', 'Map', 'SimpleState', 'State', 'Merge', 'MergeState', 'ForEach', 'Distinct', 'OrDefault', 'OrNull', 'Resample', 'ArgMin', 'ArgMax']
FUNC_TOKENS = {<TokenType.BIT: 'BIT'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.XML: 'XML'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.RIGHT: 'RIGHT'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.FORMAT: 'FORMAT'>, <TokenType.UNION: 'UNION'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.POLYGON: 'POLYGON'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.NULL: 'NULL'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.CURRENT_SCHEMA: 'CURRENT_SCHEMA'>, <TokenType.LEFT: 'LEFT'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.CHAR: 'CHAR'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.LINESTRING: 'LINESTRING'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.NAME: 'NAME'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.UDOUBLE: 'UDOUBLE'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.PRIMARY_KEY: 'PRIMARY_KEY'>, <TokenType.BLOB: 'BLOB'>, <TokenType.JSONB: 'JSONB'>, <TokenType.DECIMAL64: 'DECIMAL64'>, <TokenType.ILIKE: 'ILIKE'>, <TokenType.RING: 'RING'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.MULTIPOLYGON: 'MULTIPOLYGON'>, <TokenType.INT256: 'INT256'>, <TokenType.NESTED: 'NESTED'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.DATE: 'DATE'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.YEAR: 'YEAR'>, <TokenType.INET: 'INET'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.WINDOW: 'WINDOW'>, <TokenType.UINT128: 'UINT128'>, <TokenType.BINARY: 'BINARY'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.TEXT: 'TEXT'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.DYNAMIC: 'DYNAMIC'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.ENUM: 'ENUM'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.FIRST: 'FIRST'>, <TokenType.MULTILINESTRING: 'MULTILINESTRING'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.RANGE: 'RANGE'>, <TokenType.INDEX: 'INDEX'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.ANY: 'ANY'>, <TokenType.VAR: 'VAR'>, <TokenType.MAP: 'MAP'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.UUID: 'UUID'>, <TokenType.DECIMAL128: 'DECIMAL128'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.IPV6: 'IPV6'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.UINT256: 'UINT256'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.TABLE: 'TABLE'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.RLIKE: 'RLIKE'>, <TokenType.JSON: 'JSON'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.SUPER: 'SUPER'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.INSERT: 'INSERT'>, <TokenType.ROW: 'ROW'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.ALL: 'ALL'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.POINT: 'POINT'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.UINT: 'UINT'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.MERGE: 'MERGE'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.NEXT: 'NEXT'>, <TokenType.SET: 'SET'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.INT128: 'INT128'>, <TokenType.TIME: 'TIME'>, <TokenType.SMALLDATETIME: 'SMALLDATETIME'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.DATETIME2: 'DATETIME2'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.LIST: 'LIST'>, <TokenType.XOR: 'XOR'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.IPV4: 'IPV4'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.GLOB: 'GLOB'>, <TokenType.SOME: 'SOME'>, <TokenType.AND: 'AND'>, <TokenType.INT: 'INT'>, <TokenType.FILTER: 'FILTER'>, <TokenType.OR: 'OR'>, <TokenType.MONEY: 'MONEY'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.DATE32: 'DATE32'>, <TokenType.DECIMAL256: 'DECIMAL256'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.DECIMAL32: 'DECIMAL32'>, <TokenType.LIKE: 'LIKE'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>}
RESERVED_TOKENS = {<TokenType.L_BRACE: 'L_BRACE'>, <TokenType.DOT: 'DOT'>, <TokenType.PARAMETER: 'PARAMETER'>, <TokenType.EQ: 'EQ'>, <TokenType.PLACEHOLDER: 'PLACEHOLDER'>, <TokenType.CARET: 'CARET'>, <TokenType.SLASH: 'SLASH'>, <TokenType.AMP: 'AMP'>, <TokenType.R_BRACKET: 'R_BRACKET'>, <TokenType.L_PAREN: 'L_PAREN'>, <TokenType.MOD: 'MOD'>, <TokenType.R_BRACE: 'R_BRACE'>, <TokenType.SEMICOLON: 'SEMICOLON'>, <TokenType.STAR: 'STAR'>, <TokenType.PLUS: 'PLUS'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.PIPE: 'PIPE'>, <TokenType.BACKSLASH: 'BACKSLASH'>, <TokenType.DASH: 'DASH'>, <TokenType.COLON: 'COLON'>, <TokenType.HASH: 'HASH'>, <TokenType.NOT: 'NOT'>, <TokenType.R_PAREN: 'R_PAREN'>, <TokenType.GT: 'GT'>, <TokenType.TILDA: 'TILDA'>, <TokenType.L_BRACKET: 'L_BRACKET'>, <TokenType.LT: 'LT'>, <TokenType.COMMA: 'COMMA'>}
ID_VAR_TOKENS = {<TokenType.BIT: 'BIT'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.XML: 'XML'>, <TokenType.WAREHOUSE: 'WAREHOUSE'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.RIGHT: 'RIGHT'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.RENAME: 'RENAME'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.FORMAT: 'FORMAT'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.ROLLUP: 'ROLLUP'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.POLYGON: 'POLYGON'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.SOURCE: 'SOURCE'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.NULL: 'NULL'>, <TokenType.ASC: 'ASC'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.NATURAL: 'NATURAL'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.CURRENT_SCHEMA: 'CURRENT_SCHEMA'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.LEFT: 'LEFT'>, <TokenType.FALSE: 'FALSE'>, <TokenType.REFERENCES: 'REFERENCES'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.CHAR: 'CHAR'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.KILL: 'KILL'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.LINESTRING: 'LINESTRING'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.NAME: 'NAME'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.UDOUBLE: 'UDOUBLE'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.MODEL: 'MODEL'>, <TokenType.BLOB: 'BLOB'>, <TokenType.FULL: 'FULL'>, <TokenType.JSONB: 'JSONB'>, <TokenType.DECIMAL64: 'DECIMAL64'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.STAGE: 'STAGE'>, <TokenType.RING: 'RING'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.MULTIPOLYGON: 'MULTIPOLYGON'>, <TokenType.INT256: 'INT256'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.NESTED: 'NESTED'>, <TokenType.ROWS: 'ROWS'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.DATE: 'DATE'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.YEAR: 'YEAR'>, <TokenType.INET: 'INET'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.WINDOW: 'WINDOW'>, <TokenType.UINT128: 'UINT128'>, <TokenType.BINARY: 'BINARY'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.TEXT: 'TEXT'>, <TokenType.ANTI: 'ANTI'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.SEMI: 'SEMI'>, <TokenType.DYNAMIC: 'DYNAMIC'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.STORAGE_INTEGRATION: 'STORAGE_INTEGRATION'>, <TokenType.CASE: 'CASE'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.FINAL: 'FINAL'>, <TokenType.UNIQUE: 'UNIQUE'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.ENUM: 'ENUM'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.TOP: 'TOP'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.FIRST: 'FIRST'>, <TokenType.KEEP: 'KEEP'>, <TokenType.MULTILINESTRING: 'MULTILINESTRING'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.RANGE: 'RANGE'>, <TokenType.INDEX: 'INDEX'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.VIEW: 'VIEW'>, <TokenType.ANY: 'ANY'>, <TokenType.VAR: 'VAR'>, <TokenType.MAP: 'MAP'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.ASOF: 'ASOF'>, <TokenType.UUID: 'UUID'>, <TokenType.DECIMAL128: 'DECIMAL128'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.IPV6: 'IPV6'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.UINT256: 'UINT256'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.TABLE: 'TABLE'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.COPY: 'COPY'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.ORDINALITY: 'ORDINALITY'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.DESC: 'DESC'>, <TokenType.JSON: 'JSON'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.LIMIT: 'LIMIT'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.ROW: 'ROW'>, <TokenType.SUPER: 'SUPER'>, <TokenType.DELETE: 'DELETE'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.ALL: 'ALL'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.POINT: 'POINT'>, <TokenType.LOAD: 'LOAD'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.USE: 'USE'>, <TokenType.EXPORT: 'EXPORT'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.SINK: 'SINK'>, <TokenType.UINT: 'UINT'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.TRUE: 'TRUE'>, <TokenType.MERGE: 'MERGE'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.FILE_FORMAT: 'FILE_FORMAT'>, <TokenType.SHOW: 'SHOW'>, <TokenType.NEXT: 'NEXT'>, <TokenType.SET: 'SET'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.END: 'END'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.PUT: 'PUT'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.DETACH: 'DETACH'>, <TokenType.INT128: 'INT128'>, <TokenType.TIME: 'TIME'>, <TokenType.SMALLDATETIME: 'SMALLDATETIME'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.STREAMLIT: 'STREAMLIT'>, <TokenType.CUBE: 'CUBE'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.NAMESPACE: 'NAMESPACE'>, <TokenType.IS: 'IS'>, <TokenType.DATETIME2: 'DATETIME2'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.LIST: 'LIST'>, <TokenType.STRAIGHT_JOIN: 'STRAIGHT_JOIN'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.PROCEDURE: 'PROCEDURE'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.IPV4: 'IPV4'>, <TokenType.APPLY: 'APPLY'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.SOME: 'SOME'>, <TokenType.INT: 'INT'>, <TokenType.FILTER: 'FILTER'>, <TokenType.CACHE: 'CACHE'>, <TokenType.TAG: 'TAG'>, <TokenType.DIV: 'DIV'>, <TokenType.MONEY: 'MONEY'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.SETTINGS: 'SETTINGS'>, <TokenType.DATE32: 'DATE32'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.DECIMAL256: 'DECIMAL256'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.DECIMAL32: 'DECIMAL32'>, <TokenType.ATTACH: 'ATTACH'>, <TokenType.LIKE: 'LIKE'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>}
AGG_FUNC_MAPPING = {'anyHeavyIf': ('anyHeavy', 'If'), 'groupBitXorIf': ('groupBitXor', 'If'), 'quantileInterpolatedWeightedIf': ('quantileInterpolatedWeighted', 'If'), 'theilsUIf': ('theilsU', 'If'), 'groupBitmapOrIf': ('groupBitmapOr', 'If'), 'sequenceNextNodeIf': ('sequenceNextNode', 'If'), 'uniqUpToIf': ('uniqUpTo', 'If'), 'quantileExactWeightedIf': ('quantileExactWeighted', 'If'), 'cramersVIf': ('cramersV', 'If'), 'covarPopIf': ('covarPop', 'If'), 'uniqCombined64If': ('uniqCombined64', 'If'), 'sumKahanIf': ('sumKahan', 'If'), 'meanZTestIf': ('meanZTest', 'If'), 'sumIf': ('sum', 'If'), 'quantileTDigestWeightedIf': ('quantileTDigestWeighted', 'If'), 'retentionIf': ('retention', 'If'), 'mannWhitneyUTestIf': ('mannWhitneyUTest', 'If'), 'groupArrayIf': ('groupArray', 'If'), 'groupBitmapAndIf': ('groupBitmapAnd', 'If'), 'uniqExactIf': ('uniqExact', 'If'), 'quantilesExactIf': ('quantilesExact', 'If'), 'avgIf': ('avg', 'If'), 'sumWithOverflowIf': ('sumWithOverflow', 'If'), 'windowFunnelIf': ('windowFunnel', 'If'), 'studentTTestIf': ('studentTTest', 'If'), 'skewSampIf': ('skewSamp', 'If'), 'boundingRatioIf': ('boundingRatio', 'If'), 'groupBitAndIf': ('groupBitAnd', 'If'), 'quantilesExactHighIf': ('quantilesExactHigh', 'If'), 'covarSampIf': ('covarSamp', 'If'), 'uniqThetaIf': ('uniqTheta', 'If'), 'varPopIf': ('varPop', 'If'), 'quantileGKIf': ('quantileGK', 'If'), 'quantilesExactLowIf': ('quantilesExactLow', 'If'), 'groupArrayLastIf': ('groupArrayLast', 'If'), 'sumMapIf': ('sumMap', 'If'), 'quantilesExactWeightedIf': ('quantilesExactWeighted', 'If'), 'deltaSumIf': ('deltaSum', 'If'), 'contingencyIf': ('contingency', 'If'), 'minMapIf': ('minMap', 'If'), 'anyLastIf': ('anyLast', 'If'), 'groupBitmapIf': ('groupBitmap', 'If'), 'quantileBFloat16WeightedIf': ('quantileBFloat16Weighted', 'If'), 'entropyIf': ('entropy', 'If'), 'exponentialTimeDecayedAvgIf': ('exponentialTimeDecayedAvg', 'If'), 'quantilesTimingWeightedIf': ('quantilesTimingWeighted', 'If'), 'maxIntersectionsPositionIf': ('maxIntersectionsPosition', 'If'), 'quantilesDeterministicIf': ('quantilesDeterministic', 'If'), 'sequenceMatchIf': ('sequenceMatch', 'If'), 'quantileExactIf': ('quantileExact', 'If'), 'kurtPopIf': ('kurtPop', 'If'), 'groupArraySampleIf': ('groupArraySample', 'If'), 'quantilesGKIf': ('quantilesGK', 'If'), 'quantilesBFloat16WeightedIf': ('quantilesBFloat16Weighted', 'If'), 'kolmogorovSmirnovTestIf': ('kolmogorovSmirnovTest', 'If'), 'stddevSampIf': ('stddevSamp', 'If'), 'sumCountIf': ('sumCount', 'If'), 'cramersVBiasCorrectedIf': ('cramersVBiasCorrected', 'If'), 'quantilesTDigestWeightedIf': ('quantilesTDigestWeighted', 'If'), 'stochasticLogisticRegressionIf': ('stochasticLogisticRegression', 'If'), 'quantilesIf': ('quantiles', 'If'), 'deltaSumTimestampIf': ('deltaSumTimestamp', 'If'), 'quantilesInterpolatedWeightedIf': ('quantilesInterpolatedWeighted', 'If'), 'maxIntersectionsIf': ('maxIntersections', 'If'), 'quantilesTDigestIf': ('quantilesTDigest', 'If'), 'countIf': ('count', 'If'), 'last_valueIf': ('last_value', 'If'), 'varSampIf': ('varSamp', 'If'), 'categoricalInformationValueIf': ('categoricalInformationValue', 'If'), 'quantileIf': ('quantile', 'If'), 'simpleLinearRegressionIf': ('simpleLinearRegression', 'If'), 'sequenceCountIf': ('sequenceCount', 'If'), 'histogramIf': ('histogram', 'If'), 'quantilesBFloat16If': ('quantilesBFloat16', 'If'), 'quantilesTimingIf': ('quantilesTiming', 'If'), 'exponentialMovingAverageIf': ('exponentialMovingAverage', 'If'), 'kurtSampIf': ('kurtSamp', 'If'), 'stochasticLinearRegressionIf': ('stochasticLinearRegression', 'If'), 'stddevPopIf': ('stddevPop', 'If'), 'quantileTimingWeightedIf': ('quantileTimingWeighted', 'If'), 'anyIf': ('any', 'If'), 'corrIf': ('corr', 'If'), 'groupBitOrIf': ('groupBitOr', 'If'), 'sparkBarIf': ('sparkBar', 'If'), 'minIf': ('min', 'If'), 'avgWeightedIf': ('avgWeighted', 'If'), 'rankCorrIf': ('rankCorr', 'If'), 'skewPopIf': ('skewPop', 'If'), 'largestTriangleThreeBucketsIf': ('largestTriangleThreeBuckets', 'If'), 'quantileExactLowIf': ('quantileExactLow', 'If'), 'quantileDeterministicIf': ('quantileDeterministic', 'If'), 'argMaxIf': ('argMax', 'If'), 'welchTTestIf': ('welchTTest', 'If'), 'uniqHLL12If': ('uniqHLL12', 'If'), 'groupArrayMovingAvgIf': ('groupArrayMovingAvg', 'If'), 'first_valueIf': ('first_value', 'If'), 'groupArrayInsertAtIf': ('groupArrayInsertAt', 'If'), 'maxMapIf': ('maxMap', 'If'), 'quantileExactHighIf': ('quantileExactHigh', 'If'), 'uniqCombinedIf': ('uniqCombined', 'If'), 'groupBitmapXorIf': ('groupBitmapXor', 'If'), 'groupUniqArrayIf': ('groupUniqArray', 'If'), 'topKIf': ('topK', 'If'), 'argMinIf': ('argMin', 'If'), 'uniqIf': ('uniq', 'If'), 'quantileTimingIf': ('quantileTiming', 'If'), 'maxIf': ('max', 'If'), 'topKWeightedIf': ('topKWeighted', 'If'), 'quantileBFloat16If': ('quantileBFloat16', 'If'), 'quantileTDigestIf': ('quantileTDigest', 'If'), 'groupArrayMovingSumIf': ('groupArrayMovingSum', 'If'), 'medianIf': ('median', 'If'), 'intervalLengthSumIf': ('intervalLengthSum', 'If'), 'anyHeavyArray': ('anyHeavy', 'Array'), 'groupBitXorArray': ('groupBitXor', 'Array'), 'quantileInterpolatedWeightedArray': ('quantileInterpolatedWeighted', 'Array'), 'theilsUArray': ('theilsU', 'Array'), 'groupBitmapOrArray': ('groupBitmapOr', 'Array'), 'sequenceNextNodeArray': ('sequenceNextNode', 'Array'), 'uniqUpToArray': ('uniqUpTo', 'Array'), 'quantileExactWeightedArray': ('quantileExactWeighted', 'Array'), 'cramersVArray': ('cramersV', 'Array'), 'covarPopArray': ('covarPop', 'Array'), 'uniqCombined64Array': ('uniqCombined64', 'Array'), 'sumKahanArray': ('sumKahan', 'Array'), 'meanZTestArray': ('meanZTest', 'Array'), 'sumArray': ('sum', 'Array'), 'quantileTDigestWeightedArray': ('quantileTDigestWeighted', 'Array'), 'retentionArray': ('retention', 'Array'), 'mannWhitneyUTestArray': ('mannWhitneyUTest', 'Array'), 'groupArrayArray': ('groupArray', 'Array'), 'groupBitmapAndArray': ('groupBitmapAnd', 'Array'), 'uniqExactArray': ('uniqExact', 'Array'), 'quantilesExactArray': ('quantilesExact', 'Array'), 'avgArray': ('avg', 'Array'), 'sumWithOverflowArray': ('sumWithOverflow', 'Array'), 'windowFunnelArray': ('windowFunnel', 'Array'), 'studentTTestArray': ('studentTTest', 'Array'), 'skewSampArray': ('skewSamp', 'Array'), 'boundingRatioArray': ('boundingRatio', 'Array'), 'groupBitAndArray': ('groupBitAnd', 'Array'), 'quantilesExactHighArray': ('quantilesExactHigh', 'Array'), 'covarSampArray': ('covarSamp', 'Array'), 'uniqThetaArray': ('uniqTheta', 'Array'), 'varPopArray': ('varPop', 'Array'), 'quantileGKArray': ('quantileGK', 'Array'), 'quantilesExactLowArray': ('quantilesExactLow', 'Array'), 'groupArrayLastArray': ('groupArrayLast', 'Array'), 'sumMapArray': ('sumMap', 'Array'), 'quantilesExactWeightedArray': ('quantilesExactWeighted', 'Array'), 'deltaSumArray': ('deltaSum', 'Array'), 'contingencyArray': ('contingency', 'Array'), 'minMapArray': ('minMap', 'Array'), 'anyLastArray': ('anyLast', 'Array'), 'groupBitmapArray': ('groupBitmap', 'Array'), 'quantileBFloat16WeightedArray': ('quantileBFloat16Weighted', 'Array'), 'entropyArray': ('entropy', 'Array'), 'exponentialTimeDecayedAvgArray': ('exponentialTimeDecayedAvg', 'Array'), 'quantilesTimingWeightedArray': ('quantilesTimingWeighted', 'Array'), 'maxIntersectionsPositionArray': ('maxIntersectionsPosition', 'Array'), 'quantilesDeterministicArray': ('quantilesDeterministic', 'Array'), 'sequenceMatchArray': ('sequenceMatch', 'Array'), 'quantileExactArray': ('quantileExact', 'Array'), 'kurtPopArray': ('kurtPop', 'Array'), 'groupArraySampleArray': ('groupArraySample', 'Array'), 'quantilesGKArray': ('quantilesGK', 'Array'), 'quantilesBFloat16WeightedArray': ('quantilesBFloat16Weighted', 'Array'), 'kolmogorovSmirnovTestArray': ('kolmogorovSmirnovTest', 'Array'), 'stddevSampArray': ('stddevSamp', 'Array'), 'sumCountArray': ('sumCount', 'Array'), 'cramersVBiasCorrectedArray': ('cramersVBiasCorrected', 'Array'), 'quantilesTDigestWeightedArray': ('quantilesTDigestWeighted', 'Array'), 'stochasticLogisticRegressionArray': ('stochasticLogisticRegression', 'Array'), 'quantilesArray': ('quantiles', 'Array'), 'deltaSumTimestampArray': ('deltaSumTimestamp', 'Array'), 'quantilesInterpolatedWeightedArray': ('quantilesInterpolatedWeighted', 'Array'), 'maxIntersectionsArray': ('maxIntersections', 'Array'), 'quantilesTDigestArray': ('quantilesTDigest', 'Array'), 'countArray': ('count', 'Array'), 'last_valueArray': ('last_value', 'Array'), 'varSampArray': ('varSamp', 'Array'), 'categoricalInformationValueArray': ('categoricalInformationValue', 'Array'), 'quantileArray': ('quantile', 'Array'), 'simpleLinearRegressionArray': ('simpleLinearRegression', 'Array'), 'sequenceCountArray': ('sequenceCount', 'Array'), 'histogramArray': ('histogram', 'Array'), 'quantilesBFloat16Array': ('quantilesBFloat16', 'Array'), 'quantilesTimingArray': ('quantilesTiming', 'Array'), 'exponentialMovingAverageArray': ('exponentialMovingAverage', 'Array'), 'kurtSampArray': ('kurtSamp', 'Array'), 'stochasticLinearRegressionArray': ('stochasticLinearRegression', 'Array'), 'stddevPopArray': ('stddevPop', 'Array'), 'quantileTimingWeightedArray': ('quantileTimingWeighted', 'Array'), 'anyArray': ('any', 'Array'), 'corrArray': ('corr', 'Array'), 'groupBitOrArray': ('groupBitOr', 'Array'), 'sparkBarArray': ('sparkBar', 'Array'), 'minArray': ('min', 'Array'), 'avgWeightedArray': ('avgWeighted', 'Array'), 'rankCorrArray': ('rankCorr', 'Array'), 'skewPopArray': ('skewPop', 'Array'), 'largestTriangleThreeBucketsArray': ('largestTriangleThreeBuckets', 'Array'), 'quantileExactLowArray': ('quantileExactLow', 'Array'), 'quantileDeterministicArray': ('quantileDeterministic', 'Array'), 'argMaxArray': ('argMax', 'Array'), 'welchTTestArray': ('welchTTest', 'Array'), 'uniqHLL12Array': ('uniqHLL12', 'Array'), 'groupArrayMovingAvgArray': ('groupArrayMovingAvg', 'Array'), 'first_valueArray': ('first_value', 'Array'), 'groupArrayInsertAtArray': ('groupArrayInsertAt', 'Array'), 'maxMapArray': ('maxMap', 'Array'), 'quantileExactHighArray': ('quantileExactHigh', 'Array'), 'uniqCombinedArray': ('uniqCombined', 'Array'), 'groupBitmapXorArray': ('groupBitmapXor', 'Array'), 'groupUniqArrayArray': ('groupUniqArray', 'Array'), 'topKArray': ('topK', 'Array'), 'argMinArray': ('argMin', 'Array'), 'uniqArray': ('uniq', 'Array'), 'quantileTimingArray': ('quantileTiming', 'Array'), 'maxArray': ('max', 'Array'), 'topKWeightedArray': ('topKWeighted', 'Array'), 'quantileBFloat16Array': ('quantileBFloat16', 'Array'), 'quantileTDigestArray': ('quantileTDigest', 'Array'), 'groupArrayMovingSumArray': ('groupArrayMovingSum', 'Array'), 'medianArray': ('median', 'Array'), 'intervalLengthSumArray': ('intervalLengthSum', 'Array'), 'anyHeavyArrayIf': ('anyHeavy', 'ArrayIf'), 'groupBitXorArrayIf': ('groupBitXor', 'ArrayIf'), 'quantileInterpolatedWeightedArrayIf': ('quantileInterpolatedWeighted', 'ArrayIf'), 'theilsUArrayIf': ('theilsU', 'ArrayIf'), 'groupBitmapOrArrayIf': ('groupBitmapOr', 'ArrayIf'), 'sequenceNextNodeArrayIf': ('sequenceNextNode', 'ArrayIf'), 'uniqUpToArrayIf': ('uniqUpTo', 'ArrayIf'), 'quantileExactWeightedArrayIf': ('quantileExactWeighted', 'ArrayIf'), 'cramersVArrayIf': ('cramersV', 'ArrayIf'), 'covarPopArrayIf': ('covarPop', 'ArrayIf'), 'uniqCombined64ArrayIf': ('uniqCombined64', 'ArrayIf'), 'sumKahanArrayIf': ('sumKahan', 'ArrayIf'), 'meanZTestArrayIf': ('meanZTest', 'ArrayIf'), 'sumArrayIf': ('sum', 'ArrayIf'), 'quantileTDigestWeightedArrayIf': ('quantileTDigestWeighted', 'ArrayIf'), 'retentionArrayIf': ('retention', 'ArrayIf'), 'mannWhitneyUTestArrayIf': ('mannWhitneyUTest', 'ArrayIf'), 'groupArrayArrayIf': ('groupArray', 'ArrayIf'), 'groupBitmapAndArrayIf': ('groupBitmapAnd', 'ArrayIf'), 'uniqExactArrayIf': ('uniqExact', 'ArrayIf'), 'quantilesExactArrayIf': ('quantilesExact', 'ArrayIf'), 'avgArrayIf': ('avg', 'ArrayIf'), 'sumWithOverflowArrayIf': ('sumWithOverflow', 'ArrayIf'), 'windowFunnelArrayIf': ('windowFunnel', 'ArrayIf'), 'studentTTestArrayIf': ('studentTTest', 'ArrayIf'), 'skewSampArrayIf': ('skewSamp', 'ArrayIf'), 'boundingRatioArrayIf': ('boundingRatio', 'ArrayIf'), 'groupBitAndArrayIf': ('groupBitAnd', 'ArrayIf'), 'quantilesExactHighArrayIf': ('quantilesExactHigh', 'ArrayIf'), 'covarSampArrayIf': ('covarSamp', 'ArrayIf'), 'uniqThetaArrayIf': ('uniqTheta', 'ArrayIf'), 'varPopArrayIf': ('varPop', 'ArrayIf'), 'quantileGKArrayIf': ('quantileGK', 'ArrayIf'), 'quantilesExactLowArrayIf': ('quantilesExactLow', 'ArrayIf'), 'groupArrayLastArrayIf': ('groupArrayLast', 'ArrayIf'), 'sumMapArrayIf': ('sumMap', 'ArrayIf'), 'quantilesExactWeightedArrayIf': ('quantilesExactWeighted', 'ArrayIf'), 'deltaSumArrayIf': ('deltaSum', 'ArrayIf'), 'contingencyArrayIf': ('contingency', 'ArrayIf'), 'minMapArrayIf': ('minMap', 'ArrayIf'), 'anyLastArrayIf': ('anyLast', 'ArrayIf'), 'groupBitmapArrayIf': ('groupBitmap', 'ArrayIf'), 'quantileBFloat16WeightedArrayIf': ('quantileBFloat16Weighted', 'ArrayIf'), 'entropyArrayIf': ('entropy', 'ArrayIf'), 'exponentialTimeDecayedAvgArrayIf': ('exponentialTimeDecayedAvg', 'ArrayIf'), 'quantilesTimingWeightedArrayIf': ('quantilesTimingWeighted', 'ArrayIf'), 'maxIntersectionsPositionArrayIf': ('maxIntersectionsPosition', 'ArrayIf'), 'quantilesDeterministicArrayIf': ('quantilesDeterministic', 'ArrayIf'), 'sequenceMatchArrayIf': ('sequenceMatch', 'ArrayIf'), 'quantileExactArrayIf': ('quantileExact', 'ArrayIf'), 'kurtPopArrayIf': ('kurtPop', 'ArrayIf'), 'groupArraySampleArrayIf': ('groupArraySample', 'ArrayIf'), 'quantilesGKArrayIf': ('quantilesGK', 'ArrayIf'), 'quantilesBFloat16WeightedArrayIf': ('quantilesBFloat16Weighted', 'ArrayIf'), 'kolmogorovSmirnovTestArrayIf': ('kolmogorovSmirnovTest', 'ArrayIf'), 'stddevSampArrayIf': ('stddevSamp', 'ArrayIf'), 'sumCountArrayIf': ('sumCount', 'ArrayIf'), 'cramersVBiasCorrectedArrayIf': ('cramersVBiasCorrected', 'ArrayIf'), 'quantilesTDigestWeightedArrayIf': ('quantilesTDigestWeighted', 'ArrayIf'), 'stochasticLogisticRegressionArrayIf': ('stochasticLogisticRegression', 'ArrayIf'), 'quantilesArrayIf': ('quantiles', 'ArrayIf'), 'deltaSumTimestampArrayIf': ('deltaSumTimestamp', 'ArrayIf'), 'quantilesInterpolatedWeightedArrayIf': ('quantilesInterpolatedWeighted', 'ArrayIf'), 'maxIntersectionsArrayIf': ('maxIntersections', 'ArrayIf'), 'quantilesTDigestArrayIf': ('quantilesTDigest', 'ArrayIf'), 'countArrayIf': ('count', 'ArrayIf'), 'last_valueArrayIf': ('last_value', 'ArrayIf'), 'varSampArrayIf': ('varSamp', 'ArrayIf'), 'categoricalInformationValueArrayIf': ('categoricalInformationValue', 'ArrayIf'), 'quantileArrayIf': ('quantile', 'ArrayIf'), 'simpleLinearRegressionArrayIf': ('simpleLinearRegression', 'ArrayIf'), 'sequenceCountArrayIf': ('sequenceCount', 'ArrayIf'), 'histogramArrayIf': ('histogram', 'ArrayIf'), 'quantilesBFloat16ArrayIf': ('quantilesBFloat16', 'ArrayIf'), 'quantilesTimingArrayIf': ('quantilesTiming', 'ArrayIf'), 'exponentialMovingAverageArrayIf': ('exponentialMovingAverage', 'ArrayIf'), 'kurtSampArrayIf': ('kurtSamp', 'ArrayIf'), 'stochasticLinearRegressionArrayIf': ('stochasticLinearRegression', 'ArrayIf'), 'stddevPopArrayIf': ('stddevPop', 'ArrayIf'), 'quantileTimingWeightedArrayIf': ('quantileTimingWeighted', 'ArrayIf'), 'anyArrayIf': ('any', 'ArrayIf'), 'corrArrayIf': ('corr', 'ArrayIf'), 'groupBitOrArrayIf': ('groupBitOr', 'ArrayIf'), 'sparkBarArrayIf': ('sparkBar', 'ArrayIf'), 'minArrayIf': ('min', 'ArrayIf'), 'avgWeightedArrayIf': ('avgWeighted', 'ArrayIf'), 'rankCorrArrayIf': ('rankCorr', 'ArrayIf'), 'skewPopArrayIf': ('skewPop', 'ArrayIf'), 'largestTriangleThreeBucketsArrayIf': ('largestTriangleThreeBuckets', 'ArrayIf'), 'quantileExactLowArrayIf': ('quantileExactLow', 'ArrayIf'), 'quantileDeterministicArrayIf': ('quantileDeterministic', 'ArrayIf'), 'argMaxArrayIf': ('argMax', 'ArrayIf'), 'welchTTestArrayIf': ('welchTTest', 'ArrayIf'), 'uniqHLL12ArrayIf': ('uniqHLL12', 'ArrayIf'), 'groupArrayMovingAvgArrayIf': ('groupArrayMovingAvg', 'ArrayIf'), 'first_valueArrayIf': ('first_value', 'ArrayIf'), 'groupArrayInsertAtArrayIf': ('groupArrayInsertAt', 'ArrayIf'), 'maxMapArrayIf': ('maxMap', 'ArrayIf'), 'quantileExactHighArrayIf': ('quantileExactHigh', 'ArrayIf'), 'uniqCombinedArrayIf': ('uniqCombined', 'ArrayIf'), 'groupBitmapXorArrayIf': ('groupBitmapXor', 'ArrayIf'), 'groupUniqArrayArrayIf': ('groupUniqArray', 'ArrayIf'), 'topKArrayIf': ('topK', 'ArrayIf'), 'argMinArrayIf': ('argMin', 'ArrayIf'), 'uniqArrayIf': ('uniq', 'ArrayIf'), 'quantileTimingArrayIf': ('quantileTiming', 'ArrayIf'), 'maxArrayIf': ('max', 'ArrayIf'), 'topKWeightedArrayIf': ('topKWeighted', 'ArrayIf'), 'quantileBFloat16ArrayIf': ('quantileBFloat16', 'ArrayIf'), 'quantileTDigestArrayIf': ('quantileTDigest', 'ArrayIf'), 'groupArrayMovingSumArrayIf': ('groupArrayMovingSum', 'ArrayIf'), 'medianArrayIf': ('median', 'ArrayIf'), 'intervalLengthSumArrayIf': ('intervalLengthSum', 'ArrayIf'), 'anyHeavyMap': ('anyHeavy', 'Map'), 'groupBitXorMap': ('groupBitXor', 'Map'), 'quantileInterpolatedWeightedMap': ('quantileInterpolatedWeighted', 'Map'), 'theilsUMap': ('theilsU', 'Map'), 'groupBitmapOrMap': ('groupBitmapOr', 'Map'), 'sequenceNextNodeMap': ('sequenceNextNode', 'Map'), 'uniqUpToMap': ('uniqUpTo', 'Map'), 'quantileExactWeightedMap': ('quantileExactWeighted', 'Map'), 'cramersVMap': ('cramersV', 'Map'), 'covarPopMap': ('covarPop', 'Map'), 'uniqCombined64Map': ('uniqCombined64', 'Map'), 'sumKahanMap': ('sumKahan', 'Map'), 'meanZTestMap': ('meanZTest', 'Map'), 'sumMap': ('sumMap', ''), 'quantileTDigestWeightedMap': ('quantileTDigestWeighted', 'Map'), 'retentionMap': ('retention', 'Map'), 'mannWhitneyUTestMap': ('mannWhitneyUTest', 'Map'), 'groupArrayMap': ('groupArray', 'Map'), 'groupBitmapAndMap': ('groupBitmapAnd', 'Map'), 'uniqExactMap': ('uniqExact', 'Map'), 'quantilesExactMap': ('quantilesExact', 'Map'), 'avgMap': ('avg', 'Map'), 'sumWithOverflowMap': ('sumWithOverflow', 'Map'), 'windowFunnelMap': ('windowFunnel', 'Map'), 'studentTTestMap': ('studentTTest', 'Map'), 'skewSampMap': ('skewSamp', 'Map'), 'boundingRatioMap': ('boundingRatio', 'Map'), 'groupBitAndMap': ('groupBitAnd', 'Map'), 'quantilesExactHighMap': ('quantilesExactHigh', 'Map'), 'covarSampMap': ('covarSamp', 'Map'), 'uniqThetaMap': ('uniqTheta', 'Map'), 'varPopMap': ('varPop', 'Map'), 'quantileGKMap': ('quantileGK', 'Map'), 'quantilesExactLowMap': ('quantilesExactLow', 'Map'), 'groupArrayLastMap': ('groupArrayLast', 'Map'), 'sumMapMap': ('sumMap', 'Map'), 'quantilesExactWeightedMap': ('quantilesExactWeighted', 'Map'), 'deltaSumMap': ('deltaSum', 'Map'), 'contingencyMap': ('contingency', 'Map'), 'minMapMap': ('minMap', 'Map'), 'anyLastMap': ('anyLast', 'Map'), 'groupBitmapMap': ('groupBitmap', 'Map'), 'quantileBFloat16WeightedMap': ('quantileBFloat16Weighted', 'Map'), 'entropyMap': ('entropy', 'Map'), 'exponentialTimeDecayedAvgMap': ('exponentialTimeDecayedAvg', 'Map'), 'quantilesTimingWeightedMap': ('quantilesTimingWeighted', 'Map'), 'maxIntersectionsPositionMap': ('maxIntersectionsPosition', 'Map'), 'quantilesDeterministicMap': ('quantilesDeterministic', 'Map'), 'sequenceMatchMap': ('sequenceMatch', 'Map'), 'quantileExactMap': ('quantileExact', 'Map'), 'kurtPopMap': ('kurtPop', 'Map'), 'groupArraySampleMap': ('groupArraySample', 'Map'), 'quantilesGKMap': ('quantilesGK', 'Map'), 'quantilesBFloat16WeightedMap': ('quantilesBFloat16Weighted', 'Map'), 'kolmogorovSmirnovTestMap': ('kolmogorovSmirnovTest', 'Map'), 'stddevSampMap': ('stddevSamp', 'Map'), 'sumCountMap': ('sumCount', 'Map'), 'cramersVBiasCorrectedMap': ('cramersVBiasCorrected', 'Map'), 'quantilesTDigestWeightedMap': ('quantilesTDigestWeighted', 'Map'), 'stochasticLogisticRegressionMap': ('stochasticLogisticRegression', 'Map'), 'quantilesMap': ('quantiles', 'Map'), 'deltaSumTimestampMap': ('deltaSumTimestamp', 'Map'), 'quantilesInterpolatedWeightedMap': ('quantilesInterpolatedWeighted', 'Map'), 'maxIntersectionsMap': ('maxIntersections', 'Map'), 'quantilesTDigestMap': ('quantilesTDigest', 'Map'), 'countMap': ('count', 'Map'), 'last_valueMap': ('last_value', 'Map'), 'varSampMap': ('varSamp', 'Map'), 'categoricalInformationValueMap': ('categoricalInformationValue', 'Map'), 'quantileMap': ('quantile', 'Map'), 'simpleLinearRegressionMap': ('simpleLinearRegression', 'Map'), 'sequenceCountMap': ('sequenceCount', 'Map'), 'histogramMap': ('histogram', 'Map'), 'quantilesBFloat16Map': ('quantilesBFloat16', 'Map'), 'quantilesTimingMap': ('quantilesTiming', 'Map'), 'exponentialMovingAverageMap': ('exponentialMovingAverage', 'Map'), 'kurtSampMap': ('kurtSamp', 'Map'), 'stochasticLinearRegressionMap': ('stochasticLinearRegression', 'Map'), 'stddevPopMap': ('stddevPop', 'Map'), 'quantileTimingWeightedMap': ('quantileTimingWeighted', 'Map'), 'anyMap': ('any', 'Map'), 'corrMap': ('corr', 'Map'), 'groupBitOrMap': ('groupBitOr', 'Map'), 'sparkBarMap': ('sparkBar', 'Map'), 'minMap': ('minMap', ''), 'avgWeightedMap': ('avgWeighted', 'Map'), 'rankCorrMap': ('rankCorr', 'Map'), 'skewPopMap': ('skewPop', 'Map'), 'largestTriangleThreeBucketsMap': ('largestTriangleThreeBuckets', 'Map'), 'quantileExactLowMap': ('quantileExactLow', 'Map'), 'quantileDeterministicMap': ('quantileDeterministic', 'Map'), 'argMaxMap': ('argMax', 'Map'), 'welchTTestMap': ('welchTTest', 'Map'), 'uniqHLL12Map': ('uniqHLL12', 'Map'), 'groupArrayMovingAvgMap': ('groupArrayMovingAvg', 'Map'), 'first_valueMap': ('first_value', 'Map'), 'groupArrayInsertAtMap': ('groupArrayInsertAt', 'Map'), 'maxMapMap': ('maxMap', 'Map'), 'quantileExactHighMap': ('quantileExactHigh', 'Map'), 'uniqCombinedMap': ('uniqCombined', 'Map'), 'groupBitmapXorMap': ('groupBitmapXor', 'Map'), 'groupUniqArrayMap': ('groupUniqArray', 'Map'), 'topKMap': ('topK', 'Map'), 'argMinMap': ('argMin', 'Map'), 'uniqMap': ('uniq', 'Map'), 'quantileTimingMap': ('quantileTiming', 'Map'), 'maxMap': ('maxMap', ''), 'topKWeightedMap': ('topKWeighted', 'Map'), 'quantileBFloat16Map': ('quantileBFloat16', 'Map'), 'quantileTDigestMap': ('quantileTDigest', 'Map'), 'groupArrayMovingSumMap': ('groupArrayMovingSum', 'Map'), 'medianMap': ('median', 'Map'), 'intervalLengthSumMap': ('intervalLengthSum', 'Map'), 'anyHeavySimpleState': ('anyHeavy', 'SimpleState'), 'groupBitXorSimpleState': ('groupBitXor', 'SimpleState'), 'quantileInterpolatedWeightedSimpleState': ('quantileInterpolatedWeighted', 'SimpleState'), 'theilsUSimpleState': ('theilsU', 'SimpleState'), 'groupBitmapOrSimpleState': ('groupBitmapOr', 'SimpleState'), 'sequenceNextNodeSimpleState': ('sequenceNextNode', 'SimpleState'), 'uniqUpToSimpleState': ('uniqUpTo', 'SimpleState'), 'quantileExactWeightedSimpleState': ('quantileExactWeighted', 'SimpleState'), 'cramersVSimpleState': ('cramersV', 'SimpleState'), 'covarPopSimpleState': ('covarPop', 'SimpleState'), 'uniqCombined64SimpleState': ('uniqCombined64', 'SimpleState'), 'sumKahanSimpleState': ('sumKahan', 'SimpleState'), 'meanZTestSimpleState': ('meanZTest', 'SimpleState'), 'sumSimpleState': ('sum', 'SimpleState'), 'quantileTDigestWeightedSimpleState': ('quantileTDigestWeighted', 'SimpleState'), 'retentionSimpleState': ('retention', 'SimpleState'), 'mannWhitneyUTestSimpleState': ('mannWhitneyUTest', 'SimpleState'), 'groupArraySimpleState': ('groupArray', 'SimpleState'), 'groupBitmapAndSimpleState': ('groupBitmapAnd', 'SimpleState'), 'uniqExactSimpleState': ('uniqExact', 'SimpleState'), 'quantilesExactSimpleState': ('quantilesExact', 'SimpleState'), 'avgSimpleState': ('avg', 'SimpleState'), 'sumWithOverflowSimpleState': ('sumWithOverflow', 'SimpleState'), 'windowFunnelSimpleState': ('windowFunnel', 'SimpleState'), 'studentTTestSimpleState': ('studentTTest', 'SimpleState'), 'skewSampSimpleState': ('skewSamp', 'SimpleState'), 'boundingRatioSimpleState': ('boundingRatio', 'SimpleState'), 'groupBitAndSimpleState': ('groupBitAnd', 'SimpleState'), 'quantilesExactHighSimpleState': ('quantilesExactHigh', 'SimpleState'), 'covarSampSimpleState': ('covarSamp', 'SimpleState'), 'uniqThetaSimpleState': ('uniqTheta', 'SimpleState'), 'varPopSimpleState': ('varPop', 'SimpleState'), 'quantileGKSimpleState': ('quantileGK', 'SimpleState'), 'quantilesExactLowSimpleState': ('quantilesExactLow', 'SimpleState'), 'groupArrayLastSimpleState': ('groupArrayLast', 'SimpleState'), 'sumMapSimpleState': ('sumMap', 'SimpleState'), 'quantilesExactWeightedSimpleState': ('quantilesExactWeighted', 'SimpleState'), 'deltaSumSimpleState': ('deltaSum', 'SimpleState'), 'contingencySimpleState': ('contingency', 'SimpleState'), 'minMapSimpleState': ('minMap', 'SimpleState'), 'anyLastSimpleState': ('anyLast', 'SimpleState'), 'groupBitmapSimpleState': ('groupBitmap', 'SimpleState'), 'quantileBFloat16WeightedSimpleState': ('quantileBFloat16Weighted', 'SimpleState'), 'entropySimpleState': ('entropy', 'SimpleState'), 'exponentialTimeDecayedAvgSimpleState': ('exponentialTimeDecayedAvg', 'SimpleState'), 'quantilesTimingWeightedSimpleState': ('quantilesTimingWeighted', 'SimpleState'), 'maxIntersectionsPositionSimpleState': ('maxIntersectionsPosition', 'SimpleState'), 'quantilesDeterministicSimpleState': ('quantilesDeterministic', 'SimpleState'), 'sequenceMatchSimpleState': ('sequenceMatch', 'SimpleState'), 'quantileExactSimpleState': ('quantileExact', 'SimpleState'), 'kurtPopSimpleState': ('kurtPop', 'SimpleState'), 'groupArraySampleSimpleState': ('groupArraySample', 'SimpleState'), 'quantilesGKSimpleState': ('quantilesGK', 'SimpleState'), 'quantilesBFloat16WeightedSimpleState': ('quantilesBFloat16Weighted', 'SimpleState'), 'kolmogorovSmirnovTestSimpleState': ('kolmogorovSmirnovTest', 'SimpleState'), 'stddevSampSimpleState': ('stddevSamp', 'SimpleState'), 'sumCountSimpleState': ('sumCount', 'SimpleState'), 'cramersVBiasCorrectedSimpleState': ('cramersVBiasCorrected', 'SimpleState'), 'quantilesTDigestWeightedSimpleState': ('quantilesTDigestWeighted', 'SimpleState'), 'stochasticLogisticRegressionSimpleState': ('stochasticLogisticRegression', 'SimpleState'), 'quantilesSimpleState': ('quantiles', 'SimpleState'), 'deltaSumTimestampSimpleState': ('deltaSumTimestamp', 'SimpleState'), 'quantilesInterpolatedWeightedSimpleState': ('quantilesInterpolatedWeighted', 'SimpleState'), 'maxIntersectionsSimpleState': ('maxIntersections', 'SimpleState'), 'quantilesTDigestSimpleState': ('quantilesTDigest', 'SimpleState'), 'countSimpleState': ('count', 'SimpleState'), 'last_valueSimpleState': ('last_value', 'SimpleState'), 'varSampSimpleState': ('varSamp', 'SimpleState'), 'categoricalInformationValueSimpleState': ('categoricalInformationValue', 'SimpleState'), 'quantileSimpleState': ('quantile', 'SimpleState'), 'simpleLinearRegressionSimpleState': ('simpleLinearRegression', 'SimpleState'), 'sequenceCountSimpleState': ('sequenceCount', 'SimpleState'), 'histogramSimpleState': ('histogram', 'SimpleState'), 'quantilesBFloat16SimpleState': ('quantilesBFloat16', 'SimpleState'), 'quantilesTimingSimpleState': ('quantilesTiming', 'SimpleState'), 'exponentialMovingAverageSimpleState': ('exponentialMovingAverage', 'SimpleState'), 'kurtSampSimpleState': ('kurtSamp', 'SimpleState'), 'stochasticLinearRegressionSimpleState': ('stochasticLinearRegression', 'SimpleState'), 'stddevPopSimpleState': ('stddevPop', 'SimpleState'), 'quantileTimingWeightedSimpleState': ('quantileTimingWeighted', 'SimpleState'), 'anySimpleState': ('any', 'SimpleState'), 'corrSimpleState': ('corr', 'SimpleState'), 'groupBitOrSimpleState': ('groupBitOr', 'SimpleState'), 'sparkBarSimpleState': ('sparkBar', 'SimpleState'), 'minSimpleState': ('min', 'SimpleState'), 'avgWeightedSimpleState': ('avgWeighted', 'SimpleState'), 'rankCorrSimpleState': ('rankCorr', 'SimpleState'), 'skewPopSimpleState': ('skewPop', 'SimpleState'), 'largestTriangleThreeBucketsSimpleState': ('largestTriangleThreeBuckets', 'SimpleState'), 'quantileExactLowSimpleState': ('quantileExactLow', 'SimpleState'), 'quantileDeterministicSimpleState': ('quantileDeterministic', 'SimpleState'), 'argMaxSimpleState': ('argMax', 'SimpleState'), 'welchTTestSimpleState': ('welchTTest', 'SimpleState'), 'uniqHLL12SimpleState': ('uniqHLL12', 'SimpleState'), 'groupArrayMovingAvgSimpleState': ('groupArrayMovingAvg', 'SimpleState'), 'first_valueSimpleState': ('first_value', 'SimpleState'), 'groupArrayInsertAtSimpleState': ('groupArrayInsertAt', 'SimpleState'), 'maxMapSimpleState': ('maxMap', 'SimpleState'), 'quantileExactHighSimpleState': ('quantileExactHigh', 'SimpleState'), 'uniqCombinedSimpleState': ('uniqCombined', 'SimpleState'), 'groupBitmapXorSimpleState': ('groupBitmapXor', 'SimpleState'), 'groupUniqArraySimpleState': ('groupUniqArray', 'SimpleState'), 'topKSimpleState': ('topK', 'SimpleState'), 'argMinSimpleState': ('argMin', 'SimpleState'), 'uniqSimpleState': ('uniq', 'SimpleState'), 'quantileTimingSimpleState': ('quantileTiming', 'SimpleState'), 'maxSimpleState': ('max', 'SimpleState'), 'topKWeightedSimpleState': ('topKWeighted', 'SimpleState'), 'quantileBFloat16SimpleState': ('quantileBFloat16', 'SimpleState'), 'quantileTDigestSimpleState': ('quantileTDigest', 'SimpleState'), 'groupArrayMovingSumSimpleState': ('groupArrayMovingSum', 'SimpleState'), 'medianSimpleState': ('median', 'SimpleState'), 'intervalLengthSumSimpleState': ('intervalLengthSum', 'SimpleState'), 'anyHeavyState': ('anyHeavy', 'State'), 'groupBitXorState': ('groupBitXor', 'State'), 'quantileInterpolatedWeightedState': ('quantileInterpolatedWeighted', 'State'), 'theilsUState': ('theilsU', 'State'), 'groupBitmapOrState': ('groupBitmapOr', 'State'), 'sequenceNextNodeState': ('sequenceNextNode', 'State'), 'uniqUpToState': ('uniqUpTo', 'State'), 'quantileExactWeightedState': ('quantileExactWeighted', 'State'), 'cramersVState': ('cramersV', 'State'), 'covarPopState': ('covarPop', 'State'), 'uniqCombined64State': ('uniqCombined64', 'State'), 'sumKahanState': ('sumKahan', 'State'), 'meanZTestState': ('meanZTest', 'State'), 'sumState': ('sum', 'State'), 'quantileTDigestWeightedState': ('quantileTDigestWeighted', 'State'), 'retentionState': ('retention', 'State'), 'mannWhitneyUTestState': ('mannWhitneyUTest', 'State'), 'groupArrayState': ('groupArray', 'State'), 'groupBitmapAndState': ('groupBitmapAnd', 'State'), 'uniqExactState': ('uniqExact', 'State'), 'quantilesExactState': ('quantilesExact', 'State'), 'avgState': ('avg', 'State'), 'sumWithOverflowState': ('sumWithOverflow', 'State'), 'windowFunnelState': ('windowFunnel', 'State'), 'studentTTestState': ('studentTTest', 'State'), 'skewSampState': ('skewSamp', 'State'), 'boundingRatioState': ('boundingRatio', 'State'), 'groupBitAndState': ('groupBitAnd', 'State'), 'quantilesExactHighState': ('quantilesExactHigh', 'State'), 'covarSampState': ('covarSamp', 'State'), 'uniqThetaState': ('uniqTheta', 'State'), 'varPopState': ('varPop', 'State'), 'quantileGKState': ('quantileGK', 'State'), 'quantilesExactLowState': ('quantilesExactLow', 'State'), 'groupArrayLastState': ('groupArrayLast', 'State'), 'sumMapState': ('sumMap', 'State'), 'quantilesExactWeightedState': ('quantilesExactWeighted', 'State'), 'deltaSumState': ('deltaSum', 'State'), 'contingencyState': ('contingency', 'State'), 'minMapState': ('minMap', 'State'), 'anyLastState': ('anyLast', 'State'), 'groupBitmapState': ('groupBitmap', 'State'), 'quantileBFloat16WeightedState': ('quantileBFloat16Weighted', 'State'), 'entropyState': ('entropy', 'State'), 'exponentialTimeDecayedAvgState': ('exponentialTimeDecayedAvg', 'State'), 'quantilesTimingWeightedState': ('quantilesTimingWeighted', 'State'), 'maxIntersectionsPositionState': ('maxIntersectionsPosition', 'State'), 'quantilesDeterministicState': ('quantilesDeterministic', 'State'), 'sequenceMatchState': ('sequenceMatch', 'State'), 'quantileExactState': ('quantileExact', 'State'), 'kurtPopState': ('kurtPop', 'State'), 'groupArraySampleState': ('groupArraySample', 'State'), 'quantilesGKState': ('quantilesGK', 'State'), 'quantilesBFloat16WeightedState': ('quantilesBFloat16Weighted', 'State'), 'kolmogorovSmirnovTestState': ('kolmogorovSmirnovTest', 'State'), 'stddevSampState': ('stddevSamp', 'State'), 'sumCountState': ('sumCount', 'State'), 'cramersVBiasCorrectedState': ('cramersVBiasCorrected', 'State'), 'quantilesTDigestWeightedState': ('quantilesTDigestWeighted', 'State'), 'stochasticLogisticRegressionState': ('stochasticLogisticRegression', 'State'), 'quantilesState': ('quantiles', 'State'), 'deltaSumTimestampState': ('deltaSumTimestamp', 'State'), 'quantilesInterpolatedWeightedState': ('quantilesInterpolatedWeighted', 'State'), 'maxIntersectionsState': ('maxIntersections', 'State'), 'quantilesTDigestState': ('quantilesTDigest', 'State'), 'countState': ('count', 'State'), 'last_valueState': ('last_value', 'State'), 'varSampState': ('varSamp', 'State'), 'categoricalInformationValueState': ('categoricalInformationValue', 'State'), 'quantileState': ('quantile', 'State'), 'simpleLinearRegressionState': ('simpleLinearRegression', 'State'), 'sequenceCountState': ('sequenceCount', 'State'), 'histogramState': ('histogram', 'State'), 'quantilesBFloat16State': ('quantilesBFloat16', 'State'), 'quantilesTimingState': ('quantilesTiming', 'State'), 'exponentialMovingAverageState': ('exponentialMovingAverage', 'State'), 'kurtSampState': ('kurtSamp', 'State'), 'stochasticLinearRegressionState': ('stochasticLinearRegression', 'State'), 'stddevPopState': ('stddevPop', 'State'), 'quantileTimingWeightedState': ('quantileTimingWeighted', 'State'), 'anyState': ('any', 'State'), 'corrState': ('corr', 'State'), 'groupBitOrState': ('groupBitOr', 'State'), 'sparkBarState': ('sparkBar', 'State'), 'minState': ('min', 'State'), 'avgWeightedState': ('avgWeighted', 'State'), 'rankCorrState': ('rankCorr', 'State'), 'skewPopState': ('skewPop', 'State'), 'largestTriangleThreeBucketsState': ('largestTriangleThreeBuckets', 'State'), 'quantileExactLowState': ('quantileExactLow', 'State'), 'quantileDeterministicState': ('quantileDeterministic', 'State'), 'argMaxState': ('argMax', 'State'), 'welchTTestState': ('welchTTest', 'State'), 'uniqHLL12State': ('uniqHLL12', 'State'), 'groupArrayMovingAvgState': ('groupArrayMovingAvg', 'State'), 'first_valueState': ('first_value', 'State'), 'groupArrayInsertAtState': ('groupArrayInsertAt', 'State'), 'maxMapState': ('maxMap', 'State'), 'quantileExactHighState': ('quantileExactHigh', 'State'), 'uniqCombinedState': ('uniqCombined', 'State'), 'groupBitmapXorState': ('groupBitmapXor', 'State'), 'groupUniqArrayState': ('groupUniqArray', 'State'), 'topKState': ('topK', 'State'), 'argMinState': ('argMin', 'State'), 'uniqState': ('uniq', 'State'), 'quantileTimingState': ('quantileTiming', 'State'), 'maxState': ('max', 'State'), 'topKWeightedState': ('topKWeighted', 'State'), 'quantileBFloat16State': ('quantileBFloat16', 'State'), 'quantileTDigestState': ('quantileTDigest', 'State'), 'groupArrayMovingSumState': ('groupArrayMovingSum', 'State'), 'medianState': ('median', 'State'), 'intervalLengthSumState': ('intervalLengthSum', 'State'), 'anyHeavyMerge': ('anyHeavy', 'Merge'), 'groupBitXorMerge': ('groupBitXor', 'Merge'), 'quantileInterpolatedWeightedMerge': ('quantileInterpolatedWeighted', 'Merge'), 'theilsUMerge': ('theilsU', 'Merge'), 'groupBitmapOrMerge': ('groupBitmapOr', 'Merge'), 'sequenceNextNodeMerge': ('sequenceNextNode', 'Merge'), 'uniqUpToMerge': ('uniqUpTo', 'Merge'), 'quantileExactWeightedMerge': ('quantileExactWeighted', 'Merge'), 'cramersVMerge': ('cramersV', 'Merge'), 'covarPopMerge': ('covarPop', 'Merge'), 'uniqCombined64Merge': ('uniqCombined64', 'Merge'), 'sumKahanMerge': ('sumKahan', 'Merge'), 'meanZTestMerge': ('meanZTest', 'Merge'), 'sumMerge': ('sum', 'Merge'), 'quantileTDigestWeightedMerge': ('quantileTDigestWeighted', 'Merge'), 'retentionMerge': ('retention', 'Merge'), 'mannWhitneyUTestMerge': ('mannWhitneyUTest', 'Merge'), 'groupArrayMerge': ('groupArray', 'Merge'), 'groupBitmapAndMerge': ('groupBitmapAnd', 'Merge'), 'uniqExactMerge': ('uniqExact', 'Merge'), 'quantilesExactMerge': ('quantilesExact', 'Merge'), 'avgMerge': ('avg', 'Merge'), 'sumWithOverflowMerge': ('sumWithOverflow', 'Merge'), 'windowFunnelMerge': ('windowFunnel', 'Merge'), 'studentTTestMerge': ('studentTTest', 'Merge'), 'skewSampMerge': ('skewSamp', 'Merge'), 'boundingRatioMerge': ('boundingRatio', 'Merge'), 'groupBitAndMerge': ('groupBitAnd', 'Merge'), 'quantilesExactHighMerge': ('quantilesExactHigh', 'Merge'), 'covarSampMerge': ('covarSamp', 'Merge'), 'uniqThetaMerge': ('uniqTheta', 'Merge'), 'varPopMerge': ('varPop', 'Merge'), 'quantileGKMerge': ('quantileGK', 'Merge'), 'quantilesExactLowMerge': ('quantilesExactLow', 'Merge'), 'groupArrayLastMerge': ('groupArrayLast', 'Merge'), 'sumMapMerge': ('sumMap', 'Merge'), 'quantilesExactWeightedMerge': ('quantilesExactWeighted', 'Merge'), 'deltaSumMerge': ('deltaSum', 'Merge'), 'contingencyMerge': ('contingency', 'Merge'), 'minMapMerge': ('minMap', 'Merge'), 'anyLastMerge': ('anyLast', 'Merge'), 'groupBitmapMerge': ('groupBitmap', 'Merge'), 'quantileBFloat16WeightedMerge': ('quantileBFloat16Weighted', 'Merge'), 'entropyMerge': ('entropy', 'Merge'), 'exponentialTimeDecayedAvgMerge': ('exponentialTimeDecayedAvg', 'Merge'), 'quantilesTimingWeightedMerge': ('quantilesTimingWeighted', 'Merge'), 'maxIntersectionsPositionMerge': ('maxIntersectionsPosition', 'Merge'), 'quantilesDeterministicMerge': ('quantilesDeterministic', 'Merge'), 'sequenceMatchMerge': ('sequenceMatch', 'Merge'), 'quantileExactMerge': ('quantileExact', 'Merge'), 'kurtPopMerge': ('kurtPop', 'Merge'), 'groupArraySampleMerge': ('groupArraySample', 'Merge'), 'quantilesGKMerge': ('quantilesGK', 'Merge'), 'quantilesBFloat16WeightedMerge': ('quantilesBFloat16Weighted', 'Merge'), 'kolmogorovSmirnovTestMerge': ('kolmogorovSmirnovTest', 'Merge'), 'stddevSampMerge': ('stddevSamp', 'Merge'), 'sumCountMerge': ('sumCount', 'Merge'), 'cramersVBiasCorrectedMerge': ('cramersVBiasCorrected', 'Merge'), 'quantilesTDigestWeightedMerge': ('quantilesTDigestWeighted', 'Merge'), 'stochasticLogisticRegressionMerge': ('stochasticLogisticRegression', 'Merge'), 'quantilesMerge': ('quantiles', 'Merge'), 'deltaSumTimestampMerge': ('deltaSumTimestamp', 'Merge'), 'quantilesInterpolatedWeightedMerge': ('quantilesInterpolatedWeighted', 'Merge'), 'maxIntersectionsMerge': ('maxIntersections', 'Merge'), 'quantilesTDigestMerge': ('quantilesTDigest', 'Merge'), 'countMerge': ('count', 'Merge'), 'last_valueMerge': ('last_value', 'Merge'), 'varSampMerge': ('varSamp', 'Merge'), 'categoricalInformationValueMerge': ('categoricalInformationValue', 'Merge'), 'quantileMerge': ('quantile', 'Merge'), 'simpleLinearRegressionMerge': ('simpleLinearRegression', 'Merge'), 'sequenceCountMerge': ('sequenceCount', 'Merge'), 'histogramMerge': ('histogram', 'Merge'), 'quantilesBFloat16Merge': ('quantilesBFloat16', 'Merge'), 'quantilesTimingMerge': ('quantilesTiming', 'Merge'), 'exponentialMovingAverageMerge': ('exponentialMovingAverage', 'Merge'), 'kurtSampMerge': ('kurtSamp', 'Merge'), 'stochasticLinearRegressionMerge': ('stochasticLinearRegression', 'Merge'), 'stddevPopMerge': ('stddevPop', 'Merge'), 'quantileTimingWeightedMerge': ('quantileTimingWeighted', 'Merge'), 'anyMerge': ('any', 'Merge'), 'corrMerge': ('corr', 'Merge'), 'groupBitOrMerge': ('groupBitOr', 'Merge'), 'sparkBarMerge': ('sparkBar', 'Merge'), 'minMerge': ('min', 'Merge'), 'avgWeightedMerge': ('avgWeighted', 'Merge'), 'rankCorrMerge': ('rankCorr', 'Merge'), 'skewPopMerge': ('skewPop', 'Merge'), 'largestTriangleThreeBucketsMerge': ('largestTriangleThreeBuckets', 'Merge'), 'quantileExactLowMerge': ('quantileExactLow', 'Merge'), 'quantileDeterministicMerge': ('quantileDeterministic', 'Merge'), 'argMaxMerge': ('argMax', 'Merge'), 'welchTTestMerge': ('welchTTest', 'Merge'), 'uniqHLL12Merge': ('uniqHLL12', 'Merge'), 'groupArrayMovingAvgMerge': ('groupArrayMovingAvg', 'Merge'), 'first_valueMerge': ('first_value', 'Merge'), 'groupArrayInsertAtMerge': ('groupArrayInsertAt', 'Merge'), 'maxMapMerge': ('maxMap', 'Merge'), 'quantileExactHighMerge': ('quantileExactHigh', 'Merge'), 'uniqCombinedMerge': ('uniqCombined', 'Merge'), 'groupBitmapXorMerge': ('groupBitmapXor', 'Merge'), 'groupUniqArrayMerge': ('groupUniqArray', 'Merge'), 'topKMerge': ('topK', 'Merge'), 'argMinMerge': ('argMin', 'Merge'), 'uniqMerge': ('uniq', 'Merge'), 'quantileTimingMerge': ('quantileTiming', 'Merge'), 'maxMerge': ('max', 'Merge'), 'topKWeightedMerge': ('topKWeighted', 'Merge'), 'quantileBFloat16Merge': ('quantileBFloat16', 'Merge'), 'quantileTDigestMerge': ('quantileTDigest', 'Merge'), 'groupArrayMovingSumMerge': ('groupArrayMovingSum', 'Merge'), 'medianMerge': ('median', 'Merge'), 'intervalLengthSumMerge': ('intervalLengthSum', 'Merge'), 'anyHeavyMergeState': ('anyHeavy', 'MergeState'), 'groupBitXorMergeState': ('groupBitXor', 'MergeState'), 'quantileInterpolatedWeightedMergeState': ('quantileInterpolatedWeighted', 'MergeState'), 'theilsUMergeState': ('theilsU', 'MergeState'), 'groupBitmapOrMergeState': ('groupBitmapOr', 'MergeState'), 'sequenceNextNodeMergeState': ('sequenceNextNode', 'MergeState'), 'uniqUpToMergeState': ('uniqUpTo', 'MergeState'), 'quantileExactWeightedMergeState': ('quantileExactWeighted', 'MergeState'), 'cramersVMergeState': ('cramersV', 'MergeState'), 'covarPopMergeState': ('covarPop', 'MergeState'), 'uniqCombined64MergeState': ('uniqCombined64', 'MergeState'), 'sumKahanMergeState': ('sumKahan', 'MergeState'), 'meanZTestMergeState': ('meanZTest', 'MergeState'), 'sumMergeState': ('sum', 'MergeState'), 'quantileTDigestWeightedMergeState': ('quantileTDigestWeighted', 'MergeState'), 'retentionMergeState': ('retention', 'MergeState'), 'mannWhitneyUTestMergeState': ('mannWhitneyUTest', 'MergeState'), 'groupArrayMergeState': ('groupArray', 'MergeState'), 'groupBitmapAndMergeState': ('groupBitmapAnd', 'MergeState'), 'uniqExactMergeState': ('uniqExact', 'MergeState'), 'quantilesExactMergeState': ('quantilesExact', 'MergeState'), 'avgMergeState': ('avg', 'MergeState'), 'sumWithOverflowMergeState': ('sumWithOverflow', 'MergeState'), 'windowFunnelMergeState': ('windowFunnel', 'MergeState'), 'studentTTestMergeState': ('studentTTest', 'MergeState'), 'skewSampMergeState': ('skewSamp', 'MergeState'), 'boundingRatioMergeState': ('boundingRatio', 'MergeState'), 'groupBitAndMergeState': ('groupBitAnd', 'MergeState'), 'quantilesExactHighMergeState': ('quantilesExactHigh', 'MergeState'), 'covarSampMergeState': ('covarSamp', 'MergeState'), 'uniqThetaMergeState': ('uniqTheta', 'MergeState'), 'varPopMergeState': ('varPop', 'MergeState'), 'quantileGKMergeState': ('quantileGK', 'MergeState'), 'quantilesExactLowMergeState': ('quantilesExactLow', 'MergeState'), 'groupArrayLastMergeState': ('groupArrayLast', 'MergeState'), 'sumMapMergeState': ('sumMap', 'MergeState'), 'quantilesExactWeightedMergeState': ('quantilesExactWeighted', 'MergeState'), 'deltaSumMergeState': ('deltaSum', 'MergeState'), 'contingencyMergeState': ('contingency', 'MergeState'), 'minMapMergeState': ('minMap', 'MergeState'), 'anyLastMergeState': ('anyLast', 'MergeState'), 'groupBitmapMergeState': ('groupBitmap', 'MergeState'), 'quantileBFloat16WeightedMergeState': ('quantileBFloat16Weighted', 'MergeState'), 'entropyMergeState': ('entropy', 'MergeState'), 'exponentialTimeDecayedAvgMergeState': ('exponentialTimeDecayedAvg', 'MergeState'), 'quantilesTimingWeightedMergeState': ('quantilesTimingWeighted', 'MergeState'), 'maxIntersectionsPositionMergeState': ('maxIntersectionsPosition', 'MergeState'), 'quantilesDeterministicMergeState': ('quantilesDeterministic', 'MergeState'), 'sequenceMatchMergeState': ('sequenceMatch', 'MergeState'), 'quantileExactMergeState': ('quantileExact', 'MergeState'), 'kurtPopMergeState': ('kurtPop', 'MergeState'), 'groupArraySampleMergeState': ('groupArraySample', 'MergeState'), 'quantilesGKMergeState': ('quantilesGK', 'MergeState'), 'quantilesBFloat16WeightedMergeState': ('quantilesBFloat16Weighted', 'MergeState'), 'kolmogorovSmirnovTestMergeState': ('kolmogorovSmirnovTest', 'MergeState'), 'stddevSampMergeState': ('stddevSamp', 'MergeState'), 'sumCountMergeState': ('sumCount', 'MergeState'), 'cramersVBiasCorrectedMergeState': ('cramersVBiasCorrected', 'MergeState'), 'quantilesTDigestWeightedMergeState': ('quantilesTDigestWeighted', 'MergeState'), 'stochasticLogisticRegressionMergeState': ('stochasticLogisticRegression', 'MergeState'), 'quantilesMergeState': ('quantiles', 'MergeState'), 'deltaSumTimestampMergeState': ('deltaSumTimestamp', 'MergeState'), 'quantilesInterpolatedWeightedMergeState': ('quantilesInterpolatedWeighted', 'MergeState'), 'maxIntersectionsMergeState': ('maxIntersections', 'MergeState'), 'quantilesTDigestMergeState': ('quantilesTDigest', 'MergeState'), 'countMergeState': ('count', 'MergeState'), 'last_valueMergeState': ('last_value', 'MergeState'), 'varSampMergeState': ('varSamp', 'MergeState'), 'categoricalInformationValueMergeState': ('categoricalInformationValue', 'MergeState'), 'quantileMergeState': ('quantile', 'MergeState'), 'simpleLinearRegressionMergeState': ('simpleLinearRegression', 'MergeState'), 'sequenceCountMergeState': ('sequenceCount', 'MergeState'), 'histogramMergeState': ('histogram', 'MergeState'), 'quantilesBFloat16MergeState': ('quantilesBFloat16', 'MergeState'), 'quantilesTimingMergeState': ('quantilesTiming', 'MergeState'), 'exponentialMovingAverageMergeState': ('exponentialMovingAverage', 'MergeState'), 'kurtSampMergeState': ('kurtSamp', 'MergeState'), 'stochasticLinearRegressionMergeState': ('stochasticLinearRegression', 'MergeState'), 'stddevPopMergeState': ('stddevPop', 'MergeState'), 'quantileTimingWeightedMergeState': ('quantileTimingWeighted', 'MergeState'), 'anyMergeState': ('any', 'MergeState'), 'corrMergeState': ('corr', 'MergeState'), 'groupBitOrMergeState': ('groupBitOr', 'MergeState'), 'sparkBarMergeState': ('sparkBar', 'MergeState'), 'minMergeState': ('min', 'MergeState'), 'avgWeightedMergeState': ('avgWeighted', 'MergeState'), 'rankCorrMergeState': ('rankCorr', 'MergeState'), 'skewPopMergeState': ('skewPop', 'MergeState'), 'largestTriangleThreeBucketsMergeState': ('largestTriangleThreeBuckets', 'MergeState'), 'quantileExactLowMergeState': ('quantileExactLow', 'MergeState'), 'quantileDeterministicMergeState': ('quantileDeterministic', 'MergeState'), 'argMaxMergeState': ('argMax', 'MergeState'), 'welchTTestMergeState': ('welchTTest', 'MergeState'), 'uniqHLL12MergeState': ('uniqHLL12', 'MergeState'), 'groupArrayMovingAvgMergeState': ('groupArrayMovingAvg', 'MergeState'), 'first_valueMergeState': ('first_value', 'MergeState'), 'groupArrayInsertAtMergeState': ('groupArrayInsertAt', 'MergeState'), 'maxMapMergeState': ('maxMap', 'MergeState'), 'quantileExactHighMergeState': ('quantileExactHigh', 'MergeState'), 'uniqCombinedMergeState': ('uniqCombined', 'MergeState'), 'groupBitmapXorMergeState': ('groupBitmapXor', 'MergeState'), 'groupUniqArrayMergeState': ('groupUniqArray', 'MergeState'), 'topKMergeState': ('topK', 'MergeState'), 'argMinMergeState': ('argMin', 'MergeState'), 'uniqMergeState': ('uniq', 'MergeState'), 'quantileTimingMergeState': ('quantileTiming', 'MergeState'), 'maxMergeState': ('max', 'MergeState'), 'topKWeightedMergeState': ('topKWeighted', 'MergeState'), 'quantileBFloat16MergeState': ('quantileBFloat16', 'MergeState'), 'quantileTDigestMergeState': ('quantileTDigest', 'MergeState'), 'groupArrayMovingSumMergeState': ('groupArrayMovingSum', 'MergeState'), 'medianMergeState': ('median', 'MergeState'), 'intervalLengthSumMergeState': ('intervalLengthSum', 'MergeState'), 'anyHeavyForEach': ('anyHeavy', 'ForEach'), 'groupBitXorForEach': ('groupBitXor', 'ForEach'), 'quantileInterpolatedWeightedForEach': ('quantileInterpolatedWeighted', 'ForEach'), 'theilsUForEach': ('theilsU', 'ForEach'), 'groupBitmapOrForEach': ('groupBitmapOr', 'ForEach'), 'sequenceNextNodeForEach': ('sequenceNextNode', 'ForEach'), 'uniqUpToForEach': ('uniqUpTo', 'ForEach'), 'quantileExactWeightedForEach': ('quantileExactWeighted', 'ForEach'), 'cramersVForEach': ('cramersV', 'ForEach'), 'covarPopForEach': ('covarPop', 'ForEach'), 'uniqCombined64ForEach': ('uniqCombined64', 'ForEach'), 'sumKahanForEach': ('sumKahan', 'ForEach'), 'meanZTestForEach': ('meanZTest', 'ForEach'), 'sumForEach': ('sum', 'ForEach'), 'quantileTDigestWeightedForEach': ('quantileTDigestWeighted', 'ForEach'), 'retentionForEach': ('retention', 'ForEach'), 'mannWhitneyUTestForEach': ('mannWhitneyUTest', 'ForEach'), 'groupArrayForEach': ('groupArray', 'ForEach'), 'groupBitmapAndForEach': ('groupBitmapAnd', 'ForEach'), 'uniqExactForEach': ('uniqExact', 'ForEach'), 'quantilesExactForEach': ('quantilesExact', 'ForEach'), 'avgForEach': ('avg', 'ForEach'), 'sumWithOverflowForEach': ('sumWithOverflow', 'ForEach'), 'windowFunnelForEach': ('windowFunnel', 'ForEach'), 'studentTTestForEach': ('studentTTest', 'ForEach'), 'skewSampForEach': ('skewSamp', 'ForEach'), 'boundingRatioForEach': ('boundingRatio', 'ForEach'), 'groupBitAndForEach': ('groupBitAnd', 'ForEach'), 'quantilesExactHighForEach': ('quantilesExactHigh', 'ForEach'), 'covarSampForEach': ('covarSamp', 'ForEach'), 'uniqThetaForEach': ('uniqTheta', 'ForEach'), 'varPopForEach': ('varPop', 'ForEach'), 'quantileGKForEach': ('quantileGK', 'ForEach'), 'quantilesExactLowForEach': ('quantilesExactLow', 'ForEach'), 'groupArrayLastForEach': ('groupArrayLast', 'ForEach'), 'sumMapForEach': ('sumMap', 'ForEach'), 'quantilesExactWeightedForEach': ('quantilesExactWeighted', 'ForEach'), 'deltaSumForEach': ('deltaSum', 'ForEach'), 'contingencyForEach': ('contingency', 'ForEach'), 'minMapForEach': ('minMap', 'ForEach'), 'anyLastForEach': ('anyLast', 'ForEach'), 'groupBitmapForEach': ('groupBitmap', 'ForEach'), 'quantileBFloat16WeightedForEach': ('quantileBFloat16Weighted', 'ForEach'), 'entropyForEach': ('entropy', 'ForEach'), 'exponentialTimeDecayedAvgForEach': ('exponentialTimeDecayedAvg', 'ForEach'), 'quantilesTimingWeightedForEach': ('quantilesTimingWeighted', 'ForEach'), 'maxIntersectionsPositionForEach': ('maxIntersectionsPosition', 'ForEach'), 'quantilesDeterministicForEach': ('quantilesDeterministic', 'ForEach'), 'sequenceMatchForEach': ('sequenceMatch', 'ForEach'), 'quantileExactForEach': ('quantileExact', 'ForEach'), 'kurtPopForEach': ('kurtPop', 'ForEach'), 'groupArraySampleForEach': ('groupArraySample', 'ForEach'), 'quantilesGKForEach': ('quantilesGK', 'ForEach'), 'quantilesBFloat16WeightedForEach': ('quantilesBFloat16Weighted', 'ForEach'), 'kolmogorovSmirnovTestForEach': ('kolmogorovSmirnovTest', 'ForEach'), 'stddevSampForEach': ('stddevSamp', 'ForEach'), 'sumCountForEach': ('sumCount', 'ForEach'), 'cramersVBiasCorrectedForEach': ('cramersVBiasCorrected', 'ForEach'), 'quantilesTDigestWeightedForEach': ('quantilesTDigestWeighted', 'ForEach'), 'stochasticLogisticRegressionForEach': ('stochasticLogisticRegression', 'ForEach'), 'quantilesForEach': ('quantiles', 'ForEach'), 'deltaSumTimestampForEach': ('deltaSumTimestamp', 'ForEach'), 'quantilesInterpolatedWeightedForEach': ('quantilesInterpolatedWeighted', 'ForEach'), 'maxIntersectionsForEach': ('maxIntersections', 'ForEach'), 'quantilesTDigestForEach': ('quantilesTDigest', 'ForEach'), 'countForEach': ('count', 'ForEach'), 'last_valueForEach': ('last_value', 'ForEach'), 'varSampForEach': ('varSamp', 'ForEach'), 'categoricalInformationValueForEach': ('categoricalInformationValue', 'ForEach'), 'quantileForEach': ('quantile', 'ForEach'), 'simpleLinearRegressionForEach': ('simpleLinearRegression', 'ForEach'), 'sequenceCountForEach': ('sequenceCount', 'ForEach'), 'histogramForEach': ('histogram', 'ForEach'), 'quantilesBFloat16ForEach': ('quantilesBFloat16', 'ForEach'), 'quantilesTimingForEach': ('quantilesTiming', 'ForEach'), 'exponentialMovingAverageForEach': ('exponentialMovingAverage', 'ForEach'), 'kurtSampForEach': ('kurtSamp', 'ForEach'), 'stochasticLinearRegressionForEach': ('stochasticLinearRegression', 'ForEach'), 'stddevPopForEach': ('stddevPop', 'ForEach'), 'quantileTimingWeightedForEach': ('quantileTimingWeighted', 'ForEach'), 'anyForEach': ('any', 'ForEach'), 'corrForEach': ('corr', 'ForEach'), 'groupBitOrForEach': ('groupBitOr', 'ForEach'), 'sparkBarForEach': ('sparkBar', 'ForEach'), 'minForEach': ('min', 'ForEach'), 'avgWeightedForEach': ('avgWeighted', 'ForEach'), 'rankCorrForEach': ('rankCorr', 'ForEach'), 'skewPopForEach': ('skewPop', 'ForEach'), 'largestTriangleThreeBucketsForEach': ('largestTriangleThreeBuckets', 'ForEach'), 'quantileExactLowForEach': ('quantileExactLow', 'ForEach'), 'quantileDeterministicForEach': ('quantileDeterministic', 'ForEach'), 'argMaxForEach': ('argMax', 'ForEach'), 'welchTTestForEach': ('welchTTest', 'ForEach'), 'uniqHLL12ForEach': ('uniqHLL12', 'ForEach'), 'groupArrayMovingAvgForEach': ('groupArrayMovingAvg', 'ForEach'), 'first_valueForEach': ('first_value', 'ForEach'), 'groupArrayInsertAtForEach': ('groupArrayInsertAt', 'ForEach'), 'maxMapForEach': ('maxMap', 'ForEach'), 'quantileExactHighForEach': ('quantileExactHigh', 'ForEach'), 'uniqCombinedForEach': ('uniqCombined', 'ForEach'), 'groupBitmapXorForEach': ('groupBitmapXor', 'ForEach'), 'groupUniqArrayForEach': ('groupUniqArray', 'ForEach'), 'topKForEach': ('topK', 'ForEach'), 'argMinForEach': ('argMin', 'ForEach'), 'uniqForEach': ('uniq', 'ForEach'), 'quantileTimingForEach': ('quantileTiming', 'ForEach'), 'maxForEach': ('max', 'ForEach'), 'topKWeightedForEach': ('topKWeighted', 'ForEach'), 'quantileBFloat16ForEach': ('quantileBFloat16', 'ForEach'), 'quantileTDigestForEach': ('quantileTDigest', 'ForEach'), 'groupArrayMovingSumForEach': ('groupArrayMovingSum', 'ForEach'), 'medianForEach': ('median', 'ForEach'), 'intervalLengthSumForEach': ('intervalLengthSum', 'ForEach'), 'anyHeavyDistinct': ('anyHeavy', 'Distinct'), 'groupBitXorDistinct': ('groupBitXor', 'Distinct'), 'quantileInterpolatedWeightedDistinct': ('quantileInterpolatedWeighted', 'Distinct'), 'theilsUDistinct': ('theilsU', 'Distinct'), 'groupBitmapOrDistinct': ('groupBitmapOr', 'Distinct'), 'sequenceNextNodeDistinct': ('sequenceNextNode', 'Distinct'), 'uniqUpToDistinct': ('uniqUpTo', 'Distinct'), 'quantileExactWeightedDistinct': ('quantileExactWeighted', 'Distinct'), 'cramersVDistinct': ('cramersV', 'Distinct'), 'covarPopDistinct': ('covarPop', 'Distinct'), 'uniqCombined64Distinct': ('uniqCombined64', 'Distinct'), 'sumKahanDistinct': ('sumKahan', 'Distinct'), 'meanZTestDistinct': ('meanZTest', 'Distinct'), 'sumDistinct': ('sum', 'Distinct'), 'quantileTDigestWeightedDistinct': ('quantileTDigestWeighted', 'Distinct'), 'retentionDistinct': ('retention', 'Distinct'), 'mannWhitneyUTestDistinct': ('mannWhitneyUTest', 'Distinct'), 'groupArrayDistinct': ('groupArray', 'Distinct'), 'groupBitmapAndDistinct': ('groupBitmapAnd', 'Distinct'), 'uniqExactDistinct': ('uniqExact', 'Distinct'), 'quantilesExactDistinct': ('quantilesExact', 'Distinct'), 'avgDistinct': ('avg', 'Distinct'), 'sumWithOverflowDistinct': ('sumWithOverflow', 'Distinct'), 'windowFunnelDistinct': ('windowFunnel', 'Distinct'), 'studentTTestDistinct': ('studentTTest', 'Distinct'), 'skewSampDistinct': ('skewSamp', 'Distinct'), 'boundingRatioDistinct': ('boundingRatio', 'Distinct'), 'groupBitAndDistinct': ('groupBitAnd', 'Distinct'), 'quantilesExactHighDistinct': ('quantilesExactHigh', 'Distinct'), 'covarSampDistinct': ('covarSamp', 'Distinct'), 'uniqThetaDistinct': ('uniqTheta', 'Distinct'), 'varPopDistinct': ('varPop', 'Distinct'), 'quantileGKDistinct': ('quantileGK', 'Distinct'), 'quantilesExactLowDistinct': ('quantilesExactLow', 'Distinct'), 'groupArrayLastDistinct': ('groupArrayLast', 'Distinct'), 'sumMapDistinct': ('sumMap', 'Distinct'), 'quantilesExactWeightedDistinct': ('quantilesExactWeighted', 'Distinct'), 'deltaSumDistinct': ('deltaSum', 'Distinct'), 'contingencyDistinct': ('contingency', 'Distinct'), 'minMapDistinct': ('minMap', 'Distinct'), 'anyLastDistinct': ('anyLast', 'Distinct'), 'groupBitmapDistinct': ('groupBitmap', 'Distinct'), 'quantileBFloat16WeightedDistinct': ('quantileBFloat16Weighted', 'Distinct'), 'entropyDistinct': ('entropy', 'Distinct'), 'exponentialTimeDecayedAvgDistinct': ('exponentialTimeDecayedAvg', 'Distinct'), 'quantilesTimingWeightedDistinct': ('quantilesTimingWeighted', 'Distinct'), 'maxIntersectionsPositionDistinct': ('maxIntersectionsPosition', 'Distinct'), 'quantilesDeterministicDistinct': ('quantilesDeterministic', 'Distinct'), 'sequenceMatchDistinct': ('sequenceMatch', 'Distinct'), 'quantileExactDistinct': ('quantileExact', 'Distinct'), 'kurtPopDistinct': ('kurtPop', 'Distinct'), 'groupArraySampleDistinct': ('groupArraySample', 'Distinct'), 'quantilesGKDistinct': ('quantilesGK', 'Distinct'), 'quantilesBFloat16WeightedDistinct': ('quantilesBFloat16Weighted', 'Distinct'), 'kolmogorovSmirnovTestDistinct': ('kolmogorovSmirnovTest', 'Distinct'), 'stddevSampDistinct': ('stddevSamp', 'Distinct'), 'sumCountDistinct': ('sumCount', 'Distinct'), 'cramersVBiasCorrectedDistinct': ('cramersVBiasCorrected', 'Distinct'), 'quantilesTDigestWeightedDistinct': ('quantilesTDigestWeighted', 'Distinct'), 'stochasticLogisticRegressionDistinct': ('stochasticLogisticRegression', 'Distinct'), 'quantilesDistinct': ('quantiles', 'Distinct'), 'deltaSumTimestampDistinct': ('deltaSumTimestamp', 'Distinct'), 'quantilesInterpolatedWeightedDistinct': ('quantilesInterpolatedWeighted', 'Distinct'), 'maxIntersectionsDistinct': ('maxIntersections', 'Distinct'), 'quantilesTDigestDistinct': ('quantilesTDigest', 'Distinct'), 'countDistinct': ('count', 'Distinct'), 'last_valueDistinct': ('last_value', 'Distinct'), 'varSampDistinct': ('varSamp', 'Distinct'), 'categoricalInformationValueDistinct': ('categoricalInformationValue', 'Distinct'), 'quantileDistinct': ('quantile', 'Distinct'), 'simpleLinearRegressionDistinct': ('simpleLinearRegression', 'Distinct'), 'sequenceCountDistinct': ('sequenceCount', 'Distinct'), 'histogramDistinct': ('histogram', 'Distinct'), 'quantilesBFloat16Distinct': ('quantilesBFloat16', 'Distinct'), 'quantilesTimingDistinct': ('quantilesTiming', 'Distinct'), 'exponentialMovingAverageDistinct': ('exponentialMovingAverage', 'Distinct'), 'kurtSampDistinct': ('kurtSamp', 'Distinct'), 'stochasticLinearRegressionDistinct': ('stochasticLinearRegression', 'Distinct'), 'stddevPopDistinct': ('stddevPop', 'Distinct'), 'quantileTimingWeightedDistinct': ('quantileTimingWeighted', 'Distinct'), 'anyDistinct': ('any', 'Distinct'), 'corrDistinct': ('corr', 'Distinct'), 'groupBitOrDistinct': ('groupBitOr', 'Distinct'), 'sparkBarDistinct': ('sparkBar', 'Distinct'), 'minDistinct': ('min', 'Distinct'), 'avgWeightedDistinct': ('avgWeighted', 'Distinct'), 'rankCorrDistinct': ('rankCorr', 'Distinct'), 'skewPopDistinct': ('skewPop', 'Distinct'), 'largestTriangleThreeBucketsDistinct': ('largestTriangleThreeBuckets', 'Distinct'), 'quantileExactLowDistinct': ('quantileExactLow', 'Distinct'), 'quantileDeterministicDistinct': ('quantileDeterministic', 'Distinct'), 'argMaxDistinct': ('argMax', 'Distinct'), 'welchTTestDistinct': ('welchTTest', 'Distinct'), 'uniqHLL12Distinct': ('uniqHLL12', 'Distinct'), 'groupArrayMovingAvgDistinct': ('groupArrayMovingAvg', 'Distinct'), 'first_valueDistinct': ('first_value', 'Distinct'), 'groupArrayInsertAtDistinct': ('groupArrayInsertAt', 'Distinct'), 'maxMapDistinct': ('maxMap', 'Distinct'), 'quantileExactHighDistinct': ('quantileExactHigh', 'Distinct'), 'uniqCombinedDistinct': ('uniqCombined', 'Distinct'), 'groupBitmapXorDistinct': ('groupBitmapXor', 'Distinct'), 'groupUniqArrayDistinct': ('groupUniqArray', 'Distinct'), 'topKDistinct': ('topK', 'Distinct'), 'argMinDistinct': ('argMin', 'Distinct'), 'uniqDistinct': ('uniq', 'Distinct'), 'quantileTimingDistinct': ('quantileTiming', 'Distinct'), 'maxDistinct': ('max', 'Distinct'), 'topKWeightedDistinct': ('topKWeighted', 'Distinct'), 'quantileBFloat16Distinct': ('quantileBFloat16', 'Distinct'), 'quantileTDigestDistinct': ('quantileTDigest', 'Distinct'), 'groupArrayMovingSumDistinct': ('groupArrayMovingSum', 'Distinct'), 'medianDistinct': ('median', 'Distinct'), 'intervalLengthSumDistinct': ('intervalLengthSum', 'Distinct'), 'anyHeavyOrDefault': ('anyHeavy', 'OrDefault'), 'groupBitXorOrDefault': ('groupBitXor', 'OrDefault'), 'quantileInterpolatedWeightedOrDefault': ('quantileInterpolatedWeighted', 'OrDefault'), 'theilsUOrDefault': ('theilsU', 'OrDefault'), 'groupBitmapOrOrDefault': ('groupBitmapOr', 'OrDefault'), 'sequenceNextNodeOrDefault': ('sequenceNextNode', 'OrDefault'), 'uniqUpToOrDefault': ('uniqUpTo', 'OrDefault'), 'quantileExactWeightedOrDefault': ('quantileExactWeighted', 'OrDefault'), 'cramersVOrDefault': ('cramersV', 'OrDefault'), 'covarPopOrDefault': ('covarPop', 'OrDefault'), 'uniqCombined64OrDefault': ('uniqCombined64', 'OrDefault'), 'sumKahanOrDefault': ('sumKahan', 'OrDefault'), 'meanZTestOrDefault': ('meanZTest', 'OrDefault'), 'sumOrDefault': ('sum', 'OrDefault'), 'quantileTDigestWeightedOrDefault': ('quantileTDigestWeighted', 'OrDefault'), 'retentionOrDefault': ('retention', 'OrDefault'), 'mannWhitneyUTestOrDefault': ('mannWhitneyUTest', 'OrDefault'), 'groupArrayOrDefault': ('groupArray', 'OrDefault'), 'groupBitmapAndOrDefault': ('groupBitmapAnd', 'OrDefault'), 'uniqExactOrDefault': ('uniqExact', 'OrDefault'), 'quantilesExactOrDefault': ('quantilesExact', 'OrDefault'), 'avgOrDefault': ('avg', 'OrDefault'), 'sumWithOverflowOrDefault': ('sumWithOverflow', 'OrDefault'), 'windowFunnelOrDefault': ('windowFunnel', 'OrDefault'), 'studentTTestOrDefault': ('studentTTest', 'OrDefault'), 'skewSampOrDefault': ('skewSamp', 'OrDefault'), 'boundingRatioOrDefault': ('boundingRatio', 'OrDefault'), 'groupBitAndOrDefault': ('groupBitAnd', 'OrDefault'), 'quantilesExactHighOrDefault': ('quantilesExactHigh', 'OrDefault'), 'covarSampOrDefault': ('covarSamp', 'OrDefault'), 'uniqThetaOrDefault': ('uniqTheta', 'OrDefault'), 'varPopOrDefault': ('varPop', 'OrDefault'), 'quantileGKOrDefault': ('quantileGK', 'OrDefault'), 'quantilesExactLowOrDefault': ('quantilesExactLow', 'OrDefault'), 'groupArrayLastOrDefault': ('groupArrayLast', 'OrDefault'), 'sumMapOrDefault': ('sumMap', 'OrDefault'), 'quantilesExactWeightedOrDefault': ('quantilesExactWeighted', 'OrDefault'), 'deltaSumOrDefault': ('deltaSum', 'OrDefault'), 'contingencyOrDefault': ('contingency', 'OrDefault'), 'minMapOrDefault': ('minMap', 'OrDefault'), 'anyLastOrDefault': ('anyLast', 'OrDefault'), 'groupBitmapOrDefault': ('groupBitmap', 'OrDefault'), 'quantileBFloat16WeightedOrDefault': ('quantileBFloat16Weighted', 'OrDefault'), 'entropyOrDefault': ('entropy', 'OrDefault'), 'exponentialTimeDecayedAvgOrDefault': ('exponentialTimeDecayedAvg', 'OrDefault'), 'quantilesTimingWeightedOrDefault': ('quantilesTimingWeighted', 'OrDefault'), 'maxIntersectionsPositionOrDefault': ('maxIntersectionsPosition', 'OrDefault'), 'quantilesDeterministicOrDefault': ('quantilesDeterministic', 'OrDefault'), 'sequenceMatchOrDefault': ('sequenceMatch', 'OrDefault'), 'quantileExactOrDefault': ('quantileExact', 'OrDefault'), 'kurtPopOrDefault': ('kurtPop', 'OrDefault'), 'groupArraySampleOrDefault': ('groupArraySample', 'OrDefault'), 'quantilesGKOrDefault': ('quantilesGK', 'OrDefault'), 'quantilesBFloat16WeightedOrDefault': ('quantilesBFloat16Weighted', 'OrDefault'), 'kolmogorovSmirnovTestOrDefault': ('kolmogorovSmirnovTest', 'OrDefault'), 'stddevSampOrDefault': ('stddevSamp', 'OrDefault'), 'sumCountOrDefault': ('sumCount', 'OrDefault'), 'cramersVBiasCorrectedOrDefault': ('cramersVBiasCorrected', 'OrDefault'), 'quantilesTDigestWeightedOrDefault': ('quantilesTDigestWeighted', 'OrDefault'), 'stochasticLogisticRegressionOrDefault': ('stochasticLogisticRegression', 'OrDefault'), 'quantilesOrDefault': ('quantiles', 'OrDefault'), 'deltaSumTimestampOrDefault': ('deltaSumTimestamp', 'OrDefault'), 'quantilesInterpolatedWeightedOrDefault': ('quantilesInterpolatedWeighted', 'OrDefault'), 'maxIntersectionsOrDefault': ('maxIntersections', 'OrDefault'), 'quantilesTDigestOrDefault': ('quantilesTDigest', 'OrDefault'), 'countOrDefault': ('count', 'OrDefault'), 'last_valueOrDefault': ('last_value', 'OrDefault'), 'varSampOrDefault': ('varSamp', 'OrDefault'), 'categoricalInformationValueOrDefault': ('categoricalInformationValue', 'OrDefault'), 'quantileOrDefault': ('quantile', 'OrDefault'), 'simpleLinearRegressionOrDefault': ('simpleLinearRegression', 'OrDefault'), 'sequenceCountOrDefault': ('sequenceCount', 'OrDefault'), 'histogramOrDefault': ('histogram', 'OrDefault'), 'quantilesBFloat16OrDefault': ('quantilesBFloat16', 'OrDefault'), 'quantilesTimingOrDefault': ('quantilesTiming', 'OrDefault'), 'exponentialMovingAverageOrDefault': ('exponentialMovingAverage', 'OrDefault'), 'kurtSampOrDefault': ('kurtSamp', 'OrDefault'), 'stochasticLinearRegressionOrDefault': ('stochasticLinearRegression', 'OrDefault'), 'stddevPopOrDefault': ('stddevPop', 'OrDefault'), 'quantileTimingWeightedOrDefault': ('quantileTimingWeighted', 'OrDefault'), 'anyOrDefault': ('any', 'OrDefault'), 'corrOrDefault': ('corr', 'OrDefault'), 'groupBitOrOrDefault': ('groupBitOr', 'OrDefault'), 'sparkBarOrDefault': ('sparkBar', 'OrDefault'), 'minOrDefault': ('min', 'OrDefault'), 'avgWeightedOrDefault': ('avgWeighted', 'OrDefault'), 'rankCorrOrDefault': ('rankCorr', 'OrDefault'), 'skewPopOrDefault': ('skewPop', 'OrDefault'), 'largestTriangleThreeBucketsOrDefault': ('largestTriangleThreeBuckets', 'OrDefault'), 'quantileExactLowOrDefault': ('quantileExactLow', 'OrDefault'), 'quantileDeterministicOrDefault': ('quantileDeterministic', 'OrDefault'), 'argMaxOrDefault': ('argMax', 'OrDefault'), 'welchTTestOrDefault': ('welchTTest', 'OrDefault'), 'uniqHLL12OrDefault': ('uniqHLL12', 'OrDefault'), 'groupArrayMovingAvgOrDefault': ('groupArrayMovingAvg', 'OrDefault'), 'first_valueOrDefault': ('first_value', 'OrDefault'), 'groupArrayInsertAtOrDefault': ('groupArrayInsertAt', 'OrDefault'), 'maxMapOrDefault': ('maxMap', 'OrDefault'), 'quantileExactHighOrDefault': ('quantileExactHigh', 'OrDefault'), 'uniqCombinedOrDefault': ('uniqCombined', 'OrDefault'), 'groupBitmapXorOrDefault': ('groupBitmapXor', 'OrDefault'), 'groupUniqArrayOrDefault': ('groupUniqArray', 'OrDefault'), 'topKOrDefault': ('topK', 'OrDefault'), 'argMinOrDefault': ('argMin', 'OrDefault'), 'uniqOrDefault': ('uniq', 'OrDefault'), 'quantileTimingOrDefault': ('quantileTiming', 'OrDefault'), 'maxOrDefault': ('max', 'OrDefault'), 'topKWeightedOrDefault': ('topKWeighted', 'OrDefault'), 'quantileBFloat16OrDefault': ('quantileBFloat16', 'OrDefault'), 'quantileTDigestOrDefault': ('quantileTDigest', 'OrDefault'), 'groupArrayMovingSumOrDefault': ('groupArrayMovingSum', 'OrDefault'), 'medianOrDefault': ('median', 'OrDefault'), 'intervalLengthSumOrDefault': ('intervalLengthSum', 'OrDefault'), 'anyHeavyOrNull': ('anyHeavy', 'OrNull'), 'groupBitXorOrNull': ('groupBitXor', 'OrNull'), 'quantileInterpolatedWeightedOrNull': ('quantileInterpolatedWeighted', 'OrNull'), 'theilsUOrNull': ('theilsU', 'OrNull'), 'groupBitmapOrOrNull': ('groupBitmapOr', 'OrNull'), 'sequenceNextNodeOrNull': ('sequenceNextNode', 'OrNull'), 'uniqUpToOrNull': ('uniqUpTo', 'OrNull'), 'quantileExactWeightedOrNull': ('quantileExactWeighted', 'OrNull'), 'cramersVOrNull': ('cramersV', 'OrNull'), 'covarPopOrNull': ('covarPop', 'OrNull'), 'uniqCombined64OrNull': ('uniqCombined64', 'OrNull'), 'sumKahanOrNull': ('sumKahan', 'OrNull'), 'meanZTestOrNull': ('meanZTest', 'OrNull'), 'sumOrNull': ('sum', 'OrNull'), 'quantileTDigestWeightedOrNull': ('quantileTDigestWeighted', 'OrNull'), 'retentionOrNull': ('retention', 'OrNull'), 'mannWhitneyUTestOrNull': ('mannWhitneyUTest', 'OrNull'), 'groupArrayOrNull': ('groupArray', 'OrNull'), 'groupBitmapAndOrNull': ('groupBitmapAnd', 'OrNull'), 'uniqExactOrNull': ('uniqExact', 'OrNull'), 'quantilesExactOrNull': ('quantilesExact', 'OrNull'), 'avgOrNull': ('avg', 'OrNull'), 'sumWithOverflowOrNull': ('sumWithOverflow', 'OrNull'), 'windowFunnelOrNull': ('windowFunnel', 'OrNull'), 'studentTTestOrNull': ('studentTTest', 'OrNull'), 'skewSampOrNull': ('skewSamp', 'OrNull'), 'boundingRatioOrNull': ('boundingRatio', 'OrNull'), 'groupBitAndOrNull': ('groupBitAnd', 'OrNull'), 'quantilesExactHighOrNull': ('quantilesExactHigh', 'OrNull'), 'covarSampOrNull': ('covarSamp', 'OrNull'), 'uniqThetaOrNull': ('uniqTheta', 'OrNull'), 'varPopOrNull': ('varPop', 'OrNull'), 'quantileGKOrNull': ('quantileGK', 'OrNull'), 'quantilesExactLowOrNull': ('quantilesExactLow', 'OrNull'), 'groupArrayLastOrNull': ('groupArrayLast', 'OrNull'), 'sumMapOrNull': ('sumMap', 'OrNull'), 'quantilesExactWeightedOrNull': ('quantilesExactWeighted', 'OrNull'), 'deltaSumOrNull': ('deltaSum', 'OrNull'), 'contingencyOrNull': ('contingency', 'OrNull'), 'minMapOrNull': ('minMap', 'OrNull'), 'anyLastOrNull': ('anyLast', 'OrNull'), 'groupBitmapOrNull': ('groupBitmap', 'OrNull'), 'quantileBFloat16WeightedOrNull': ('quantileBFloat16Weighted', 'OrNull'), 'entropyOrNull': ('entropy', 'OrNull'), 'exponentialTimeDecayedAvgOrNull': ('exponentialTimeDecayedAvg', 'OrNull'), 'quantilesTimingWeightedOrNull': ('quantilesTimingWeighted', 'OrNull'), 'maxIntersectionsPositionOrNull': ('maxIntersectionsPosition', 'OrNull'), 'quantilesDeterministicOrNull': ('quantilesDeterministic', 'OrNull'), 'sequenceMatchOrNull': ('sequenceMatch', 'OrNull'), 'quantileExactOrNull': ('quantileExact', 'OrNull'), 'kurtPopOrNull': ('kurtPop', 'OrNull'), 'groupArraySampleOrNull': ('groupArraySample', 'OrNull'), 'quantilesGKOrNull': ('quantilesGK', 'OrNull'), 'quantilesBFloat16WeightedOrNull': ('quantilesBFloat16Weighted', 'OrNull'), 'kolmogorovSmirnovTestOrNull': ('kolmogorovSmirnovTest', 'OrNull'), 'stddevSampOrNull': ('stddevSamp', 'OrNull'), 'sumCountOrNull': ('sumCount', 'OrNull'), 'cramersVBiasCorrectedOrNull': ('cramersVBiasCorrected', 'OrNull'), 'quantilesTDigestWeightedOrNull': ('quantilesTDigestWeighted', 'OrNull'), 'stochasticLogisticRegressionOrNull': ('stochasticLogisticRegression', 'OrNull'), 'quantilesOrNull': ('quantiles', 'OrNull'), 'deltaSumTimestampOrNull': ('deltaSumTimestamp', 'OrNull'), 'quantilesInterpolatedWeightedOrNull': ('quantilesInterpolatedWeighted', 'OrNull'), 'maxIntersectionsOrNull': ('maxIntersections', 'OrNull'), 'quantilesTDigestOrNull': ('quantilesTDigest', 'OrNull'), 'countOrNull': ('count', 'OrNull'), 'last_valueOrNull': ('last_value', 'OrNull'), 'varSampOrNull': ('varSamp', 'OrNull'), 'categoricalInformationValueOrNull': ('categoricalInformationValue', 'OrNull'), 'quantileOrNull': ('quantile', 'OrNull'), 'simpleLinearRegressionOrNull': ('simpleLinearRegression', 'OrNull'), 'sequenceCountOrNull': ('sequenceCount', 'OrNull'), 'histogramOrNull': ('histogram', 'OrNull'), 'quantilesBFloat16OrNull': ('quantilesBFloat16', 'OrNull'), 'quantilesTimingOrNull': ('quantilesTiming', 'OrNull'), 'exponentialMovingAverageOrNull': ('exponentialMovingAverage', 'OrNull'), 'kurtSampOrNull': ('kurtSamp', 'OrNull'), 'stochasticLinearRegressionOrNull': ('stochasticLinearRegression', 'OrNull'), 'stddevPopOrNull': ('stddevPop', 'OrNull'), 'quantileTimingWeightedOrNull': ('quantileTimingWeighted', 'OrNull'), 'anyOrNull': ('any', 'OrNull'), 'corrOrNull': ('corr', 'OrNull'), 'groupBitOrOrNull': ('groupBitOr', 'OrNull'), 'sparkBarOrNull': ('sparkBar', 'OrNull'), 'minOrNull': ('min', 'OrNull'), 'avgWeightedOrNull': ('avgWeighted', 'OrNull'), 'rankCorrOrNull': ('rankCorr', 'OrNull'), 'skewPopOrNull': ('skewPop', 'OrNull'), 'largestTriangleThreeBucketsOrNull': ('largestTriangleThreeBuckets', 'OrNull'), 'quantileExactLowOrNull': ('quantileExactLow', 'OrNull'), 'quantileDeterministicOrNull': ('quantileDeterministic', 'OrNull'), 'argMaxOrNull': ('argMax', 'OrNull'), 'welchTTestOrNull': ('welchTTest', 'OrNull'), 'uniqHLL12OrNull': ('uniqHLL12', 'OrNull'), 'groupArrayMovingAvgOrNull': ('groupArrayMovingAvg', 'OrNull'), 'first_valueOrNull': ('first_value', 'OrNull'), 'groupArrayInsertAtOrNull': ('groupArrayInsertAt', 'OrNull'), 'maxMapOrNull': ('maxMap', 'OrNull'), 'quantileExactHighOrNull': ('quantileExactHigh', 'OrNull'), 'uniqCombinedOrNull': ('uniqCombined', 'OrNull'), 'groupBitmapXorOrNull': ('groupBitmapXor', 'OrNull'), 'groupUniqArrayOrNull': ('groupUniqArray', 'OrNull'), 'topKOrNull': ('topK', 'OrNull'), 'argMinOrNull': ('argMin', 'OrNull'), 'uniqOrNull': ('uniq', 'OrNull'), 'quantileTimingOrNull': ('quantileTiming', 'OrNull'), 'maxOrNull': ('max', 'OrNull'), 'topKWeightedOrNull': ('topKWeighted', 'OrNull'), 'quantileBFloat16OrNull': ('quantileBFloat16', 'OrNull'), 'quantileTDigestOrNull': ('quantileTDigest', 'OrNull'), 'groupArrayMovingSumOrNull': ('groupArrayMovingSum', 'OrNull'), 'medianOrNull': ('median', 'OrNull'), 'intervalLengthSumOrNull': ('intervalLengthSum', 'OrNull'), 'anyHeavyResample': ('anyHeavy', 'Resample'), 'groupBitXorResample': ('groupBitXor', 'Resample'), 'quantileInterpolatedWeightedResample': ('quantileInterpolatedWeighted', 'Resample'), 'theilsUResample': ('theilsU', 'Resample'), 'groupBitmapOrResample': ('groupBitmapOr', 'Resample'), 'sequenceNextNodeResample': ('sequenceNextNode', 'Resample'), 'uniqUpToResample': ('uniqUpTo', 'Resample'), 'quantileExactWeightedResample': ('quantileExactWeighted', 'Resample'), 'cramersVResample': ('cramersV', 'Resample'), 'covarPopResample': ('covarPop', 'Resample'), 'uniqCombined64Resample': ('uniqCombined64', 'Resample'), 'sumKahanResample': ('sumKahan', 'Resample'), 'meanZTestResample': ('meanZTest', 'Resample'), 'sumResample': ('sum', 'Resample'), 'quantileTDigestWeightedResample': ('quantileTDigestWeighted', 'Resample'), 'retentionResample': ('retention', 'Resample'), 'mannWhitneyUTestResample': ('mannWhitneyUTest', 'Resample'), 'groupArrayResample': ('groupArray', 'Resample'), 'groupBitmapAndResample': ('groupBitmapAnd', 'Resample'), 'uniqExactResample': ('uniqExact', 'Resample'), 'quantilesExactResample': ('quantilesExact', 'Resample'), 'avgResample': ('avg', 'Resample'), 'sumWithOverflowResample': ('sumWithOverflow', 'Resample'), 'windowFunnelResample': ('windowFunnel', 'Resample'), 'studentTTestResample': ('studentTTest', 'Resample'), 'skewSampResample': ('skewSamp', 'Resample'), 'boundingRatioResample': ('boundingRatio', 'Resample'), 'groupBitAndResample': ('groupBitAnd', 'Resample'), 'quantilesExactHighResample': ('quantilesExactHigh', 'Resample'), 'covarSampResample': ('covarSamp', 'Resample'), 'uniqThetaResample': ('uniqTheta', 'Resample'), 'varPopResample': ('varPop', 'Resample'), 'quantileGKResample': ('quantileGK', 'Resample'), 'quantilesExactLowResample': ('quantilesExactLow', 'Resample'), 'groupArrayLastResample': ('groupArrayLast', 'Resample'), 'sumMapResample': ('sumMap', 'Resample'), 'quantilesExactWeightedResample': ('quantilesExactWeighted', 'Resample'), 'deltaSumResample': ('deltaSum', 'Resample'), 'contingencyResample': ('contingency', 'Resample'), 'minMapResample': ('minMap', 'Resample'), 'anyLastResample': ('anyLast', 'Resample'), 'groupBitmapResample': ('groupBitmap', 'Resample'), 'quantileBFloat16WeightedResample': ('quantileBFloat16Weighted', 'Resample'), 'entropyResample': ('entropy', 'Resample'), 'exponentialTimeDecayedAvgResample': ('exponentialTimeDecayedAvg', 'Resample'), 'quantilesTimingWeightedResample': ('quantilesTimingWeighted', 'Resample'), 'maxIntersectionsPositionResample': ('maxIntersectionsPosition', 'Resample'), 'quantilesDeterministicResample': ('quantilesDeterministic', 'Resample'), 'sequenceMatchResample': ('sequenceMatch', 'Resample'), 'quantileExactResample': ('quantileExact', 'Resample'), 'kurtPopResample': ('kurtPop', 'Resample'), 'groupArraySampleResample': ('groupArraySample', 'Resample'), 'quantilesGKResample': ('quantilesGK', 'Resample'), 'quantilesBFloat16WeightedResample': ('quantilesBFloat16Weighted', 'Resample'), 'kolmogorovSmirnovTestResample': ('kolmogorovSmirnovTest', 'Resample'), 'stddevSampResample': ('stddevSamp', 'Resample'), 'sumCountResample': ('sumCount', 'Resample'), 'cramersVBiasCorrectedResample': ('cramersVBiasCorrected', 'Resample'), 'quantilesTDigestWeightedResample': ('quantilesTDigestWeighted', 'Resample'), 'stochasticLogisticRegressionResample': ('stochasticLogisticRegression', 'Resample'), 'quantilesResample': ('quantiles', 'Resample'), 'deltaSumTimestampResample': ('deltaSumTimestamp', 'Resample'), 'quantilesInterpolatedWeightedResample': ('quantilesInterpolatedWeighted', 'Resample'), 'maxIntersectionsResample': ('maxIntersections', 'Resample'), 'quantilesTDigestResample': ('quantilesTDigest', 'Resample'), 'countResample': ('count', 'Resample'), 'last_valueResample': ('last_value', 'Resample'), 'varSampResample': ('varSamp', 'Resample'), 'categoricalInformationValueResample': ('categoricalInformationValue', 'Resample'), 'quantileResample': ('quantile', 'Resample'), 'simpleLinearRegressionResample': ('simpleLinearRegression', 'Resample'), 'sequenceCountResample': ('sequenceCount', 'Resample'), 'histogramResample': ('histogram', 'Resample'), 'quantilesBFloat16Resample': ('quantilesBFloat16', 'Resample'), 'quantilesTimingResample': ('quantilesTiming', 'Resample'), 'exponentialMovingAverageResample': ('exponentialMovingAverage', 'Resample'), 'kurtSampResample': ('kurtSamp', 'Resample'), 'stochasticLinearRegressionResample': ('stochasticLinearRegression', 'Resample'), 'stddevPopResample': ('stddevPop', 'Resample'), 'quantileTimingWeightedResample': ('quantileTimingWeighted', 'Resample'), 'anyResample': ('any', 'Resample'), 'corrResample': ('corr', 'Resample'), 'groupBitOrResample': ('groupBitOr', 'Resample'), 'sparkBarResample': ('sparkBar', 'Resample'), 'minResample': ('min', 'Resample'), 'avgWeightedResample': ('avgWeighted', 'Resample'), 'rankCorrResample': ('rankCorr', 'Resample'), 'skewPopResample': ('skewPop', 'Resample'), 'largestTriangleThreeBucketsResample': ('largestTriangleThreeBuckets', 'Resample'), 'quantileExactLowResample': ('quantileExactLow', 'Resample'), 'quantileDeterministicResample': ('quantileDeterministic', 'Resample'), 'argMaxResample': ('argMax', 'Resample'), 'welchTTestResample': ('welchTTest', 'Resample'), 'uniqHLL12Resample': ('uniqHLL12', 'Resample'), 'groupArrayMovingAvgResample': ('groupArrayMovingAvg', 'Resample'), 'first_valueResample': ('first_value', 'Resample'), 'groupArrayInsertAtResample': ('groupArrayInsertAt', 'Resample'), 'maxMapResample': ('maxMap', 'Resample'), 'quantileExactHighResample': ('quantileExactHigh', 'Resample'), 'uniqCombinedResample': ('uniqCombined', 'Resample'), 'groupBitmapXorResample': ('groupBitmapXor', 'Resample'), 'groupUniqArrayResample': ('groupUniqArray', 'Resample'), 'topKResample': ('topK', 'Resample'), 'argMinResample': ('argMin', 'Resample'), 'uniqResample': ('uniq', 'Resample'), 'quantileTimingResample': ('quantileTiming', 'Resample'), 'maxResample': ('max', 'Resample'), 'topKWeightedResample': ('topKWeighted', 'Resample'), 'quantileBFloat16Resample': ('quantileBFloat16', 'Resample'), 'quantileTDigestResample': ('quantileTDigest', 'Resample'), 'groupArrayMovingSumResample': ('groupArrayMovingSum', 'Resample'), 'medianResample': ('median', 'Resample'), 'intervalLengthSumResample': ('intervalLengthSum', 'Resample'), 'anyHeavyArgMin': ('anyHeavy', 'ArgMin'), 'groupBitXorArgMin': ('groupBitXor', 'ArgMin'), 'quantileInterpolatedWeightedArgMin': ('quantileInterpolatedWeighted', 'ArgMin'), 'theilsUArgMin': ('theilsU', 'ArgMin'), 'groupBitmapOrArgMin': ('groupBitmapOr', 'ArgMin'), 'sequenceNextNodeArgMin': ('sequenceNextNode', 'ArgMin'), 'uniqUpToArgMin': ('uniqUpTo', 'ArgMin'), 'quantileExactWeightedArgMin': ('quantileExactWeighted', 'ArgMin'), 'cramersVArgMin': ('cramersV', 'ArgMin'), 'covarPopArgMin': ('covarPop', 'ArgMin'), 'uniqCombined64ArgMin': ('uniqCombined64', 'ArgMin'), 'sumKahanArgMin': ('sumKahan', 'ArgMin'), 'meanZTestArgMin': ('meanZTest', 'ArgMin'), 'sumArgMin': ('sum', 'ArgMin'), 'quantileTDigestWeightedArgMin': ('quantileTDigestWeighted', 'ArgMin'), 'retentionArgMin': ('retention', 'ArgMin'), 'mannWhitneyUTestArgMin': ('mannWhitneyUTest', 'ArgMin'), 'groupArrayArgMin': ('groupArray', 'ArgMin'), 'groupBitmapAndArgMin': ('groupBitmapAnd', 'ArgMin'), 'uniqExactArgMin': ('uniqExact', 'ArgMin'), 'quantilesExactArgMin': ('quantilesExact', 'ArgMin'), 'avgArgMin': ('avg', 'ArgMin'), 'sumWithOverflowArgMin': ('sumWithOverflow', 'ArgMin'), 'windowFunnelArgMin': ('windowFunnel', 'ArgMin'), 'studentTTestArgMin': ('studentTTest', 'ArgMin'), 'skewSampArgMin': ('skewSamp', 'ArgMin'), 'boundingRatioArgMin': ('boundingRatio', 'ArgMin'), 'groupBitAndArgMin': ('groupBitAnd', 'ArgMin'), 'quantilesExactHighArgMin': ('quantilesExactHigh', 'ArgMin'), 'covarSampArgMin': ('covarSamp', 'ArgMin'), 'uniqThetaArgMin': ('uniqTheta', 'ArgMin'), 'varPopArgMin': ('varPop', 'ArgMin'), 'quantileGKArgMin': ('quantileGK', 'ArgMin'), 'quantilesExactLowArgMin': ('quantilesExactLow', 'ArgMin'), 'groupArrayLastArgMin': ('groupArrayLast', 'ArgMin'), 'sumMapArgMin': ('sumMap', 'ArgMin'), 'quantilesExactWeightedArgMin': ('quantilesExactWeighted', 'ArgMin'), 'deltaSumArgMin': ('deltaSum', 'ArgMin'), 'contingencyArgMin': ('contingency', 'ArgMin'), 'minMapArgMin': ('minMap', 'ArgMin'), 'anyLastArgMin': ('anyLast', 'ArgMin'), 'groupBitmapArgMin': ('groupBitmap', 'ArgMin'), 'quantileBFloat16WeightedArgMin': ('quantileBFloat16Weighted', 'ArgMin'), 'entropyArgMin': ('entropy', 'ArgMin'), 'exponentialTimeDecayedAvgArgMin': ('exponentialTimeDecayedAvg', 'ArgMin'), 'quantilesTimingWeightedArgMin': ('quantilesTimingWeighted', 'ArgMin'), 'maxIntersectionsPositionArgMin': ('maxIntersectionsPosition', 'ArgMin'), 'quantilesDeterministicArgMin': ('quantilesDeterministic', 'ArgMin'), 'sequenceMatchArgMin': ('sequenceMatch', 'ArgMin'), 'quantileExactArgMin': ('quantileExact', 'ArgMin'), 'kurtPopArgMin': ('kurtPop', 'ArgMin'), 'groupArraySampleArgMin': ('groupArraySample', 'ArgMin'), 'quantilesGKArgMin': ('quantilesGK', 'ArgMin'), 'quantilesBFloat16WeightedArgMin': ('quantilesBFloat16Weighted', 'ArgMin'), 'kolmogorovSmirnovTestArgMin': ('kolmogorovSmirnovTest', 'ArgMin'), 'stddevSampArgMin': ('stddevSamp', 'ArgMin'), 'sumCountArgMin': ('sumCount', 'ArgMin'), 'cramersVBiasCorrectedArgMin': ('cramersVBiasCorrected', 'ArgMin'), 'quantilesTDigestWeightedArgMin': ('quantilesTDigestWeighted', 'ArgMin'), 'stochasticLogisticRegressionArgMin': ('stochasticLogisticRegression', 'ArgMin'), 'quantilesArgMin': ('quantiles', 'ArgMin'), 'deltaSumTimestampArgMin': ('deltaSumTimestamp', 'ArgMin'), 'quantilesInterpolatedWeightedArgMin': ('quantilesInterpolatedWeighted', 'ArgMin'), 'maxIntersectionsArgMin': ('maxIntersections', 'ArgMin'), 'quantilesTDigestArgMin': ('quantilesTDigest', 'ArgMin'), 'countArgMin': ('count', 'ArgMin'), 'last_valueArgMin': ('last_value', 'ArgMin'), 'varSampArgMin': ('varSamp', 'ArgMin'), 'categoricalInformationValueArgMin': ('categoricalInformationValue', 'ArgMin'), 'quantileArgMin': ('quantile', 'ArgMin'), 'simpleLinearRegressionArgMin': ('simpleLinearRegression', 'ArgMin'), 'sequenceCountArgMin': ('sequenceCount', 'ArgMin'), 'histogramArgMin': ('histogram', 'ArgMin'), 'quantilesBFloat16ArgMin': ('quantilesBFloat16', 'ArgMin'), 'quantilesTimingArgMin': ('quantilesTiming', 'ArgMin'), 'exponentialMovingAverageArgMin': ('exponentialMovingAverage', 'ArgMin'), 'kurtSampArgMin': ('kurtSamp', 'ArgMin'), 'stochasticLinearRegressionArgMin': ('stochasticLinearRegression', 'ArgMin'), 'stddevPopArgMin': ('stddevPop', 'ArgMin'), 'quantileTimingWeightedArgMin': ('quantileTimingWeighted', 'ArgMin'), 'anyArgMin': ('any', 'ArgMin'), 'corrArgMin': ('corr', 'ArgMin'), 'groupBitOrArgMin': ('groupBitOr', 'ArgMin'), 'sparkBarArgMin': ('sparkBar', 'ArgMin'), 'minArgMin': ('min', 'ArgMin'), 'avgWeightedArgMin': ('avgWeighted', 'ArgMin'), 'rankCorrArgMin': ('rankCorr', 'ArgMin'), 'skewPopArgMin': ('skewPop', 'ArgMin'), 'largestTriangleThreeBucketsArgMin': ('largestTriangleThreeBuckets', 'ArgMin'), 'quantileExactLowArgMin': ('quantileExactLow', 'ArgMin'), 'quantileDeterministicArgMin': ('quantileDeterministic', 'ArgMin'), 'argMaxArgMin': ('argMax', 'ArgMin'), 'welchTTestArgMin': ('welchTTest', 'ArgMin'), 'uniqHLL12ArgMin': ('uniqHLL12', 'ArgMin'), 'groupArrayMovingAvgArgMin': ('groupArrayMovingAvg', 'ArgMin'), 'first_valueArgMin': ('first_value', 'ArgMin'), 'groupArrayInsertAtArgMin': ('groupArrayInsertAt', 'ArgMin'), 'maxMapArgMin': ('maxMap', 'ArgMin'), 'quantileExactHighArgMin': ('quantileExactHigh', 'ArgMin'), 'uniqCombinedArgMin': ('uniqCombined', 'ArgMin'), 'groupBitmapXorArgMin': ('groupBitmapXor', 'ArgMin'), 'groupUniqArrayArgMin': ('groupUniqArray', 'ArgMin'), 'topKArgMin': ('topK', 'ArgMin'), 'argMinArgMin': ('argMin', 'ArgMin'), 'uniqArgMin': ('uniq', 'ArgMin'), 'quantileTimingArgMin': ('quantileTiming', 'ArgMin'), 'maxArgMin': ('max', 'ArgMin'), 'topKWeightedArgMin': ('topKWeighted', 'ArgMin'), 'quantileBFloat16ArgMin': ('quantileBFloat16', 'ArgMin'), 'quantileTDigestArgMin': ('quantileTDigest', 'ArgMin'), 'groupArrayMovingSumArgMin': ('groupArrayMovingSum', 'ArgMin'), 'medianArgMin': ('median', 'ArgMin'), 'intervalLengthSumArgMin': ('intervalLengthSum', 'ArgMin'), 'anyHeavyArgMax': ('anyHeavy', 'ArgMax'), 'groupBitXorArgMax': ('groupBitXor', 'ArgMax'), 'quantileInterpolatedWeightedArgMax': ('quantileInterpolatedWeighted', 'ArgMax'), 'theilsUArgMax': ('theilsU', 'ArgMax'), 'groupBitmapOrArgMax': ('groupBitmapOr', 'ArgMax'), 'sequenceNextNodeArgMax': ('sequenceNextNode', 'ArgMax'), 'uniqUpToArgMax': ('uniqUpTo', 'ArgMax'), 'quantileExactWeightedArgMax': ('quantileExactWeighted', 'ArgMax'), 'cramersVArgMax': ('cramersV', 'ArgMax'), 'covarPopArgMax': ('covarPop', 'ArgMax'), 'uniqCombined64ArgMax': ('uniqCombined64', 'ArgMax'), 'sumKahanArgMax': ('sumKahan', 'ArgMax'), 'meanZTestArgMax': ('meanZTest', 'ArgMax'), 'sumArgMax': ('sum', 'ArgMax'), 'quantileTDigestWeightedArgMax': ('quantileTDigestWeighted', 'ArgMax'), 'retentionArgMax': ('retention', 'ArgMax'), 'mannWhitneyUTestArgMax': ('mannWhitneyUTest', 'ArgMax'), 'groupArrayArgMax': ('groupArray', 'ArgMax'), 'groupBitmapAndArgMax': ('groupBitmapAnd', 'ArgMax'), 'uniqExactArgMax': ('uniqExact', 'ArgMax'), 'quantilesExactArgMax': ('quantilesExact', 'ArgMax'), 'avgArgMax': ('avg', 'ArgMax'), 'sumWithOverflowArgMax': ('sumWithOverflow', 'ArgMax'), 'windowFunnelArgMax': ('windowFunnel', 'ArgMax'), 'studentTTestArgMax': ('studentTTest', 'ArgMax'), 'skewSampArgMax': ('skewSamp', 'ArgMax'), 'boundingRatioArgMax': ('boundingRatio', 'ArgMax'), 'groupBitAndArgMax': ('groupBitAnd', 'ArgMax'), 'quantilesExactHighArgMax': ('quantilesExactHigh', 'ArgMax'), 'covarSampArgMax': ('covarSamp', 'ArgMax'), 'uniqThetaArgMax': ('uniqTheta', 'ArgMax'), 'varPopArgMax': ('varPop', 'ArgMax'), 'quantileGKArgMax': ('quantileGK', 'ArgMax'), 'quantilesExactLowArgMax': ('quantilesExactLow', 'ArgMax'), 'groupArrayLastArgMax': ('groupArrayLast', 'ArgMax'), 'sumMapArgMax': ('sumMap', 'ArgMax'), 'quantilesExactWeightedArgMax': ('quantilesExactWeighted', 'ArgMax'), 'deltaSumArgMax': ('deltaSum', 'ArgMax'), 'contingencyArgMax': ('contingency', 'ArgMax'), 'minMapArgMax': ('minMap', 'ArgMax'), 'anyLastArgMax': ('anyLast', 'ArgMax'), 'groupBitmapArgMax': ('groupBitmap', 'ArgMax'), 'quantileBFloat16WeightedArgMax': ('quantileBFloat16Weighted', 'ArgMax'), 'entropyArgMax': ('entropy', 'ArgMax'), 'exponentialTimeDecayedAvgArgMax': ('exponentialTimeDecayedAvg', 'ArgMax'), 'quantilesTimingWeightedArgMax': ('quantilesTimingWeighted', 'ArgMax'), 'maxIntersectionsPositionArgMax': ('maxIntersectionsPosition', 'ArgMax'), 'quantilesDeterministicArgMax': ('quantilesDeterministic', 'ArgMax'), 'sequenceMatchArgMax': ('sequenceMatch', 'ArgMax'), 'quantileExactArgMax': ('quantileExact', 'ArgMax'), 'kurtPopArgMax': ('kurtPop', 'ArgMax'), 'groupArraySampleArgMax': ('groupArraySample', 'ArgMax'), 'quantilesGKArgMax': ('quantilesGK', 'ArgMax'), 'quantilesBFloat16WeightedArgMax': ('quantilesBFloat16Weighted', 'ArgMax'), 'kolmogorovSmirnovTestArgMax': ('kolmogorovSmirnovTest', 'ArgMax'), 'stddevSampArgMax': ('stddevSamp', 'ArgMax'), 'sumCountArgMax': ('sumCount', 'ArgMax'), 'cramersVBiasCorrectedArgMax': ('cramersVBiasCorrected', 'ArgMax'), 'quantilesTDigestWeightedArgMax': ('quantilesTDigestWeighted', 'ArgMax'), 'stochasticLogisticRegressionArgMax': ('stochasticLogisticRegression', 'ArgMax'), 'quantilesArgMax': ('quantiles', 'ArgMax'), 'deltaSumTimestampArgMax': ('deltaSumTimestamp', 'ArgMax'), 'quantilesInterpolatedWeightedArgMax': ('quantilesInterpolatedWeighted', 'ArgMax'), 'maxIntersectionsArgMax': ('maxIntersections', 'ArgMax'), 'quantilesTDigestArgMax': ('quantilesTDigest', 'ArgMax'), 'countArgMax': ('count', 'ArgMax'), 'last_valueArgMax': ('last_value', 'ArgMax'), 'varSampArgMax': ('varSamp', 'ArgMax'), 'categoricalInformationValueArgMax': ('categoricalInformationValue', 'ArgMax'), 'quantileArgMax': ('quantile', 'ArgMax'), 'simpleLinearRegressionArgMax': ('simpleLinearRegression', 'ArgMax'), 'sequenceCountArgMax': ('sequenceCount', 'ArgMax'), 'histogramArgMax': ('histogram', 'ArgMax'), 'quantilesBFloat16ArgMax': ('quantilesBFloat16', 'ArgMax'), 'quantilesTimingArgMax': ('quantilesTiming', 'ArgMax'), 'exponentialMovingAverageArgMax': ('exponentialMovingAverage', 'ArgMax'), 'kurtSampArgMax': ('kurtSamp', 'ArgMax'), 'stochasticLinearRegressionArgMax': ('stochasticLinearRegression', 'ArgMax'), 'stddevPopArgMax': ('stddevPop', 'ArgMax'), 'quantileTimingWeightedArgMax': ('quantileTimingWeighted', 'ArgMax'), 'anyArgMax': ('any', 'ArgMax'), 'corrArgMax': ('corr', 'ArgMax'), 'groupBitOrArgMax': ('groupBitOr', 'ArgMax'), 'sparkBarArgMax': ('sparkBar', 'ArgMax'), 'minArgMax': ('min', 'ArgMax'), 'avgWeightedArgMax': ('avgWeighted', 'ArgMax'), 'rankCorrArgMax': ('rankCorr', 'ArgMax'), 'skewPopArgMax': ('skewPop', 'ArgMax'), 'largestTriangleThreeBucketsArgMax': ('largestTriangleThreeBuckets', 'ArgMax'), 'quantileExactLowArgMax': ('quantileExactLow', 'ArgMax'), 'quantileDeterministicArgMax': ('quantileDeterministic', 'ArgMax'), 'argMaxArgMax': ('argMax', 'ArgMax'), 'welchTTestArgMax': ('welchTTest', 'ArgMax'), 'uniqHLL12ArgMax': ('uniqHLL12', 'ArgMax'), 'groupArrayMovingAvgArgMax': ('groupArrayMovingAvg', 'ArgMax'), 'first_valueArgMax': ('first_value', 'ArgMax'), 'groupArrayInsertAtArgMax': ('groupArrayInsertAt', 'ArgMax'), 'maxMapArgMax': ('maxMap', 'ArgMax'), 'quantileExactHighArgMax': ('quantileExactHigh', 'ArgMax'), 'uniqCombinedArgMax': ('uniqCombined', 'ArgMax'), 'groupBitmapXorArgMax': ('groupBitmapXor', 'ArgMax'), 'groupUniqArrayArgMax': ('groupUniqArray', 'ArgMax'), 'topKArgMax': ('topK', 'ArgMax'), 'argMinArgMax': ('argMin', 'ArgMax'), 'uniqArgMax': ('uniq', 'ArgMax'), 'quantileTimingArgMax': ('quantileTiming', 'ArgMax'), 'maxArgMax': ('max', 'ArgMax'), 'topKWeightedArgMax': ('topKWeighted', 'ArgMax'), 'quantileBFloat16ArgMax': ('quantileBFloat16', 'ArgMax'), 'quantileTDigestArgMax': ('quantileTDigest', 'ArgMax'), 'groupArrayMovingSumArgMax': ('groupArrayMovingSum', 'ArgMax'), 'medianArgMax': ('median', 'ArgMax'), 'intervalLengthSumArgMax': ('intervalLengthSum', 'ArgMax'), 'anyHeavy': ('anyHeavy', ''), 'groupBitXor': ('groupBitXor', ''), 'quantileInterpolatedWeighted': ('quantileInterpolatedWeighted', ''), 'theilsU': ('theilsU', ''), 'groupBitmapOr': ('groupBitmapOr', ''), 'sequenceNextNode': ('sequenceNextNode', ''), 'uniqUpTo': ('uniqUpTo', ''), 'quantileExactWeighted': ('quantileExactWeighted', ''), 'cramersV': ('cramersV', ''), 'covarPop': ('covarPop', ''), 'uniqCombined64': ('uniqCombined64', ''), 'sumKahan': ('sumKahan', ''), 'meanZTest': ('meanZTest', ''), 'sum': ('sum', ''), 'quantileTDigestWeighted': ('quantileTDigestWeighted', ''), 'retention': ('retention', ''), 'mannWhitneyUTest': ('mannWhitneyUTest', ''), 'groupArray': ('groupArray', ''), 'groupBitmapAnd': ('groupBitmapAnd', ''), 'uniqExact': ('uniqExact', ''), 'quantilesExact': ('quantilesExact', ''), 'avg': ('avg', ''), 'sumWithOverflow': ('sumWithOverflow', ''), 'windowFunnel': ('windowFunnel', ''), 'studentTTest': ('studentTTest', ''), 'skewSamp': ('skewSamp', ''), 'boundingRatio': ('boundingRatio', ''), 'groupBitAnd': ('groupBitAnd', ''), 'quantilesExactHigh': ('quantilesExactHigh', ''), 'covarSamp': ('covarSamp', ''), 'uniqTheta': ('uniqTheta', ''), 'varPop': ('varPop', ''), 'quantileGK': ('quantileGK', ''), 'quantilesExactLow': ('quantilesExactLow', ''), 'groupArrayLast': ('groupArrayLast', ''), 'quantilesExactWeighted': ('quantilesExactWeighted', ''), 'deltaSum': ('deltaSum', ''), 'contingency': ('contingency', ''), 'anyLast': ('anyLast', ''), 'groupBitmap': ('groupBitmap', ''), 'quantileBFloat16Weighted': ('quantileBFloat16Weighted', ''), 'entropy': ('entropy', ''), 'exponentialTimeDecayedAvg': ('exponentialTimeDecayedAvg', ''), 'quantilesTimingWeighted': ('quantilesTimingWeighted', ''), 'maxIntersectionsPosition': ('maxIntersectionsPosition', ''), 'quantilesDeterministic': ('quantilesDeterministic', ''), 'sequenceMatch': ('sequenceMatch', ''), 'quantileExact': ('quantileExact', ''), 'kurtPop': ('kurtPop', ''), 'groupArraySample': ('groupArraySample', ''), 'quantilesGK': ('quantilesGK', ''), 'quantilesBFloat16Weighted': ('quantilesBFloat16Weighted', ''), 'kolmogorovSmirnovTest': ('kolmogorovSmirnovTest', ''), 'stddevSamp': ('stddevSamp', ''), 'sumCount': ('sumCount', ''), 'cramersVBiasCorrected': ('cramersVBiasCorrected', ''), 'quantilesTDigestWeighted': ('quantilesTDigestWeighted', ''), 'stochasticLogisticRegression': ('stochasticLogisticRegression', ''), 'quantiles': ('quantiles', ''), 'deltaSumTimestamp': ('deltaSumTimestamp', ''), 'quantilesInterpolatedWeighted': ('quantilesInterpolatedWeighted', ''), 'maxIntersections': ('maxIntersections', ''), 'quantilesTDigest': ('quantilesTDigest', ''), 'count': ('count', ''), 'last_value': ('last_value', ''), 'varSamp': ('varSamp', ''), 'categoricalInformationValue': ('categoricalInformationValue', ''), 'quantile': ('quantile', ''), 'simpleLinearRegression': ('simpleLinearRegression', ''), 'sequenceCount': ('sequenceCount', ''), 'histogram': ('histogram', ''), 'quantilesBFloat16': ('quantilesBFloat16', ''), 'quantilesTiming': ('quantilesTiming', ''), 'exponentialMovingAverage': ('exponentialMovingAverage', ''), 'kurtSamp': ('kurtSamp', ''), 'stochasticLinearRegression': ('stochasticLinearRegression', ''), 'stddevPop': ('stddevPop', ''), 'quantileTimingWeighted': ('quantileTimingWeighted', ''), 'any': ('any', ''), 'corr': ('corr', ''), 'groupBitOr': ('groupBitOr', ''), 'sparkBar': ('sparkBar', ''), 'min': ('min', ''), 'avgWeighted': ('avgWeighted', ''), 'rankCorr': ('rankCorr', ''), 'skewPop': ('skewPop', ''), 'largestTriangleThreeBuckets': ('largestTriangleThreeBuckets', ''), 'quantileExactLow': ('quantileExactLow', ''), 'quantileDeterministic': ('quantileDeterministic', ''), 'argMax': ('argMax', ''), 'welchTTest': ('welchTTest', ''), 'uniqHLL12': ('uniqHLL12', ''), 'groupArrayMovingAvg': ('groupArrayMovingAvg', ''), 'first_value': ('first_value', ''), 'groupArrayInsertAt': ('groupArrayInsertAt', ''), 'quantileExactHigh': ('quantileExactHigh', ''), 'uniqCombined': ('uniqCombined', ''), 'groupBitmapXor': ('groupBitmapXor', ''), 'groupUniqArray': ('groupUniqArray', ''), 'topK': ('topK', ''), 'argMin': ('argMin', ''), 'uniq': ('uniq', ''), 'quantileTiming': ('quantileTiming', ''), 'max': ('max', ''), 'topKWeighted': ('topKWeighted', ''), 'quantileBFloat16': ('quantileBFloat16', ''), 'quantileTDigest': ('quantileTDigest', ''), 'groupArrayMovingSum': ('groupArrayMovingSum', ''), 'median': ('median', ''), 'intervalLengthSum': ('intervalLengthSum', '')}
FUNCTIONS_WITH_ALIASED_ARGS = {'TUPLE', 'STRUCT'}
FUNCTION_PARSERS = {'CAST': <function Parser.<lambda>>, 'CEIL': <function Parser.<lambda>>, 'CONVERT': <function Parser.<lambda>>, 'DECODE': <function Parser.<lambda>>, 'EXTRACT': <function Parser.<lambda>>, 'FLOOR': <function Parser.<lambda>>, 'GAP_FILL': <function Parser.<lambda>>, 'JSON_OBJECT': <function Parser.<lambda>>, 'JSON_OBJECTAGG': <function Parser.<lambda>>, 'JSON_TABLE': <function Parser.<lambda>>, 'NORMALIZE': <function Parser.<lambda>>, 'OPENJSON': <function Parser.<lambda>>, 'OVERLAY': <function Parser.<lambda>>, 'POSITION': <function Parser.<lambda>>, 'PREDICT': <function Parser.<lambda>>, 'SAFE_CAST': <function Parser.<lambda>>, 'STRING_AGG': <function Parser.<lambda>>, 'SUBSTRING': <function Parser.<lambda>>, 'TRIM': <function Parser.<lambda>>, 'TRY_CAST': <function Parser.<lambda>>, 'TRY_CONVERT': <function Parser.<lambda>>, 'XMLELEMENT': <function Parser.<lambda>>, 'XMLTABLE': <function Parser.<lambda>>, 'ARRAYJOIN': <function ClickHouse.Parser.<lambda>>, 'QUANTILE': <function ClickHouse.Parser.<lambda>>, 'MEDIAN': <function ClickHouse.Parser.<lambda>>, 'COLUMNS': <function ClickHouse.Parser.<lambda>>}
PROPERTY_PARSERS = {'ALLOWED_VALUES': <function Parser.<lambda>>, 'ALGORITHM': <function Parser.<lambda>>, 'AUTO': <function Parser.<lambda>>, 'AUTO_INCREMENT': <function Parser.<lambda>>, 'BACKUP': <function Parser.<lambda>>, 'BLOCKCOMPRESSION': <function Parser.<lambda>>, 'CHARSET': <function Parser.<lambda>>, 'CHARACTER SET': <function Parser.<lambda>>, 'CHECKSUM': <function Parser.<lambda>>, 'CLUSTER BY': <function Parser.<lambda>>, 'CLUSTERED': <function Parser.<lambda>>, 'COLLATE': <function Parser.<lambda>>, 'COMMENT': <function Parser.<lambda>>, 'CONTAINS': <function Parser.<lambda>>, 'COPY': <function Parser.<lambda>>, 'DATABLOCKSIZE': <function Parser.<lambda>>, 'DATA_DELETION': <function Parser.<lambda>>, 'DEFINER': <function Parser.<lambda>>, 'DETERMINISTIC': <function Parser.<lambda>>, 'DISTRIBUTED': <function Parser.<lambda>>, 'DUPLICATE': <function Parser.<lambda>>, 'DISTKEY': <function Parser.<lambda>>, 'DISTSTYLE': <function Parser.<lambda>>, 'EMPTY': <function Parser.<lambda>>, 'ENGINE': <function Parser.<lambda>>, 'EXECUTE': <function Parser.<lambda>>, 'EXTERNAL': <function Parser.<lambda>>, 'FALLBACK': <function Parser.<lambda>>, 'FORMAT': <function Parser.<lambda>>, 'FREESPACE': <function Parser.<lambda>>, 'GLOBAL': <function Parser.<lambda>>, 'HEAP': <function Parser.<lambda>>, 'ICEBERG': <function Parser.<lambda>>, 'IMMUTABLE': <function Parser.<lambda>>, 'INHERITS': <function Parser.<lambda>>, 'INPUT': <function Parser.<lambda>>, 'JOURNAL': <function Parser.<lambda>>, 'LANGUAGE': <function Parser.<lambda>>, 'LAYOUT': <function Parser.<lambda>>, 'LIFETIME': <function Parser.<lambda>>, 'LIKE': <function Parser.<lambda>>, 'LOCATION': <function Parser.<lambda>>, 'LOCK': <function Parser.<lambda>>, 'LOCKING': <function Parser.<lambda>>, 'LOG': <function Parser.<lambda>>, 'MATERIALIZED': <function Parser.<lambda>>, 'MERGEBLOCKRATIO': <function Parser.<lambda>>, 'MODIFIES': <function Parser.<lambda>>, 'MULTISET': <function Parser.<lambda>>, 'NO': <function Parser.<lambda>>, 'ON': <function Parser.<lambda>>, 'ORDER BY': <function Parser.<lambda>>, 'OUTPUT': <function Parser.<lambda>>, 'PARTITION': <function Parser.<lambda>>, 'PARTITION BY': <function Parser.<lambda>>, 'PARTITIONED BY': <function Parser.<lambda>>, 'PARTITIONED_BY': <function Parser.<lambda>>, 'PRIMARY KEY': <function Parser.<lambda>>, 'RANGE': <function Parser.<lambda>>, 'READS': <function Parser.<lambda>>, 'REMOTE': <function Parser.<lambda>>, 'RETURNS': <function Parser.<lambda>>, 'STRICT': <function Parser.<lambda>>, 'STREAMING': <function Parser.<lambda>>, 'ROW': <function Parser.<lambda>>, 'ROW_FORMAT': <function Parser.<lambda>>, 'SAMPLE': <function Parser.<lambda>>, 'SECURE': <function Parser.<lambda>>, 'SECURITY': <function Parser.<lambda>>, 'SET': <function Parser.<lambda>>, 'SETTINGS': <function Parser.<lambda>>, 'SHARING': <function Parser.<lambda>>, 'SORTKEY': <function Parser.<lambda>>, 'SOURCE': <function Parser.<lambda>>, 'STABLE': <function Parser.<lambda>>, 'STORED': <function Parser.<lambda>>, 'SYSTEM_VERSIONING': <function Parser.<lambda>>, 'TBLPROPERTIES': <function Parser.<lambda>>, 'TEMP': <function Parser.<lambda>>, 'TEMPORARY': <function Parser.<lambda>>, 'TO': <function Parser.<lambda>>, 'TRANSIENT': <function Parser.<lambda>>, 'TRANSFORM': <function Parser.<lambda>>, 'TTL': <function Parser.<lambda>>, 'USING': <function Parser.<lambda>>, 'UNLOGGED': <function Parser.<lambda>>, 'VOLATILE': <function Parser.<lambda>>, 'WITH': <function Parser.<lambda>>}
NO_PAREN_FUNCTION_PARSERS = {'CASE': <function Parser.<lambda>>, 'CONNECT_BY_ROOT': <function Parser.<lambda>>, 'IF': <function Parser.<lambda>>}
NO_PAREN_FUNCTIONS = {<TokenType.CURRENT_DATE: 'CURRENT_DATE'>: <class 'sqlglot.expressions.CurrentDate'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>: <class 'sqlglot.expressions.CurrentDate'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>: <class 'sqlglot.expressions.CurrentTime'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>: <class 'sqlglot.expressions.CurrentUser'>}
RANGE_PARSERS = {<TokenType.AT_GT: 'AT_GT'>: <function binary_range_parser.<locals>._parse_binary_range>, <TokenType.BETWEEN: 'BETWEEN'>: <function Parser.<lambda>>, <TokenType.GLOB: 'GLOB'>: <function binary_range_parser.<locals>._parse_binary_range>, <TokenType.ILIKE: 'ILIKE'>: <function binary_range_parser.<locals>._parse_binary_range>, <TokenType.IN: 'IN'>: <function Parser.<lambda>>, <TokenType.IRLIKE: 'IRLIKE'>: <function binary_range_parser.<locals>._parse_binary_range>, <TokenType.IS: 'IS'>: <function Parser.<lambda>>, <TokenType.LIKE: 'LIKE'>: <function binary_range_parser.<locals>._parse_binary_range>, <TokenType.LT_AT: 'LT_AT'>: <function binary_range_parser.<locals>._parse_binary_range>, <TokenType.OVERLAPS: 'OVERLAPS'>: <function binary_range_parser.<locals>._parse_binary_range>, <TokenType.RLIKE: 'RLIKE'>: <function binary_range_parser.<locals>._parse_binary_range>, <TokenType.SIMILAR_TO: 'SIMILAR_TO'>: <function binary_range_parser.<locals>._parse_binary_range>, <TokenType.FOR: 'FOR'>: <function Parser.<lambda>>, <TokenType.GLOBAL: 'GLOBAL'>: <function ClickHouse.Parser.<lambda>>}
COLUMN_OPERATORS = {<TokenType.DOT: 'DOT'>: None, <TokenType.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.ARRAY: 'ARRAY'>, <TokenType.OUTER: 'OUTER'>, <TokenType.ANTI: 'ANTI'>, <TokenType.ANY: 'ANY'>, <TokenType.SEMI: 'SEMI'>, <TokenType.STRAIGHT_JOIN: 'STRAIGHT_JOIN'>, <TokenType.ASOF: 'ASOF'>, <TokenType.CROSS: 'CROSS'>, <TokenType.INNER: 'INNER'>}
TABLE_ALIAS_TOKENS = {<TokenType.BIT: 'BIT'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.XML: 'XML'>, <TokenType.WAREHOUSE: 'WAREHOUSE'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.RENAME: 'RENAME'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.ROLLUP: 'ROLLUP'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.POLYGON: 'POLYGON'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.SOURCE: 'SOURCE'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.NULL: 'NULL'>, <TokenType.ASC: 'ASC'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.CURRENT_SCHEMA: 'CURRENT_SCHEMA'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.FALSE: 'FALSE'>, <TokenType.REFERENCES: 'REFERENCES'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.CHAR: 'CHAR'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.KILL: 'KILL'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.LINESTRING: 'LINESTRING'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.NAME: 'NAME'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.UDOUBLE: 'UDOUBLE'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.MODEL: 'MODEL'>, <TokenType.BLOB: 'BLOB'>, <TokenType.JSONB: 'JSONB'>, <TokenType.DECIMAL64: 'DECIMAL64'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.STAGE: 'STAGE'>, <TokenType.RING: 'RING'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.MULTIPOLYGON: 'MULTIPOLYGON'>, <TokenType.INT256: 'INT256'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.NESTED: 'NESTED'>, <TokenType.ROWS: 'ROWS'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.DATE: 'DATE'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.YEAR: 'YEAR'>, <TokenType.INET: 'INET'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.UINT128: 'UINT128'>, <TokenType.BINARY: 'BINARY'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.TEXT: 'TEXT'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.DYNAMIC: 'DYNAMIC'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.STORAGE_INTEGRATION: 'STORAGE_INTEGRATION'>, <TokenType.CASE: 'CASE'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.UNIQUE: 'UNIQUE'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.ENUM: 'ENUM'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.TOP: 'TOP'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.FIRST: 'FIRST'>, <TokenType.KEEP: 'KEEP'>, <TokenType.MULTILINESTRING: 'MULTILINESTRING'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.RANGE: 'RANGE'>, <TokenType.INDEX: 'INDEX'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.VIEW: 'VIEW'>, <TokenType.VAR: 'VAR'>, <TokenType.MAP: 'MAP'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.UUID: 'UUID'>, <TokenType.DECIMAL128: 'DECIMAL128'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.IPV6: 'IPV6'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.UINT256: 'UINT256'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.TABLE: 'TABLE'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.COPY: 'COPY'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.ORDINALITY: 'ORDINALITY'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.DESC: 'DESC'>, <TokenType.JSON: 'JSON'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.LIMIT: 'LIMIT'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.ROW: 'ROW'>, <TokenType.SUPER: 'SUPER'>, <TokenType.DELETE: 'DELETE'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.ALL: 'ALL'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.POINT: 'POINT'>, <TokenType.LOAD: 'LOAD'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.USE: 'USE'>, <TokenType.EXPORT: 'EXPORT'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.SINK: 'SINK'>, <TokenType.UINT: 'UINT'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.TRUE: 'TRUE'>, <TokenType.MERGE: 'MERGE'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.FILE_FORMAT: 'FILE_FORMAT'>, <TokenType.SHOW: 'SHOW'>, <TokenType.NEXT: 'NEXT'>, <TokenType.SET: 'SET'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.END: 'END'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.PUT: 'PUT'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.DETACH: 'DETACH'>, <TokenType.INT128: 'INT128'>, <TokenType.TIME: 'TIME'>, <TokenType.SMALLDATETIME: 'SMALLDATETIME'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.STREAMLIT: 'STREAMLIT'>, <TokenType.CUBE: 'CUBE'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.NAMESPACE: 'NAMESPACE'>, <TokenType.IS: 'IS'>, <TokenType.DATETIME2: 'DATETIME2'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.LIST: 'LIST'>, <TokenType.STRAIGHT_JOIN: 'STRAIGHT_JOIN'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.PROCEDURE: 'PROCEDURE'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.IPV4: 'IPV4'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.SOME: 'SOME'>, <TokenType.INT: 'INT'>, <TokenType.FILTER: 'FILTER'>, <TokenType.CACHE: 'CACHE'>, <TokenType.TAG: 'TAG'>, <TokenType.DIV: 'DIV'>, <TokenType.MONEY: 'MONEY'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.DATE32: 'DATE32'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.DECIMAL256: 'DECIMAL256'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.DECIMAL32: 'DECIMAL32'>, <TokenType.ATTACH: 'ATTACH'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>}
ALIAS_TOKENS = {<TokenType.BIT: 'BIT'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.XML: 'XML'>, <TokenType.WAREHOUSE: 'WAREHOUSE'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.RIGHT: 'RIGHT'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.RENAME: 'RENAME'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.ROLLUP: 'ROLLUP'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.POLYGON: 'POLYGON'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.SOURCE: 'SOURCE'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.NULL: 'NULL'>, <TokenType.ASC: 'ASC'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.NATURAL: 'NATURAL'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.CURRENT_SCHEMA: 'CURRENT_SCHEMA'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.LEFT: 'LEFT'>, <TokenType.FALSE: 'FALSE'>, <TokenType.REFERENCES: 'REFERENCES'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.CHAR: 'CHAR'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.KILL: 'KILL'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.LINESTRING: 'LINESTRING'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.NAME: 'NAME'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.UDOUBLE: 'UDOUBLE'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.MODEL: 'MODEL'>, <TokenType.BLOB: 'BLOB'>, <TokenType.FULL: 'FULL'>, <TokenType.JSONB: 'JSONB'>, <TokenType.DECIMAL64: 'DECIMAL64'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.STAGE: 'STAGE'>, <TokenType.RING: 'RING'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.MULTIPOLYGON: 'MULTIPOLYGON'>, <TokenType.INT256: 'INT256'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.NESTED: 'NESTED'>, <TokenType.ROWS: 'ROWS'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.DATE: 'DATE'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.YEAR: 'YEAR'>, <TokenType.INET: 'INET'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.WINDOW: 'WINDOW'>, <TokenType.UINT128: 'UINT128'>, <TokenType.BINARY: 'BINARY'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.TEXT: 'TEXT'>, <TokenType.ANTI: 'ANTI'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.SEMI: 'SEMI'>, <TokenType.DYNAMIC: 'DYNAMIC'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.STORAGE_INTEGRATION: 'STORAGE_INTEGRATION'>, <TokenType.CASE: 'CASE'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.FINAL: 'FINAL'>, <TokenType.UNIQUE: 'UNIQUE'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.ENUM: 'ENUM'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.TOP: 'TOP'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.FIRST: 'FIRST'>, <TokenType.KEEP: 'KEEP'>, <TokenType.MULTILINESTRING: 'MULTILINESTRING'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.RANGE: 'RANGE'>, <TokenType.INDEX: 'INDEX'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.VIEW: 'VIEW'>, <TokenType.ANY: 'ANY'>, <TokenType.VAR: 'VAR'>, <TokenType.MAP: 'MAP'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.ASOF: 'ASOF'>, <TokenType.UUID: 'UUID'>, <TokenType.DECIMAL128: 'DECIMAL128'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.IPV6: 'IPV6'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.UINT256: 'UINT256'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.TABLE: 'TABLE'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.COPY: 'COPY'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.ORDINALITY: 'ORDINALITY'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.DESC: 'DESC'>, <TokenType.JSON: 'JSON'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.LIMIT: 'LIMIT'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.ROW: 'ROW'>, <TokenType.SUPER: 'SUPER'>, <TokenType.DELETE: 'DELETE'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.ALL: 'ALL'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.POINT: 'POINT'>, <TokenType.LOAD: 'LOAD'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.USE: 'USE'>, <TokenType.EXPORT: 'EXPORT'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.SINK: 'SINK'>, <TokenType.UINT: 'UINT'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.TRUE: 'TRUE'>, <TokenType.MERGE: 'MERGE'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.FILE_FORMAT: 'FILE_FORMAT'>, <TokenType.SHOW: 'SHOW'>, <TokenType.NEXT: 'NEXT'>, <TokenType.SET: 'SET'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.END: 'END'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.PUT: 'PUT'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.DETACH: 'DETACH'>, <TokenType.INT128: 'INT128'>, <TokenType.TIME: 'TIME'>, <TokenType.SMALLDATETIME: 'SMALLDATETIME'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.STREAMLIT: 'STREAMLIT'>, <TokenType.CUBE: 'CUBE'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.NAMESPACE: 'NAMESPACE'>, <TokenType.IS: 'IS'>, <TokenType.DATETIME2: 'DATETIME2'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.LIST: 'LIST'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.PROCEDURE: 'PROCEDURE'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.IPV4: 'IPV4'>, <TokenType.APPLY: 'APPLY'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.SOME: 'SOME'>, <TokenType.INT: 'INT'>, <TokenType.FILTER: 'FILTER'>, <TokenType.CACHE: 'CACHE'>, <TokenType.TAG: 'TAG'>, <TokenType.DIV: 'DIV'>, <TokenType.MONEY: 'MONEY'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.SETTINGS: 'SETTINGS'>, <TokenType.DATE32: 'DATE32'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.DECIMAL256: 'DECIMAL256'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.DECIMAL32: 'DECIMAL32'>, <TokenType.ATTACH: 'ATTACH'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>}
LOG_DEFAULTS_TO_LN = True
QUERY_MODIFIER_PARSERS = {<TokenType.MATCH_RECOGNIZE: 'MATCH_RECOGNIZE'>: <function Parser.<lambda>>, <TokenType.PREWHERE: 'PREWHERE'>: <function Parser.<lambda>>, <TokenType.WHERE: 'WHERE'>: <function Parser.<lambda>>, <TokenType.GROUP_BY: 'GROUP_BY'>: <function Parser.<lambda>>, <TokenType.HAVING: 'HAVING'>: <function Parser.<lambda>>, <TokenType.QUALIFY: 'QUALIFY'>: <function Parser.<lambda>>, <TokenType.WINDOW: 'WINDOW'>: <function Parser.<lambda>>, <TokenType.ORDER_BY: 'ORDER_BY'>: <function Parser.<lambda>>, <TokenType.LIMIT: 'LIMIT'>: <function Parser.<lambda>>, <TokenType.FETCH: 'FETCH'>: <function Parser.<lambda>>, <TokenType.OFFSET: 'OFFSET'>: <function Parser.<lambda>>, <TokenType.FOR: 'FOR'>: <function Parser.<lambda>>, <TokenType.LOCK: 'LOCK'>: <function Parser.<lambda>>, <TokenType.TABLE_SAMPLE: 'TABLE_SAMPLE'>: <function Parser.<lambda>>, <TokenType.USING: 'USING'>: <function Parser.<lambda>>, <TokenType.CLUSTER_BY: 'CLUSTER_BY'>: <function Parser.<lambda>>, <TokenType.DISTRIBUTE_BY: 'DISTRIBUTE_BY'>: <function Parser.<lambda>>, <TokenType.SORT_BY: 'SORT_BY'>: <function Parser.<lambda>>, <TokenType.CONNECT_BY: 'CONNECT_BY'>: <function Parser.<lambda>>, <TokenType.START_WITH: 'START_WITH'>: <function Parser.<lambda>>, <TokenType.SETTINGS: 'SETTINGS'>: <function ClickHouse.Parser.<lambda>>, <TokenType.FORMAT: 'FORMAT'>: <function ClickHouse.Parser.<lambda>>}
CONSTRAINT_PARSERS = {'AUTOINCREMENT': <function Parser.<lambda>>, 'AUTO_INCREMENT': <function Parser.<lambda>>, 'CASESPECIFIC': <function Parser.<lambda>>, 'CHARACTER SET': <function Parser.<lambda>>, 'CHECK': <function Parser.<lambda>>, 'COLLATE': <function Parser.<lambda>>, 'COMMENT': <function Parser.<lambda>>, 'COMPRESS': <function Parser.<lambda>>, 'CLUSTERED': <function Parser.<lambda>>, 'NONCLUSTERED': <function Parser.<lambda>>, 'DEFAULT': <function Parser.<lambda>>, 'ENCODE': <function Parser.<lambda>>, 'EPHEMERAL': <function Parser.<lambda>>, 'EXCLUDE': <function Parser.<lambda>>, 'FOREIGN KEY': <function Parser.<lambda>>, 'FORMAT': <function Parser.<lambda>>, 'GENERATED': <function Parser.<lambda>>, 'IDENTITY': <function Parser.<lambda>>, 'INLINE': <function Parser.<lambda>>, 'LIKE': <function Parser.<lambda>>, 'NOT': <function Parser.<lambda>>, 'NULL': <function Parser.<lambda>>, 'ON': <function Parser.<lambda>>, 'PATH': <function Parser.<lambda>>, 'PERIOD': <function Parser.<lambda>>, 'PRIMARY KEY': <function Parser.<lambda>>, 'REFERENCES': <function Parser.<lambda>>, 'TITLE': <function Parser.<lambda>>, 'TTL': <function Parser.<lambda>>, 'UNIQUE': <function Parser.<lambda>>, 'UPPERCASE': <function Parser.<lambda>>, 'WATERMARK': <function Parser.<lambda>>, 'WITH': <function Parser.<lambda>>, 'INDEX': <function ClickHouse.Parser.<lambda>>, 'CODEC': <function ClickHouse.Parser.<lambda>>}
ALTER_PARSERS = {'ADD': <function Parser.<lambda>>, 'AS': <function Parser.<lambda>>, 'ALTER': <function Parser.<lambda>>, 'CLUSTER BY': <function Parser.<lambda>>, 'DELETE': <function Parser.<lambda>>, 'DROP': <function Parser.<lambda>>, 'RENAME': <function Parser.<lambda>>, 'SET': <function Parser.<lambda>>, 'SWAP': <function Parser.<lambda>>, 'REPLACE': <function ClickHouse.Parser.<lambda>>}
SCHEMA_UNNAMED_CONSTRAINTS = {'PERIOD', 'UNIQUE', 'INDEX', 'CHECK', 'PRIMARY KEY', 'FOREIGN KEY', 'WATERMARK', 'EXCLUDE', 'LIKE'}
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
  ARRAY_CONSTRUCTORS
  COMMENT_TABLE_ALIAS_TOKENS
  UPDATE_ALIAS_TOKENS
  TRIM_TYPES
  CONJUNCTION
  ASSIGNMENT
  DISJUNCTION
  EQUALITY
  COMPARISON
  BITWISE
  TERM
  FACTOR
  EXPONENT
  TIMES
  TIMESTAMPS
  SET_OPERATIONS
  JOIN_METHODS
  JOIN_SIDES
  JOIN_HINTS
  LAMBDAS
  EXPRESSION_PARSERS
  STATEMENT_PARSERS
  UNARY_PARSERS
  STRING_PARSERS
  NUMERIC_PARSERS
  PRIMARY_PARSERS
  ALTER_ALTER_PARSERS
  INVALID_FUNC_NAME_TOKENS
  KEY_VALUE_DEFINITIONS
  SET_PARSERS
  SHOW_PARSERS
  TYPE_LITERAL_PARSERS
  TYPE_CONVERTERS
  DDL_SELECT_TOKENS
  PRE_VOLATILE_TOKENS
  TRANSACTION_KIND
  TRANSACTION_CHARACTERISTICS
  CONFLICT_ACTIONS
  CREATE_SEQUENCE
  ISOLATED_LOADING_OPTIONS
  USABLES
  CAST_ACTIONS
  SCHEMA_BINDING_OPTIONS
  PROCEDURE_OPTIONS
  EXECUTE_AS_OPTIONS
  KEY_CONSTRAINT_OPTIONS
  INSERT_ALTERNATIVES
  CLONE_KEYWORDS
  HISTORICAL_DATA_PREFIX
  HISTORICAL_DATA_KIND
  OPCLASS_FOLLOW_KEYWORDS
  OPTYPE_FOLLOW_TOKENS
  TABLE_INDEX_HINT_TOKENS
  VIEW_ATTRIBUTES
  WINDOW_ALIAS_TOKENS
  WINDOW_BEFORE_PAREN_TOKENS
  WINDOW_SIDES
  JSON_KEY_VALUE_SEPARATOR_TOKENS
  FETCH_TOKENS
  ADD_CONSTRAINT_TOKENS
  DISTINCT_TOKENS
  NULL_TOKENS
  UNNEST_OFFSET_ALIAS_TOKENS
  SELECT_START_TOKENS
  COPY_INTO_VARLEN_OPTIONS
  IS_JSON_PREDICATE_KIND
  ODBC_DATETIME_LITERALS
  ON_CONDITION_TOKENS
  PRIVILEGE_FOLLOW_TOKENS
  DESCRIBE_STYLES
  ANALYZE_STYLES
  ANALYZE_EXPRESSION_PARSERS
  PARTITION_KEYWORDS
  AMBIGUOUS_ALIAS_TOKENS
  OPERATION_MODIFIERS
  RECURSIVE_CTE_SEARCH_KIND
  MODIFIABLES
  STRICT_CAST
  PREFIXED_PIVOT_COLUMNS
  IDENTIFY_PIVOT_STRINGS
  ALTER_TABLE_ADD_REQUIRED_FOR_EACH_COLUMN
  TABLESAMPLE_CSV
  DEFAULT_SAMPLING_METHOD
  SET_REQUIRES_ASSIGNMENT_DELIMITER
  TRIM_PATTERN_FIRST
  STRING_ALIASES
  SET_OP_MODIFIERS
  NO_PAREN_IF_COMMANDS
  JSON_ARROWS_REQUIRE_JSON_TYPE
  COLON_IS_VARIANT_EXTRACT
  VALUES_FOLLOWED_BY_PAREN
  SUPPORTS_IMPLICIT_UNNEST
  SUPPORTS_PARTITION_SELECTION
  WRAPPED_TRANSFORM_COLUMN_CONSTRAINT
  error_level
  error_message_context
  max_errors
  dialect
  reset
  parse
  parse_into
  check_errors
  raise_error
  expression
  validate_expression
  parse_set_operation
  errors
  sql

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

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

    1154        def strtodate_sql(self, expression: exp.StrToDate) -> str:
    1155            strtodate_sql = self.function_fallback_sql(expression)
    1156
    1157            if not isinstance(expression.parent, exp.Cast):
    1158                # StrToDate returns DATEs in other dialects (eg. postgres), so
    1159                # this branch aims to improve the transpilation to clickhouse
    1160                return self.cast_sql(exp.cast(expression, "DATE"))
    1161
    1162            return strtodate_sql

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

    1164        def cast_sql(self, expression: exp.Cast, safe_prefix: t.Optional[str] = None) -> str:
    1165            this = expression.this
    1166
    1167            if isinstance(this, exp.StrToDate) and expression.to == exp.DataType.build("datetime"):
    1168                return self.sql(this)
    1169
    1170            return super().cast_sql(expression, safe_prefix=safe_prefix)

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

    1172        def trycast_sql(self, expression: exp.TryCast) -> str:
    1173            dtype = expression.to
    1174            if not dtype.is_type(*self.NON_NULLABLE_TYPES, check_nullable=True):
    1175                # Casting x into Nullable(T) appears to behave similarly to TRY_CAST(x AS T)
    1176                dtype.set("nullable", True)
    1177
    1178            return super().cast_sql(expression)

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

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

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

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

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

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

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

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

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

    1215        def datatype_sql(self, expression: exp.DataType) -> str:
    1216            # String is the standard ClickHouse type, every other variant is just an alias.
    1217            # Additionally, any supplied length parameter will be ignored.
    1218            #
    1219            # https://clickhouse.com/docs/en/sql-reference/data-types/string
    1220            if expression.this in self.STRING_TYPE_MAPPING:
    1221                dtype = "String"
    1222            else:
    1223                dtype = super().datatype_sql(expression)
    1224
    1225            # This section changes the type to `Nullable(...)` if the following conditions hold:
    1226            # - It's marked as nullable - this ensures we won't wrap ClickHouse types with `Nullable`
    1227            #   and change their semantics
    1228            # - It's not the key type of a `Map`. This is because ClickHouse enforces the following
    1229            #   constraint: "Type of Map key must be a type, that can be represented by integer or
    1230            #   String or FixedString (possibly LowCardinality) or UUID or IPv6"
    1231            # - It's not a composite type, e.g. `Nullable(Array(...))` is not a valid type
    1232            parent = expression.parent
    1233            nullable = expression.args.get("nullable")
    1234            if nullable is True or (
    1235                nullable is None
    1236                and not (
    1237                    isinstance(parent, exp.DataType)
    1238                    and parent.is_type(exp.DataType.Type.MAP, check_nullable=True)
    1239                    and expression.index in (None, 0)
    1240                )
    1241                and not expression.is_type(*self.NON_NULLABLE_TYPES, check_nullable=True)
    1242            ):
    1243                dtype = f"Nullable({dtype})"
    1244
    1245            return dtype

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

    1247        def cte_sql(self, expression: exp.CTE) -> str:
    1248            if expression.args.get("scalar"):
    1249                this = self.sql(expression, "this")
    1250                alias = self.sql(expression, "alias")
    1251                return f"{this} AS {alias}"
    1252
    1253            return super().cte_sql(expression)

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

    1255        def after_limit_modifiers(self, expression: exp.Expression) -> t.List[str]:
    1256            return super().after_limit_modifiers(expression) + [
    1257                (
    1258                    self.seg("SETTINGS ") + self.expressions(expression, key="settings", flat=True)
    1259                    if expression.args.get("settings")
    1260                    else ""
    1261                ),
    1262                (
    1263                    self.seg("FORMAT ") + self.sql(expression, "format")
    1264                    if expression.args.get("format")
    1265                    else ""
    1266                ),
    1267            ]

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

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

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

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

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

    1275        def createable_sql(self, expression: exp.Create, locations: t.DefaultDict) -> str:
    1276            if expression.kind in self.ON_CLUSTER_TARGETS and locations.get(
    1277                exp.Properties.Location.POST_NAME
    1278            ):
    1279                this_name = self.sql(
    1280                    expression.this if isinstance(expression.this, exp.Schema) else expression,
    1281                    "this",
    1282                )
    1283                this_properties = " ".join(
    1284                    [self.sql(prop) for prop in locations[exp.Properties.Location.POST_NAME]]
    1285                )
    1286                this_schema = self.schema_columns_sql(expression.this)
    1287                this_schema = f"{self.sep()}{this_schema}" if this_schema else ""
    1288
    1289                return f"{this_name}{self.sep()}{this_properties}{this_schema}"
    1290
    1291            return super().createable_sql(expression, locations)

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

    1293        def create_sql(self, expression: exp.Create) -> str:
    1294            # The comment property comes last in CTAS statements, i.e. after the query
    1295            query = expression.expression
    1296            if isinstance(query, exp.Query):
    1297                comment_prop = expression.find(exp.SchemaCommentProperty)
    1298                if comment_prop:
    1299                    comment_prop.pop()
    1300                    query.replace(exp.paren(query))
    1301            else:
    1302                comment_prop = None
    1303
    1304            create_sql = super().create_sql(expression)
    1305
    1306            comment_sql = self.sql(comment_prop)
    1307            comment_sql = f" {comment_sql}" if comment_sql else ""
    1308
    1309            return f"{create_sql}{comment_sql}"

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

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

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

    1315        def indexcolumnconstraint_sql(self, expression: exp.IndexColumnConstraint) -> str:
    1316            this = self.sql(expression, "this")
    1317            this = f" {this}" if this else ""
    1318            expr = self.sql(expression, "expression")
    1319            expr = f" {expr}" if expr else ""
    1320            index_type = self.sql(expression, "index_type")
    1321            index_type = f" TYPE {index_type}" if index_type else ""
    1322            granularity = self.sql(expression, "granularity")
    1323            granularity = f" GRANULARITY {granularity}" if granularity else ""
    1324
    1325            return f"INDEX{this}{expr}{index_type}{granularity}"

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

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

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

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

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

    1333        def replacepartition_sql(self, expression: exp.ReplacePartition) -> str:
    1334            return (
    1335                f"REPLACE {self.sql(expression.expression)} FROM {self.sql(expression, 'source')}"
    1336            )

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

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

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

    1341        def is_sql(self, expression: exp.Is) -> str:
    1342            is_sql = super().is_sql(expression)
    1343
    1344            if isinstance(expression.parent, exp.Not):
    1345                # value IS NOT NULL -> NOT (value IS NULL)
    1346                is_sql = self.wrap(is_sql)
    1347
    1348            return is_sql

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

    1350        def in_sql(self, expression: exp.In) -> str:
    1351            in_sql = super().in_sql(expression)
    1352
    1353            if isinstance(expression.parent, exp.Not) and expression.args.get("is_global"):
    1354                in_sql = in_sql.replace("GLOBAL IN", "GLOBAL NOT IN", 1)
    1355
    1356            return in_sql

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

    1358        def not_sql(self, expression: exp.Not) -> str:
    1359            if isinstance(expression.this, exp.In) and expression.this.args.get("is_global"):
    1360                # let `GLOBAL IN` child interpose `NOT`
    1361                return self.sql(expression, "this")
    1362
    1363            return super().not_sql(expression)

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

    1365        def values_sql(self, expression: exp.Values, values_as_table: bool = True) -> str:
    1366            # If the VALUES clause contains tuples of expressions, we need to treat it
    1367            # as a table since Clickhouse will automatically alias it as such.
    1368            alias = expression.args.get("alias")
    1369
    1370            if alias and alias.args.get("columns") and expression.expressions:
    1371                values = expression.expressions[0].expressions
    1372                values_as_table = any(isinstance(value, exp.Tuple) for value in values)
    1373            else:
    1374                values_as_table = True
    1375
    1376            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
  COPY_PARAMS_ARE_WRAPPED
  COPY_PARAMS_EQ_REQUIRED
  COPY_HAS_INTO_KEYWORD
  STAR_EXCEPT
  HEX_FUNC
  WITH_PROPERTIES_PREFIX
  QUOTE_JSON_PATH
  PAD_FILL_PATTERN_IS_REQUIRED
  SUPPORTS_EXPLODING_PROJECTIONS
  ARRAY_CONCAT_IS_VAR_LEN
  SUPPORTS_CONVERT_TIMEZONE
  SUPPORTS_MEDIAN
  SUPPORTS_UNIX_SECONDS
  PARSE_JSON_NAME
  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
  SENTINEL_LINE_BREAK
  pretty
  identify
  normalize
  pad
  unsupported_level
  max_unsupported
  leading_comma
  max_text_width
  comments
  dialect
  normalize_functions
  unsupported_messages
  generate
  preprocess
  unsupported
  sep
  seg
  pad_comment
  maybe_comment
  wrap
  no_identify
  normalize_func
  indent
  sql
  uncache_sql
  cache_sql
  characterset_sql
  column_parts
  column_sql
  columnposition_sql
  columndef_sql
  columnconstraint_sql
  computedcolumnconstraint_sql
  autoincrementcolumnconstraint_sql
  compresscolumnconstraint_sql
  generatedasidentitycolumnconstraint_sql
  generatedasrowcolumnconstraint_sql
  periodforsystemtimeconstraint_sql
  notnullcolumnconstraint_sql
  transformcolumnconstraint_sql
  primarykeycolumnconstraint_sql
  uniquecolumnconstraint_sql
  sequenceproperties_sql
  clone_sql
  describe_sql
  heredoc_sql
  prepend_ctes
  with_sql
  tablealias_sql
  bitstring_sql
  hexstring_sql
  bytestring_sql
  unicodestring_sql
  rawstring_sql
  datatypeparam_sql
  directory_sql
  delete_sql
  drop_sql
  set_operation
  set_operations
  fetch_sql
  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
  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
  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
  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
  put_sql