Edit on GitHub

sqlglot.dialects.clickhouse

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

Determines how function names are going to be normalized.

Possible values:

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

NULL_ORDERING = 'nulls_are_last'

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

SUPPORTS_USER_DEFINED_TYPES = False

Whether user-defined data types are supported.

SAFE_DIVISION = True

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

LOG_BASE_FIRST: Optional[bool] = None

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

FORCE_EARLY_ALIAS_REF_EXPANSION = True

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

For example:

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

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

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

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

SUPPORTS_COLUMN_JOIN_MARKS = False

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

tokenizer_class = <class 'ClickHouse.Tokenizer'>
jsonpath_tokenizer_class = <class 'sqlglot.tokens.JSONPathTokenizer'>
parser_class = <class 'ClickHouse.Parser'>
generator_class = <class 'ClickHouse.Generator'>
TIME_TRIE: Dict = {}
FORMAT_TRIE: Dict = {}
INVERSE_TIME_MAPPING: Dict[str, str] = {}
INVERSE_TIME_TRIE: Dict = {}
INVERSE_FORMAT_MAPPING: Dict[str, str] = {}
INVERSE_FORMAT_TRIE: Dict = {}
ESCAPED_SEQUENCES: Dict[str, str] = {'\x07': '\\a', '\x08': '\\b', '\x0c': '\\f', '\n': '\\n', '\r': '\\r', '\t': '\\t', '\x0b': '\\v', '\\': '\\\\', '\x00': '\\0'}
QUOTE_START = "'"
QUOTE_END = "'"
IDENTIFIER_START = '"'
IDENTIFIER_END = '"'
BIT_START: Optional[str] = '0b'
BIT_END: Optional[str] = ''
HEX_START: Optional[str] = '0x'
HEX_END: Optional[str] = ''
BYTE_START: Optional[str] = None
BYTE_END: Optional[str] = None
UNICODE_START: Optional[str] = None
UNICODE_END: Optional[str] = None
class ClickHouse.Tokenizer(sqlglot.tokens.Tokenizer):
112    class Tokenizer(tokens.Tokenizer):
113        COMMENTS = ["--", "#", "#!", ("/*", "*/")]
114        IDENTIFIERS = ['"', "`"]
115        STRING_ESCAPES = ["'", "\\"]
116        BIT_STRINGS = [("0b", "")]
117        HEX_STRINGS = [("0x", ""), ("0X", "")]
118        HEREDOC_STRINGS = ["$"]
119
120        KEYWORDS = {
121            **tokens.Tokenizer.KEYWORDS,
122            "ATTACH": TokenType.COMMAND,
123            "DATE32": TokenType.DATE32,
124            "DATETIME64": TokenType.DATETIME64,
125            "DICTIONARY": TokenType.DICTIONARY,
126            "ENUM8": TokenType.ENUM8,
127            "ENUM16": TokenType.ENUM16,
128            "FINAL": TokenType.FINAL,
129            "FIXEDSTRING": TokenType.FIXEDSTRING,
130            "FLOAT32": TokenType.FLOAT,
131            "FLOAT64": TokenType.DOUBLE,
132            "GLOBAL": TokenType.GLOBAL,
133            "INT256": TokenType.INT256,
134            "LOWCARDINALITY": TokenType.LOWCARDINALITY,
135            "MAP": TokenType.MAP,
136            "NESTED": TokenType.NESTED,
137            "SAMPLE": TokenType.TABLE_SAMPLE,
138            "TUPLE": TokenType.STRUCT,
139            "UINT128": TokenType.UINT128,
140            "UINT16": TokenType.USMALLINT,
141            "UINT256": TokenType.UINT256,
142            "UINT32": TokenType.UINT,
143            "UINT64": TokenType.UBIGINT,
144            "UINT8": TokenType.UTINYINT,
145            "IPV4": TokenType.IPV4,
146            "IPV6": TokenType.IPV6,
147            "AGGREGATEFUNCTION": TokenType.AGGREGATEFUNCTION,
148            "SIMPLEAGGREGATEFUNCTION": TokenType.SIMPLEAGGREGATEFUNCTION,
149            "SYSTEM": TokenType.COMMAND,
150            "PREWHERE": TokenType.PREWHERE,
151        }
152        KEYWORDS.pop("/*+")
153
154        SINGLE_TOKENS = {
155            **tokens.Tokenizer.SINGLE_TOKENS,
156            "$": TokenType.HEREDOC_STRING,
157        }
COMMENTS = ['--', '#', '#!', ('/*', '*/')]
IDENTIFIERS = ['"', '`']
STRING_ESCAPES = ["'", '\\']
BIT_STRINGS = [('0b', '')]
HEX_STRINGS = [('0x', ''), ('0X', '')]
HEREDOC_STRINGS = ['$']
KEYWORDS = {'{%': <TokenType.BLOCK_START: 'BLOCK_START'>, '{%+': <TokenType.BLOCK_START: 'BLOCK_START'>, '{%-': <TokenType.BLOCK_START: 'BLOCK_START'>, '%}': <TokenType.BLOCK_END: 'BLOCK_END'>, '+%}': <TokenType.BLOCK_END: 'BLOCK_END'>, '-%}': <TokenType.BLOCK_END: 'BLOCK_END'>, '{{+': <TokenType.BLOCK_START: 'BLOCK_START'>, '{{-': <TokenType.BLOCK_START: 'BLOCK_START'>, '+}}': <TokenType.BLOCK_END: 'BLOCK_END'>, '-}}': <TokenType.BLOCK_END: 'BLOCK_END'>, '==': <TokenType.EQ: 'EQ'>, '::': <TokenType.DCOLON: 'DCOLON'>, '||': <TokenType.DPIPE: 'DPIPE'>, '>=': <TokenType.GTE: 'GTE'>, '<=': <TokenType.LTE: 'LTE'>, '<>': <TokenType.NEQ: 'NEQ'>, '!=': <TokenType.NEQ: 'NEQ'>, ':=': <TokenType.COLON_EQ: 'COLON_EQ'>, '<=>': <TokenType.NULLSAFE_EQ: 'NULLSAFE_EQ'>, '->': <TokenType.ARROW: 'ARROW'>, '->>': <TokenType.DARROW: 'DARROW'>, '=>': <TokenType.FARROW: 'FARROW'>, '#>': <TokenType.HASH_ARROW: 'HASH_ARROW'>, '#>>': <TokenType.DHASH_ARROW: 'DHASH_ARROW'>, '<->': <TokenType.LR_ARROW: 'LR_ARROW'>, '&&': <TokenType.DAMP: 'DAMP'>, '??': <TokenType.DQMARK: 'DQMARK'>, 'ALL': <TokenType.ALL: 'ALL'>, 'ALWAYS': <TokenType.ALWAYS: 'ALWAYS'>, 'AND': <TokenType.AND: 'AND'>, 'ANTI': <TokenType.ANTI: 'ANTI'>, 'ANY': <TokenType.ANY: 'ANY'>, 'ASC': <TokenType.ASC: 'ASC'>, 'AS': <TokenType.ALIAS: 'ALIAS'>, 'ASOF': <TokenType.ASOF: 'ASOF'>, 'AUTOINCREMENT': <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, 'AUTO_INCREMENT': <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, 'BEGIN': <TokenType.BEGIN: 'BEGIN'>, 'BETWEEN': <TokenType.BETWEEN: 'BETWEEN'>, 'CACHE': <TokenType.CACHE: 'CACHE'>, 'UNCACHE': <TokenType.UNCACHE: 'UNCACHE'>, 'CASE': <TokenType.CASE: 'CASE'>, 'CHARACTER SET': <TokenType.CHARACTER_SET: 'CHARACTER_SET'>, 'CLUSTER BY': <TokenType.CLUSTER_BY: 'CLUSTER_BY'>, 'COLLATE': <TokenType.COLLATE: 'COLLATE'>, 'COLUMN': <TokenType.COLUMN: 'COLUMN'>, 'COMMIT': <TokenType.COMMIT: 'COMMIT'>, 'CONNECT BY': <TokenType.CONNECT_BY: 'CONNECT_BY'>, 'CONSTRAINT': <TokenType.CONSTRAINT: 'CONSTRAINT'>, 'COPY': <TokenType.COPY: 'COPY'>, 'CREATE': <TokenType.CREATE: 'CREATE'>, 'CROSS': <TokenType.CROSS: 'CROSS'>, 'CUBE': <TokenType.CUBE: 'CUBE'>, 'CURRENT_DATE': <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, 'CURRENT_TIME': <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, 'CURRENT_TIMESTAMP': <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, 'CURRENT_USER': <TokenType.CURRENT_USER: 'CURRENT_USER'>, 'DATABASE': <TokenType.DATABASE: 'DATABASE'>, 'DEFAULT': <TokenType.DEFAULT: 'DEFAULT'>, 'DELETE': <TokenType.DELETE: 'DELETE'>, 'DESC': <TokenType.DESC: 'DESC'>, 'DESCRIBE': <TokenType.DESCRIBE: 'DESCRIBE'>, 'DISTINCT': <TokenType.DISTINCT: 'DISTINCT'>, 'DISTRIBUTE BY': <TokenType.DISTRIBUTE_BY: 'DISTRIBUTE_BY'>, 'DIV': <TokenType.DIV: 'DIV'>, 'DROP': <TokenType.DROP: 'DROP'>, 'ELSE': <TokenType.ELSE: 'ELSE'>, 'END': <TokenType.END: 'END'>, 'ENUM': <TokenType.ENUM: 'ENUM'>, 'ESCAPE': <TokenType.ESCAPE: 'ESCAPE'>, 'EXCEPT': <TokenType.EXCEPT: 'EXCEPT'>, 'EXECUTE': <TokenType.EXECUTE: 'EXECUTE'>, 'EXISTS': <TokenType.EXISTS: 'EXISTS'>, 'FALSE': <TokenType.FALSE: 'FALSE'>, 'FETCH': <TokenType.FETCH: 'FETCH'>, 'FILTER': <TokenType.FILTER: 'FILTER'>, 'FIRST': <TokenType.FIRST: 'FIRST'>, 'FULL': <TokenType.FULL: 'FULL'>, 'FUNCTION': <TokenType.FUNCTION: 'FUNCTION'>, 'FOR': <TokenType.FOR: 'FOR'>, 'FOREIGN KEY': <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, 'FORMAT': <TokenType.FORMAT: 'FORMAT'>, 'FROM': <TokenType.FROM: 'FROM'>, 'GEOGRAPHY': <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, 'GEOMETRY': <TokenType.GEOMETRY: 'GEOMETRY'>, 'GLOB': <TokenType.GLOB: 'GLOB'>, 'GROUP BY': <TokenType.GROUP_BY: 'GROUP_BY'>, 'GROUPING SETS': <TokenType.GROUPING_SETS: 'GROUPING_SETS'>, 'HAVING': <TokenType.HAVING: 'HAVING'>, 'ILIKE': <TokenType.ILIKE: 'ILIKE'>, 'IN': <TokenType.IN: 'IN'>, 'INDEX': <TokenType.INDEX: 'INDEX'>, 'INET': <TokenType.INET: 'INET'>, 'INNER': <TokenType.INNER: 'INNER'>, 'INSERT': <TokenType.INSERT: 'INSERT'>, 'INTERVAL': <TokenType.INTERVAL: 'INTERVAL'>, 'INTERSECT': <TokenType.INTERSECT: 'INTERSECT'>, 'INTO': <TokenType.INTO: 'INTO'>, 'IS': <TokenType.IS: 'IS'>, 'ISNULL': <TokenType.ISNULL: 'ISNULL'>, 'JOIN': <TokenType.JOIN: 'JOIN'>, 'KEEP': <TokenType.KEEP: 'KEEP'>, 'KILL': <TokenType.KILL: 'KILL'>, 'LATERAL': <TokenType.LATERAL: 'LATERAL'>, 'LEFT': <TokenType.LEFT: 'LEFT'>, 'LIKE': <TokenType.LIKE: 'LIKE'>, 'LIMIT': <TokenType.LIMIT: 'LIMIT'>, 'LOAD': <TokenType.LOAD: 'LOAD'>, 'LOCK': <TokenType.LOCK: 'LOCK'>, 'MERGE': <TokenType.MERGE: 'MERGE'>, 'NATURAL': <TokenType.NATURAL: 'NATURAL'>, 'NEXT': <TokenType.NEXT: 'NEXT'>, 'NOT': <TokenType.NOT: 'NOT'>, 'NOTNULL': <TokenType.NOTNULL: 'NOTNULL'>, 'NULL': <TokenType.NULL: 'NULL'>, 'OBJECT': <TokenType.OBJECT: 'OBJECT'>, 'OFFSET': <TokenType.OFFSET: 'OFFSET'>, 'ON': <TokenType.ON: 'ON'>, 'OR': <TokenType.OR: 'OR'>, 'XOR': <TokenType.XOR: 'XOR'>, 'ORDER BY': <TokenType.ORDER_BY: 'ORDER_BY'>, 'ORDINALITY': <TokenType.ORDINALITY: 'ORDINALITY'>, 'OUTER': <TokenType.OUTER: 'OUTER'>, 'OVER': <TokenType.OVER: 'OVER'>, 'OVERLAPS': <TokenType.OVERLAPS: 'OVERLAPS'>, 'OVERWRITE': <TokenType.OVERWRITE: 'OVERWRITE'>, 'PARTITION': <TokenType.PARTITION: 'PARTITION'>, 'PARTITION BY': <TokenType.PARTITION_BY: 'PARTITION_BY'>, 'PARTITIONED BY': <TokenType.PARTITION_BY: 'PARTITION_BY'>, 'PARTITIONED_BY': <TokenType.PARTITION_BY: 'PARTITION_BY'>, 'PERCENT': <TokenType.PERCENT: 'PERCENT'>, 'PIVOT': <TokenType.PIVOT: 'PIVOT'>, 'PRAGMA': <TokenType.PRAGMA: 'PRAGMA'>, 'PRIMARY KEY': <TokenType.PRIMARY_KEY: 'PRIMARY_KEY'>, 'PROCEDURE': <TokenType.PROCEDURE: 'PROCEDURE'>, 'QUALIFY': <TokenType.QUALIFY: 'QUALIFY'>, 'RANGE': <TokenType.RANGE: 'RANGE'>, 'RECURSIVE': <TokenType.RECURSIVE: 'RECURSIVE'>, 'REGEXP': <TokenType.RLIKE: 'RLIKE'>, 'REPLACE': <TokenType.REPLACE: 'REPLACE'>, 'RETURNING': <TokenType.RETURNING: 'RETURNING'>, 'REFERENCES': <TokenType.REFERENCES: 'REFERENCES'>, 'RIGHT': <TokenType.RIGHT: 'RIGHT'>, 'RLIKE': <TokenType.RLIKE: 'RLIKE'>, 'ROLLBACK': <TokenType.ROLLBACK: 'ROLLBACK'>, 'ROLLUP': <TokenType.ROLLUP: 'ROLLUP'>, 'ROW': <TokenType.ROW: 'ROW'>, 'ROWS': <TokenType.ROWS: 'ROWS'>, 'SCHEMA': <TokenType.SCHEMA: 'SCHEMA'>, 'SELECT': <TokenType.SELECT: 'SELECT'>, 'SEMI': <TokenType.SEMI: 'SEMI'>, 'SET': <TokenType.SET: 'SET'>, 'SETTINGS': <TokenType.SETTINGS: 'SETTINGS'>, 'SHOW': <TokenType.SHOW: 'SHOW'>, 'SIMILAR TO': <TokenType.SIMILAR_TO: 'SIMILAR_TO'>, 'SOME': <TokenType.SOME: 'SOME'>, 'SORT BY': <TokenType.SORT_BY: 'SORT_BY'>, 'START WITH': <TokenType.START_WITH: 'START_WITH'>, 'STRAIGHT_JOIN': <TokenType.STRAIGHT_JOIN: 'STRAIGHT_JOIN'>, 'TABLE': <TokenType.TABLE: 'TABLE'>, 'TABLESAMPLE': <TokenType.TABLE_SAMPLE: 'TABLE_SAMPLE'>, 'TEMP': <TokenType.TEMPORARY: 'TEMPORARY'>, 'TEMPORARY': <TokenType.TEMPORARY: 'TEMPORARY'>, 'THEN': <TokenType.THEN: 'THEN'>, 'TRUE': <TokenType.TRUE: 'TRUE'>, 'TRUNCATE': <TokenType.TRUNCATE: 'TRUNCATE'>, 'UNION': <TokenType.UNION: 'UNION'>, 'UNKNOWN': <TokenType.UNKNOWN: 'UNKNOWN'>, 'UNNEST': <TokenType.UNNEST: 'UNNEST'>, 'UNPIVOT': <TokenType.UNPIVOT: 'UNPIVOT'>, 'UPDATE': <TokenType.UPDATE: 'UPDATE'>, 'USE': <TokenType.USE: 'USE'>, 'USING': <TokenType.USING: 'USING'>, 'UUID': <TokenType.UUID: 'UUID'>, 'VALUES': <TokenType.VALUES: 'VALUES'>, 'VIEW': <TokenType.VIEW: 'VIEW'>, 'VOLATILE': <TokenType.VOLATILE: 'VOLATILE'>, 'WHEN': <TokenType.WHEN: 'WHEN'>, 'WHERE': <TokenType.WHERE: 'WHERE'>, 'WINDOW': <TokenType.WINDOW: 'WINDOW'>, 'WITH': <TokenType.WITH: 'WITH'>, 'APPLY': <TokenType.APPLY: 'APPLY'>, 'ARRAY': <TokenType.ARRAY: 'ARRAY'>, 'BIT': <TokenType.BIT: 'BIT'>, 'BOOL': <TokenType.BOOLEAN: 'BOOLEAN'>, 'BOOLEAN': <TokenType.BOOLEAN: 'BOOLEAN'>, 'BYTE': <TokenType.TINYINT: 'TINYINT'>, 'MEDIUMINT': <TokenType.MEDIUMINT: 'MEDIUMINT'>, 'INT1': <TokenType.TINYINT: 'TINYINT'>, 'TINYINT': <TokenType.TINYINT: 'TINYINT'>, 'INT16': <TokenType.SMALLINT: 'SMALLINT'>, 'SHORT': <TokenType.SMALLINT: 'SMALLINT'>, 'SMALLINT': <TokenType.SMALLINT: 'SMALLINT'>, 'INT128': <TokenType.INT128: 'INT128'>, 'HUGEINT': <TokenType.INT128: 'INT128'>, 'INT2': <TokenType.SMALLINT: 'SMALLINT'>, 'INTEGER': <TokenType.INT: 'INT'>, 'INT': <TokenType.INT: 'INT'>, 'INT4': <TokenType.INT: 'INT'>, 'INT32': <TokenType.INT: 'INT'>, 'INT64': <TokenType.BIGINT: 'BIGINT'>, 'LONG': <TokenType.BIGINT: 'BIGINT'>, 'BIGINT': <TokenType.BIGINT: 'BIGINT'>, 'INT8': <TokenType.TINYINT: 'TINYINT'>, 'UINT': <TokenType.UINT: 'UINT'>, 'DEC': <TokenType.DECIMAL: 'DECIMAL'>, 'DECIMAL': <TokenType.DECIMAL: 'DECIMAL'>, 'BIGDECIMAL': <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, 'BIGNUMERIC': <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, 'LIST': <TokenType.LIST: 'LIST'>, 'MAP': <TokenType.MAP: 'MAP'>, 'NULLABLE': <TokenType.NULLABLE: 'NULLABLE'>, 'NUMBER': <TokenType.DECIMAL: 'DECIMAL'>, 'NUMERIC': <TokenType.DECIMAL: 'DECIMAL'>, 'FIXED': <TokenType.DECIMAL: 'DECIMAL'>, 'REAL': <TokenType.FLOAT: 'FLOAT'>, 'FLOAT': <TokenType.FLOAT: 'FLOAT'>, 'FLOAT4': <TokenType.FLOAT: 'FLOAT'>, 'FLOAT8': <TokenType.DOUBLE: 'DOUBLE'>, 'DOUBLE': <TokenType.DOUBLE: 'DOUBLE'>, 'DOUBLE PRECISION': <TokenType.DOUBLE: 'DOUBLE'>, 'JSON': <TokenType.JSON: 'JSON'>, 'JSONB': <TokenType.JSONB: 'JSONB'>, 'CHAR': <TokenType.CHAR: 'CHAR'>, 'CHARACTER': <TokenType.CHAR: 'CHAR'>, 'NCHAR': <TokenType.NCHAR: 'NCHAR'>, 'VARCHAR': <TokenType.VARCHAR: 'VARCHAR'>, 'VARCHAR2': <TokenType.VARCHAR: 'VARCHAR'>, 'NVARCHAR': <TokenType.NVARCHAR: 'NVARCHAR'>, 'NVARCHAR2': <TokenType.NVARCHAR: 'NVARCHAR'>, 'BPCHAR': <TokenType.BPCHAR: 'BPCHAR'>, 'STR': <TokenType.TEXT: 'TEXT'>, 'STRING': <TokenType.TEXT: 'TEXT'>, 'TEXT': <TokenType.TEXT: 'TEXT'>, 'LONGTEXT': <TokenType.LONGTEXT: 'LONGTEXT'>, 'MEDIUMTEXT': <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, 'TINYTEXT': <TokenType.TINYTEXT: 'TINYTEXT'>, 'CLOB': <TokenType.TEXT: 'TEXT'>, 'LONGVARCHAR': <TokenType.TEXT: 'TEXT'>, 'BINARY': <TokenType.BINARY: 'BINARY'>, 'BLOB': <TokenType.VARBINARY: 'VARBINARY'>, 'LONGBLOB': <TokenType.LONGBLOB: 'LONGBLOB'>, 'MEDIUMBLOB': <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, 'TINYBLOB': <TokenType.TINYBLOB: 'TINYBLOB'>, 'BYTEA': <TokenType.VARBINARY: 'VARBINARY'>, 'VARBINARY': <TokenType.VARBINARY: 'VARBINARY'>, 'TIME': <TokenType.TIME: 'TIME'>, 'TIMETZ': <TokenType.TIMETZ: 'TIMETZ'>, 'TIMESTAMP': <TokenType.TIMESTAMP: 'TIMESTAMP'>, 'TIMESTAMPTZ': <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, 'TIMESTAMPLTZ': <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, 'TIMESTAMP_LTZ': <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, 'TIMESTAMPNTZ': <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, 'TIMESTAMP_NTZ': <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, 'DATE': <TokenType.DATE: 'DATE'>, 'DATETIME': <TokenType.DATETIME: 'DATETIME'>, 'INT4RANGE': <TokenType.INT4RANGE: 'INT4RANGE'>, 'INT4MULTIRANGE': <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, 'INT8RANGE': <TokenType.INT8RANGE: 'INT8RANGE'>, 'INT8MULTIRANGE': <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, 'NUMRANGE': <TokenType.NUMRANGE: 'NUMRANGE'>, 'NUMMULTIRANGE': <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, 'TSRANGE': <TokenType.TSRANGE: 'TSRANGE'>, 'TSMULTIRANGE': <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, 'TSTZRANGE': <TokenType.TSTZRANGE: 'TSTZRANGE'>, 'TSTZMULTIRANGE': <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, 'DATERANGE': <TokenType.DATERANGE: 'DATERANGE'>, 'DATEMULTIRANGE': <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, 'UNIQUE': <TokenType.UNIQUE: 'UNIQUE'>, 'VECTOR': <TokenType.VECTOR: 'VECTOR'>, 'STRUCT': <TokenType.STRUCT: 'STRUCT'>, 'SEQUENCE': <TokenType.SEQUENCE: 'SEQUENCE'>, 'VARIANT': <TokenType.VARIANT: 'VARIANT'>, 'ALTER': <TokenType.ALTER: 'ALTER'>, 'ANALYZE': <TokenType.COMMAND: 'COMMAND'>, 'CALL': <TokenType.COMMAND: 'COMMAND'>, 'COMMENT': <TokenType.COMMENT: 'COMMENT'>, 'EXPLAIN': <TokenType.COMMAND: 'COMMAND'>, 'GRANT': <TokenType.COMMAND: 'COMMAND'>, 'OPTIMIZE': <TokenType.COMMAND: 'COMMAND'>, 'PREPARE': <TokenType.COMMAND: 'COMMAND'>, 'VACUUM': <TokenType.COMMAND: 'COMMAND'>, 'USER-DEFINED': <TokenType.USERDEFINED: 'USERDEFINED'>, 'FOR VERSION': <TokenType.VERSION_SNAPSHOT: 'VERSION_SNAPSHOT'>, 'FOR TIMESTAMP': <TokenType.TIMESTAMP_SNAPSHOT: 'TIMESTAMP_SNAPSHOT'>, 'ATTACH': <TokenType.COMMAND: 'COMMAND'>, 'DATE32': <TokenType.DATE32: 'DATE32'>, 'DATETIME64': <TokenType.DATETIME64: 'DATETIME64'>, 'DICTIONARY': <TokenType.DICTIONARY: 'DICTIONARY'>, 'ENUM8': <TokenType.ENUM8: 'ENUM8'>, 'ENUM16': <TokenType.ENUM16: 'ENUM16'>, 'FINAL': <TokenType.FINAL: 'FINAL'>, 'FIXEDSTRING': <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, 'FLOAT32': <TokenType.FLOAT: 'FLOAT'>, 'FLOAT64': <TokenType.DOUBLE: 'DOUBLE'>, 'GLOBAL': <TokenType.GLOBAL: 'GLOBAL'>, 'INT256': <TokenType.INT256: 'INT256'>, 'LOWCARDINALITY': <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, 'NESTED': <TokenType.NESTED: 'NESTED'>, 'SAMPLE': <TokenType.TABLE_SAMPLE: 'TABLE_SAMPLE'>, 'TUPLE': <TokenType.STRUCT: 'STRUCT'>, 'UINT128': <TokenType.UINT128: 'UINT128'>, 'UINT16': <TokenType.USMALLINT: 'USMALLINT'>, 'UINT256': <TokenType.UINT256: 'UINT256'>, 'UINT32': <TokenType.UINT: 'UINT'>, 'UINT64': <TokenType.UBIGINT: 'UBIGINT'>, 'UINT8': <TokenType.UTINYINT: 'UTINYINT'>, 'IPV4': <TokenType.IPV4: 'IPV4'>, 'IPV6': <TokenType.IPV6: 'IPV6'>, 'AGGREGATEFUNCTION': <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, 'SIMPLEAGGREGATEFUNCTION': <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, 'SYSTEM': <TokenType.COMMAND: 'COMMAND'>, 'PREWHERE': <TokenType.PREWHERE: 'PREWHERE'>}
SINGLE_TOKENS = {'(': <TokenType.L_PAREN: 'L_PAREN'>, ')': <TokenType.R_PAREN: 'R_PAREN'>, '[': <TokenType.L_BRACKET: 'L_BRACKET'>, ']': <TokenType.R_BRACKET: 'R_BRACKET'>, '{': <TokenType.L_BRACE: 'L_BRACE'>, '}': <TokenType.R_BRACE: 'R_BRACE'>, '&': <TokenType.AMP: 'AMP'>, '^': <TokenType.CARET: 'CARET'>, ':': <TokenType.COLON: 'COLON'>, ',': <TokenType.COMMA: 'COMMA'>, '.': <TokenType.DOT: 'DOT'>, '-': <TokenType.DASH: 'DASH'>, '=': <TokenType.EQ: 'EQ'>, '>': <TokenType.GT: 'GT'>, '<': <TokenType.LT: 'LT'>, '%': <TokenType.MOD: 'MOD'>, '!': <TokenType.NOT: 'NOT'>, '|': <TokenType.PIPE: 'PIPE'>, '+': <TokenType.PLUS: 'PLUS'>, ';': <TokenType.SEMICOLON: 'SEMICOLON'>, '/': <TokenType.SLASH: 'SLASH'>, '\\': <TokenType.BACKSLASH: 'BACKSLASH'>, '*': <TokenType.STAR: 'STAR'>, '~': <TokenType.TILDA: 'TILDA'>, '?': <TokenType.PLACEHOLDER: 'PLACEHOLDER'>, '@': <TokenType.PARAMETER: 'PARAMETER'>, '#': <TokenType.HASH: 'HASH'>, "'": <TokenType.UNKNOWN: 'UNKNOWN'>, '`': <TokenType.UNKNOWN: 'UNKNOWN'>, '"': <TokenType.UNKNOWN: 'UNKNOWN'>, '$': <TokenType.HEREDOC_STRING: 'HEREDOC_STRING'>}
class ClickHouse.Parser(sqlglot.parser.Parser):
159    class Parser(parser.Parser):
160        # Tested in ClickHouse's playground, it seems that the following two queries do the same thing
161        # * select x from t1 union all select x from t2 limit 1;
162        # * select x from t1 union all (select x from t2 limit 1);
163        MODIFIERS_ATTACHED_TO_SET_OP = False
164        INTERVAL_SPANS = False
165
166        FUNCTIONS = {
167            **parser.Parser.FUNCTIONS,
168            "ANY": exp.AnyValue.from_arg_list,
169            "ARRAYSUM": exp.ArraySum.from_arg_list,
170            "COUNTIF": _build_count_if,
171            "DATE_ADD": build_date_delta(exp.DateAdd, default_unit=None),
172            "DATEADD": build_date_delta(exp.DateAdd, default_unit=None),
173            "DATE_DIFF": build_date_delta(exp.DateDiff, default_unit=None),
174            "DATEDIFF": build_date_delta(exp.DateDiff, default_unit=None),
175            "DATE_FORMAT": _build_date_format,
176            "DATE_SUB": build_date_delta(exp.DateSub, default_unit=None),
177            "DATESUB": build_date_delta(exp.DateSub, default_unit=None),
178            "FORMATDATETIME": _build_date_format,
179            "JSONEXTRACTSTRING": build_json_extract_path(
180                exp.JSONExtractScalar, zero_based_indexing=False
181            ),
182            "MAP": parser.build_var_map,
183            "MATCH": exp.RegexpLike.from_arg_list,
184            "RANDCANONICAL": exp.Rand.from_arg_list,
185            "TUPLE": exp.Struct.from_arg_list,
186            "TIMESTAMP_SUB": build_date_delta(exp.TimestampSub, default_unit=None),
187            "TIMESTAMPSUB": build_date_delta(exp.TimestampSub, default_unit=None),
188            "TIMESTAMP_ADD": build_date_delta(exp.TimestampAdd, default_unit=None),
189            "TIMESTAMPADD": build_date_delta(exp.TimestampAdd, default_unit=None),
190            "UNIQ": exp.ApproxDistinct.from_arg_list,
191            "XOR": lambda args: exp.Xor(expressions=args),
192            "MD5": exp.MD5Digest.from_arg_list,
193            "SHA256": lambda args: exp.SHA2(this=seq_get(args, 0), length=exp.Literal.number(256)),
194            "SHA512": lambda args: exp.SHA2(this=seq_get(args, 0), length=exp.Literal.number(512)),
195        }
196
197        AGG_FUNCTIONS = {
198            "count",
199            "min",
200            "max",
201            "sum",
202            "avg",
203            "any",
204            "stddevPop",
205            "stddevSamp",
206            "varPop",
207            "varSamp",
208            "corr",
209            "covarPop",
210            "covarSamp",
211            "entropy",
212            "exponentialMovingAverage",
213            "intervalLengthSum",
214            "kolmogorovSmirnovTest",
215            "mannWhitneyUTest",
216            "median",
217            "rankCorr",
218            "sumKahan",
219            "studentTTest",
220            "welchTTest",
221            "anyHeavy",
222            "anyLast",
223            "boundingRatio",
224            "first_value",
225            "last_value",
226            "argMin",
227            "argMax",
228            "avgWeighted",
229            "topK",
230            "topKWeighted",
231            "deltaSum",
232            "deltaSumTimestamp",
233            "groupArray",
234            "groupArrayLast",
235            "groupUniqArray",
236            "groupArrayInsertAt",
237            "groupArrayMovingAvg",
238            "groupArrayMovingSum",
239            "groupArraySample",
240            "groupBitAnd",
241            "groupBitOr",
242            "groupBitXor",
243            "groupBitmap",
244            "groupBitmapAnd",
245            "groupBitmapOr",
246            "groupBitmapXor",
247            "sumWithOverflow",
248            "sumMap",
249            "minMap",
250            "maxMap",
251            "skewSamp",
252            "skewPop",
253            "kurtSamp",
254            "kurtPop",
255            "uniq",
256            "uniqExact",
257            "uniqCombined",
258            "uniqCombined64",
259            "uniqHLL12",
260            "uniqTheta",
261            "quantile",
262            "quantiles",
263            "quantileExact",
264            "quantilesExact",
265            "quantileExactLow",
266            "quantilesExactLow",
267            "quantileExactHigh",
268            "quantilesExactHigh",
269            "quantileExactWeighted",
270            "quantilesExactWeighted",
271            "quantileTiming",
272            "quantilesTiming",
273            "quantileTimingWeighted",
274            "quantilesTimingWeighted",
275            "quantileDeterministic",
276            "quantilesDeterministic",
277            "quantileTDigest",
278            "quantilesTDigest",
279            "quantileTDigestWeighted",
280            "quantilesTDigestWeighted",
281            "quantileBFloat16",
282            "quantilesBFloat16",
283            "quantileBFloat16Weighted",
284            "quantilesBFloat16Weighted",
285            "simpleLinearRegression",
286            "stochasticLinearRegression",
287            "stochasticLogisticRegression",
288            "categoricalInformationValue",
289            "contingency",
290            "cramersV",
291            "cramersVBiasCorrected",
292            "theilsU",
293            "maxIntersections",
294            "maxIntersectionsPosition",
295            "meanZTest",
296            "quantileInterpolatedWeighted",
297            "quantilesInterpolatedWeighted",
298            "quantileGK",
299            "quantilesGK",
300            "sparkBar",
301            "sumCount",
302            "largestTriangleThreeBuckets",
303            "histogram",
304            "sequenceMatch",
305            "sequenceCount",
306            "windowFunnel",
307            "retention",
308            "uniqUpTo",
309            "sequenceNextNode",
310            "exponentialTimeDecayedAvg",
311        }
312
313        AGG_FUNCTIONS_SUFFIXES = [
314            "If",
315            "Array",
316            "ArrayIf",
317            "Map",
318            "SimpleState",
319            "State",
320            "Merge",
321            "MergeState",
322            "ForEach",
323            "Distinct",
324            "OrDefault",
325            "OrNull",
326            "Resample",
327            "ArgMin",
328            "ArgMax",
329        ]
330
331        FUNC_TOKENS = {
332            *parser.Parser.FUNC_TOKENS,
333            TokenType.SET,
334        }
335
336        RESERVED_TOKENS = parser.Parser.RESERVED_TOKENS - {TokenType.SELECT}
337
338        ID_VAR_TOKENS = {
339            *parser.Parser.ID_VAR_TOKENS,
340            TokenType.LIKE,
341        }
342
343        AGG_FUNC_MAPPING = (
344            lambda functions, suffixes: {
345                f"{f}{sfx}": (f, sfx) for sfx in (suffixes + [""]) for f in functions
346            }
347        )(AGG_FUNCTIONS, AGG_FUNCTIONS_SUFFIXES)
348
349        FUNCTIONS_WITH_ALIASED_ARGS = {*parser.Parser.FUNCTIONS_WITH_ALIASED_ARGS, "TUPLE"}
350
351        FUNCTION_PARSERS = {
352            **parser.Parser.FUNCTION_PARSERS,
353            "ARRAYJOIN": lambda self: self.expression(exp.Explode, this=self._parse_expression()),
354            "QUANTILE": lambda self: self._parse_quantile(),
355        }
356
357        FUNCTION_PARSERS.pop("MATCH")
358
359        NO_PAREN_FUNCTION_PARSERS = parser.Parser.NO_PAREN_FUNCTION_PARSERS.copy()
360        NO_PAREN_FUNCTION_PARSERS.pop("ANY")
361
362        RANGE_PARSERS = {
363            **parser.Parser.RANGE_PARSERS,
364            TokenType.GLOBAL: lambda self, this: self._match(TokenType.IN)
365            and self._parse_in(this, is_global=True),
366        }
367
368        # The PLACEHOLDER entry is popped because 1) it doesn't affect Clickhouse (it corresponds to
369        # the postgres-specific JSONBContains parser) and 2) it makes parsing the ternary op simpler.
370        COLUMN_OPERATORS = parser.Parser.COLUMN_OPERATORS.copy()
371        COLUMN_OPERATORS.pop(TokenType.PLACEHOLDER)
372
373        JOIN_KINDS = {
374            *parser.Parser.JOIN_KINDS,
375            TokenType.ANY,
376            TokenType.ASOF,
377            TokenType.ARRAY,
378        }
379
380        TABLE_ALIAS_TOKENS = parser.Parser.TABLE_ALIAS_TOKENS - {
381            TokenType.ANY,
382            TokenType.ARRAY,
383            TokenType.FINAL,
384            TokenType.FORMAT,
385            TokenType.SETTINGS,
386        }
387
388        ALIAS_TOKENS = parser.Parser.ALIAS_TOKENS - {
389            TokenType.FORMAT,
390        }
391
392        LOG_DEFAULTS_TO_LN = True
393
394        QUERY_MODIFIER_PARSERS = {
395            **parser.Parser.QUERY_MODIFIER_PARSERS,
396            TokenType.SETTINGS: lambda self: (
397                "settings",
398                self._advance() or self._parse_csv(self._parse_assignment),
399            ),
400            TokenType.FORMAT: lambda self: ("format", self._advance() or self._parse_id_var()),
401        }
402
403        CONSTRAINT_PARSERS = {
404            **parser.Parser.CONSTRAINT_PARSERS,
405            "INDEX": lambda self: self._parse_index_constraint(),
406            "CODEC": lambda self: self._parse_compress(),
407        }
408
409        ALTER_PARSERS = {
410            **parser.Parser.ALTER_PARSERS,
411            "REPLACE": lambda self: self._parse_alter_table_replace(),
412        }
413
414        SCHEMA_UNNAMED_CONSTRAINTS = {
415            *parser.Parser.SCHEMA_UNNAMED_CONSTRAINTS,
416            "INDEX",
417        }
418
419        def _parse_extract(self) -> exp.Extract | exp.Anonymous:
420            index = self._index
421            this = self._parse_bitwise()
422            if self._match(TokenType.FROM):
423                self._retreat(index)
424                return super()._parse_extract()
425
426            # We return Anonymous here because extract and regexpExtract have different semantics,
427            # so parsing extract(foo, bar) into RegexpExtract can potentially break queries. E.g.,
428            # `extract('foobar', 'b')` works, but CH crashes for `regexpExtract('foobar', 'b')`.
429            #
430            # TODO: can we somehow convert the former into an equivalent `regexpExtract` call?
431            self._match(TokenType.COMMA)
432            return self.expression(
433                exp.Anonymous, this="extract", expressions=[this, self._parse_bitwise()]
434            )
435
436        def _parse_assignment(self) -> t.Optional[exp.Expression]:
437            this = super()._parse_assignment()
438
439            if self._match(TokenType.PLACEHOLDER):
440                return self.expression(
441                    exp.If,
442                    this=this,
443                    true=self._parse_assignment(),
444                    false=self._match(TokenType.COLON) and self._parse_assignment(),
445                )
446
447            return this
448
449        def _parse_placeholder(self) -> t.Optional[exp.Expression]:
450            """
451            Parse a placeholder expression like SELECT {abc: UInt32} or FROM {table: Identifier}
452            https://clickhouse.com/docs/en/sql-reference/syntax#defining-and-using-query-parameters
453            """
454            if not self._match(TokenType.L_BRACE):
455                return None
456
457            this = self._parse_id_var()
458            self._match(TokenType.COLON)
459            kind = self._parse_types(check_func=False, allow_identifiers=False) or (
460                self._match_text_seq("IDENTIFIER") and "Identifier"
461            )
462
463            if not kind:
464                self.raise_error("Expecting a placeholder type or 'Identifier' for tables")
465            elif not self._match(TokenType.R_BRACE):
466                self.raise_error("Expecting }")
467
468            return self.expression(exp.Placeholder, this=this, kind=kind)
469
470        def _parse_in(self, this: t.Optional[exp.Expression], is_global: bool = False) -> exp.In:
471            this = super()._parse_in(this)
472            this.set("is_global", is_global)
473            return this
474
475        def _parse_table(
476            self,
477            schema: bool = False,
478            joins: bool = False,
479            alias_tokens: t.Optional[t.Collection[TokenType]] = None,
480            parse_bracket: bool = False,
481            is_db_reference: bool = False,
482            parse_partition: bool = False,
483        ) -> t.Optional[exp.Expression]:
484            this = super()._parse_table(
485                schema=schema,
486                joins=joins,
487                alias_tokens=alias_tokens,
488                parse_bracket=parse_bracket,
489                is_db_reference=is_db_reference,
490            )
491
492            if self._match(TokenType.FINAL):
493                this = self.expression(exp.Final, this=this)
494
495            return this
496
497        def _parse_position(self, haystack_first: bool = False) -> exp.StrPosition:
498            return super()._parse_position(haystack_first=True)
499
500        # https://clickhouse.com/docs/en/sql-reference/statements/select/with/
501        def _parse_cte(self) -> exp.CTE:
502            # WITH <identifier> AS <subquery expression>
503            cte: t.Optional[exp.CTE] = self._try_parse(super()._parse_cte)
504
505            if not cte:
506                # WITH <expression> AS <identifier>
507                cte = self.expression(
508                    exp.CTE,
509                    this=self._parse_assignment(),
510                    alias=self._parse_table_alias(),
511                    scalar=True,
512                )
513
514            return cte
515
516        def _parse_join_parts(
517            self,
518        ) -> t.Tuple[t.Optional[Token], t.Optional[Token], t.Optional[Token]]:
519            is_global = self._match(TokenType.GLOBAL) and self._prev
520            kind_pre = self._match_set(self.JOIN_KINDS, advance=False) and self._prev
521
522            if kind_pre:
523                kind = self._match_set(self.JOIN_KINDS) and self._prev
524                side = self._match_set(self.JOIN_SIDES) and self._prev
525                return is_global, side, kind
526
527            return (
528                is_global,
529                self._match_set(self.JOIN_SIDES) and self._prev,
530                self._match_set(self.JOIN_KINDS) and self._prev,
531            )
532
533        def _parse_join(
534            self, skip_join_token: bool = False, parse_bracket: bool = False
535        ) -> t.Optional[exp.Join]:
536            join = super()._parse_join(skip_join_token=skip_join_token, parse_bracket=True)
537            if join:
538                join.set("global", join.args.pop("method", None))
539
540            return join
541
542        def _parse_function(
543            self,
544            functions: t.Optional[t.Dict[str, t.Callable]] = None,
545            anonymous: bool = False,
546            optional_parens: bool = True,
547            any_token: bool = False,
548        ) -> t.Optional[exp.Expression]:
549            expr = super()._parse_function(
550                functions=functions,
551                anonymous=anonymous,
552                optional_parens=optional_parens,
553                any_token=any_token,
554            )
555
556            func = expr.this if isinstance(expr, exp.Window) else expr
557
558            # Aggregate functions can be split in 2 parts: <func_name><suffix>
559            parts = (
560                self.AGG_FUNC_MAPPING.get(func.this) if isinstance(func, exp.Anonymous) else None
561            )
562
563            if parts:
564                params = self._parse_func_params(func)
565
566                kwargs = {
567                    "this": func.this,
568                    "expressions": func.expressions,
569                }
570                if parts[1]:
571                    kwargs["parts"] = parts
572                    exp_class = exp.CombinedParameterizedAgg if params else exp.CombinedAggFunc
573                else:
574                    exp_class = exp.ParameterizedAgg if params else exp.AnonymousAggFunc
575
576                kwargs["exp_class"] = exp_class
577                if params:
578                    kwargs["params"] = params
579
580                func = self.expression(**kwargs)
581
582                if isinstance(expr, exp.Window):
583                    # The window's func was parsed as Anonymous in base parser, fix its
584                    # type to be CH style CombinedAnonymousAggFunc / AnonymousAggFunc
585                    expr.set("this", func)
586                elif params:
587                    # Params have blocked super()._parse_function() from parsing the following window
588                    # (if that exists) as they're standing between the function call and the window spec
589                    expr = self._parse_window(func)
590                else:
591                    expr = func
592
593            return expr
594
595        def _parse_func_params(
596            self, this: t.Optional[exp.Func] = None
597        ) -> t.Optional[t.List[exp.Expression]]:
598            if self._match_pair(TokenType.R_PAREN, TokenType.L_PAREN):
599                return self._parse_csv(self._parse_lambda)
600
601            if self._match(TokenType.L_PAREN):
602                params = self._parse_csv(self._parse_lambda)
603                self._match_r_paren(this)
604                return params
605
606            return None
607
608        def _parse_quantile(self) -> exp.Quantile:
609            this = self._parse_lambda()
610            params = self._parse_func_params()
611            if params:
612                return self.expression(exp.Quantile, this=params[0], quantile=this)
613            return self.expression(exp.Quantile, this=this, quantile=exp.Literal.number(0.5))
614
615        def _parse_wrapped_id_vars(self, optional: bool = False) -> t.List[exp.Expression]:
616            return super()._parse_wrapped_id_vars(optional=True)
617
618        def _parse_primary_key(
619            self, wrapped_optional: bool = False, in_props: bool = False
620        ) -> exp.PrimaryKeyColumnConstraint | exp.PrimaryKey:
621            return super()._parse_primary_key(
622                wrapped_optional=wrapped_optional or in_props, in_props=in_props
623            )
624
625        def _parse_on_property(self) -> t.Optional[exp.Expression]:
626            index = self._index
627            if self._match_text_seq("CLUSTER"):
628                this = self._parse_id_var()
629                if this:
630                    return self.expression(exp.OnCluster, this=this)
631                else:
632                    self._retreat(index)
633            return None
634
635        def _parse_index_constraint(
636            self, kind: t.Optional[str] = None
637        ) -> exp.IndexColumnConstraint:
638            # INDEX name1 expr TYPE type1(args) GRANULARITY value
639            this = self._parse_id_var()
640            expression = self._parse_assignment()
641
642            index_type = self._match_text_seq("TYPE") and (
643                self._parse_function() or self._parse_var()
644            )
645
646            granularity = self._match_text_seq("GRANULARITY") and self._parse_term()
647
648            return self.expression(
649                exp.IndexColumnConstraint,
650                this=this,
651                expression=expression,
652                index_type=index_type,
653                granularity=granularity,
654            )
655
656        def _parse_partition(self) -> t.Optional[exp.Partition]:
657            # https://clickhouse.com/docs/en/sql-reference/statements/alter/partition#how-to-set-partition-expression
658            if not self._match(TokenType.PARTITION):
659                return None
660
661            if self._match_text_seq("ID"):
662                # Corresponds to the PARTITION ID <string_value> syntax
663                expressions: t.List[exp.Expression] = [
664                    self.expression(exp.PartitionId, this=self._parse_string())
665                ]
666            else:
667                expressions = self._parse_expressions()
668
669            return self.expression(exp.Partition, expressions=expressions)
670
671        def _parse_alter_table_replace(self) -> t.Optional[exp.Expression]:
672            partition = self._parse_partition()
673
674            if not partition or not self._match(TokenType.FROM):
675                return None
676
677            return self.expression(
678                exp.ReplacePartition, expression=partition, source=self._parse_table_parts()
679            )
680
681        def _parse_projection_def(self) -> t.Optional[exp.ProjectionDef]:
682            if not self._match_text_seq("PROJECTION"):
683                return None
684
685            return self.expression(
686                exp.ProjectionDef,
687                this=self._parse_id_var(),
688                expression=self._parse_wrapped(self._parse_statement),
689            )
690
691        def _parse_constraint(self) -> t.Optional[exp.Expression]:
692            return super()._parse_constraint() or self._parse_projection_def()

Parser consumes a list of tokens produced by the Tokenizer and produces a parsed syntax tree.

Arguments:
  • error_level: The desired error level. Default: ErrorLevel.IMMEDIATE
  • error_message_context: The amount of context to capture from a query string when displaying the error message (in number of characters). Default: 100
  • max_errors: Maximum number of error messages to include in a raised ParseError. This is only relevant if error_level is ErrorLevel.RAISE. Default: 3
MODIFIERS_ATTACHED_TO_SET_OP = False
INTERVAL_SPANS = False
FUNCTIONS = {'ABS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Abs'>>, 'ADD_MONTHS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.AddMonths'>>, 'ANONYMOUS_AGG_FUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.AnonymousAggFunc'>>, 'ANY_VALUE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.AnyValue'>>, 'APPROX_DISTINCT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxDistinct'>>, 'APPROX_COUNT_DISTINCT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxDistinct'>>, 'APPROX_QUANTILE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxQuantile'>>, 'APPROX_TOP_K': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxTopK'>>, 'ARG_MAX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMax'>>, 'ARGMAX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMax'>>, 'MAX_BY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMax'>>, 'ARG_MIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMin'>>, 'ARGMIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMin'>>, 'MIN_BY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMin'>>, 'ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Array'>>, 'ARRAY_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayAgg'>>, 'ARRAY_ALL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayAll'>>, 'ARRAY_ANY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayAny'>>, 'ARRAY_CONCAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayConcat'>>, 'ARRAY_CAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayConcat'>>, 'ARRAY_CONSTRUCT_COMPACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayConstructCompact'>>, 'ARRAY_CONTAINS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayContains'>>, 'ARRAY_HAS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayContains'>>, 'ARRAY_CONTAINS_ALL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayContainsAll'>>, 'ARRAY_HAS_ALL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayContainsAll'>>, 'FILTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayFilter'>>, 'ARRAY_FILTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayFilter'>>, 'ARRAY_OVERLAPS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayOverlaps'>>, 'ARRAY_SIZE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySize'>>, 'ARRAY_LENGTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySize'>>, 'ARRAY_SORT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySort'>>, 'ARRAY_SUM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySum'>>, 'ARRAY_TO_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayToString'>>, 'ARRAY_JOIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayToString'>>, 'ARRAY_UNION_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayUnionAgg'>>, 'ARRAY_UNIQUE_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayUniqueAgg'>>, 'AVG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Avg'>>, 'CASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Case'>>, 'CAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Cast'>>, 'CAST_TO_STR_TYPE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CastToStrType'>>, 'CBRT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Cbrt'>>, 'CEIL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Ceil'>>, 'CEILING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Ceil'>>, 'CHR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Chr'>>, 'CHAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Chr'>>, 'COALESCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Coalesce'>>, 'IFNULL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Coalesce'>>, 'NVL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Coalesce'>>, 'COLLATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Collate'>>, 'COMBINED_AGG_FUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CombinedAggFunc'>>, 'COMBINED_PARAMETERIZED_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CombinedParameterizedAgg'>>, 'CONCAT': <function Parser.<lambda>>, 'CONCAT_WS': <function Parser.<lambda>>, 'CONNECT_BY_ROOT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ConnectByRoot'>>, 'CONVERT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Convert'>>, 'CORR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Corr'>>, 'COUNT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Count'>>, 'COUNT_IF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CountIf'>>, 'COUNTIF': <function _build_count_if>, 'COVAR_POP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CovarPop'>>, 'COVAR_SAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CovarSamp'>>, 'CURRENT_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentDate'>>, 'CURRENT_DATETIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentDatetime'>>, 'CURRENT_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentTime'>>, 'CURRENT_TIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentTimestamp'>>, 'CURRENT_USER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentUser'>>, 'DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Date'>>, 'DATE_ADD': <function build_date_delta.<locals>._builder>, 'DATEDIFF': <function build_date_delta.<locals>._builder>, 'DATE_DIFF': <function build_date_delta.<locals>._builder>, 'DATE_FROM_PARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateFromParts'>>, 'DATEFROMPARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateFromParts'>>, 'DATE_STR_TO_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateStrToDate'>>, 'DATE_SUB': <function build_date_delta.<locals>._builder>, 'DATE_TO_DATE_STR': <function Parser.<lambda>>, 'DATE_TO_DI': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateToDi'>>, 'DATE_TRUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateTrunc'>>, 'DATETIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Datetime'>>, 'DATETIME_ADD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DatetimeAdd'>>, 'DATETIME_DIFF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DatetimeDiff'>>, 'DATETIME_SUB': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DatetimeSub'>>, 'DATETIME_TRUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DatetimeTrunc'>>, 'DAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Day'>>, 'DAY_OF_MONTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfMonth'>>, 'DAYOFMONTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfMonth'>>, 'DAY_OF_WEEK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfWeek'>>, 'DAYOFWEEK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfWeek'>>, 'DAY_OF_YEAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfYear'>>, 'DAYOFYEAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfYear'>>, 'DECODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Decode'>>, 'DI_TO_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DiToDate'>>, 'ENCODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Encode'>>, 'EXP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Exp'>>, 'EXPLODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Explode'>>, 'EXPLODE_OUTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ExplodeOuter'>>, 'EXTRACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Extract'>>, 'FIRST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.First'>>, 'FIRST_VALUE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FirstValue'>>, 'FLATTEN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Flatten'>>, 'FLOOR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Floor'>>, 'FROM_BASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FromBase'>>, 'FROM_BASE64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FromBase64'>>, 'GAP_FILL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GapFill'>>, 'GENERATE_DATE_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GenerateDateArray'>>, 'GENERATE_SERIES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GenerateSeries'>>, 'GREATEST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Greatest'>>, 'GROUP_CONCAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GroupConcat'>>, 'HEX': <function build_hex>, 'HLL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Hll'>>, 'IF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.If'>>, 'IIF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.If'>>, 'INITCAP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Initcap'>>, 'IS_INF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.IsInf'>>, 'ISINF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.IsInf'>>, 'IS_NAN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.IsNan'>>, 'ISNAN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.IsNan'>>, 'J_S_O_N_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONArray'>>, 'J_S_O_N_ARRAY_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONArrayAgg'>>, 'JSON_ARRAY_CONTAINS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONArrayContains'>>, 'JSONB_CONTAINS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBContains'>>, 'JSONB_EXTRACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBExtract'>>, 'JSONB_EXTRACT_SCALAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBExtractScalar'>>, 'JSON_EXTRACT': <function build_extract_json_with_path.<locals>._builder>, 'JSON_EXTRACT_SCALAR': <function build_extract_json_with_path.<locals>._builder>, 'JSON_FORMAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONFormat'>>, 'J_S_O_N_OBJECT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONObject'>>, 'J_S_O_N_OBJECT_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONObjectAgg'>>, 'J_S_O_N_TABLE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONTable'>>, 'LAG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Lag'>>, 'LAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Last'>>, 'LAST_DAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LastDay'>>, 'LAST_DAY_OF_MONTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LastDay'>>, 'LAST_VALUE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LastValue'>>, 'LEAD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Lead'>>, 'LEAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Least'>>, 'LEFT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Left'>>, 'LENGTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Length'>>, 'LEN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Length'>>, 'LEVENSHTEIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Levenshtein'>>, 'LIST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.List'>>, 'LN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Ln'>>, 'LOG': <function build_logarithm>, 'LOGICAL_AND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalAnd'>>, 'BOOL_AND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalAnd'>>, 'BOOLAND_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalAnd'>>, 'LOGICAL_OR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalOr'>>, 'BOOL_OR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalOr'>>, 'BOOLOR_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalOr'>>, 'LOWER': <function build_lower>, 'LCASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Lower'>>, 'LOWER_HEX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LowerHex'>>, 'MD5': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MD5Digest'>>, 'MD5_DIGEST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MD5Digest'>>, 'MAP': <function build_var_map>, 'MAP_FROM_ENTRIES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MapFromEntries'>>, 'MATCH_AGAINST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MatchAgainst'>>, 'MAX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Max'>>, 'MIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Min'>>, 'MONTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Month'>>, 'MONTHS_BETWEEN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MonthsBetween'>>, 'NEXT_VALUE_FOR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.NextValueFor'>>, 'NTH_VALUE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.NthValue'>>, 'NULLIF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Nullif'>>, 'NUMBER_TO_STR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.NumberToStr'>>, 'NVL2': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Nvl2'>>, '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'>>, 'PAD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Pad'>>, 'PARAMETERIZED_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParameterizedAgg'>>, 'PARSE_JSON': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseJSON'>>, 'JSON_PARSE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseJSON'>>, 'PERCENTILE_CONT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.PercentileCont'>>, 'PERCENTILE_DISC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.PercentileDisc'>>, 'POSEXPLODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Posexplode'>>, 'POSEXPLODE_OUTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.PosexplodeOuter'>>, 'POWER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Pow'>>, 'POW': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Pow'>>, 'PREDICT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Predict'>>, 'QUANTILE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Quantile'>>, 'QUARTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Quarter'>>, 'RAND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Rand'>>, 'RANDOM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Rand'>>, 'RANDN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Randn'>>, 'RANGE_N': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RangeN'>>, 'READ_CSV': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ReadCSV'>>, 'REDUCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Reduce'>>, 'REGEXP_EXTRACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpExtract'>>, 'REGEXP_I_LIKE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpILike'>>, 'REGEXP_LIKE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpLike'>>, 'REGEXP_REPLACE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpReplace'>>, 'REGEXP_SPLIT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpSplit'>>, 'REPEAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Repeat'>>, 'RIGHT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Right'>>, 'ROUND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Round'>>, 'ROW_NUMBER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RowNumber'>>, 'SHA': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SHA'>>, 'SHA1': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SHA'>>, 'SHA2': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SHA2'>>, 'SAFE_DIVIDE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SafeDivide'>>, 'SIGN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sign'>>, 'SIGNUM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sign'>>, 'SORT_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SortArray'>>, 'SPLIT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Split'>>, 'SQRT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sqrt'>>, 'STANDARD_HASH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StandardHash'>>, 'STAR_MAP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StarMap'>>, 'STARTS_WITH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StartsWith'>>, 'STARTSWITH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StartsWith'>>, 'STDDEV': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Stddev'>>, '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': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrToDate'>>, 'STR_TO_MAP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrToMap'>>, 'STR_TO_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrToTime'>>, 'STR_TO_UNIX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrToUnix'>>, 'STRING_TO_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StringToArray'>>, 'SPLIT_BY_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StringToArray'>>, 'STRUCT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Struct'>>, 'STRUCT_EXTRACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StructExtract'>>, 'STUFF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Stuff'>>, 'INSERT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Stuff'>>, 'SUBSTRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Substring'>>, 'SUM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sum'>>, 'TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Time'>>, 'TIME_ADD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeAdd'>>, 'TIME_DIFF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeDiff'>>, 'TIME_FROM_PARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeFromParts'>>, 'TIMEFROMPARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeFromParts'>>, 'TIME_STR_TO_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeStrToDate'>>, 'TIME_STR_TO_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeStrToTime'>>, 'TIME_STR_TO_UNIX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeStrToUnix'>>, 'TIME_SUB': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeSub'>>, 'TIME_TO_STR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeToStr'>>, 'TIME_TO_TIME_STR': <function Parser.<lambda>>, 'TIME_TO_UNIX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeToUnix'>>, 'TIME_TRUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeTrunc'>>, 'TIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Timestamp'>>, 'TIMESTAMP_ADD': <function build_date_delta.<locals>._builder>, 'TIMESTAMPDIFF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampDiff'>>, 'TIMESTAMP_DIFF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampDiff'>>, 'TIMESTAMP_FROM_PARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampFromParts'>>, 'TIMESTAMPFROMPARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampFromParts'>>, 'TIMESTAMP_SUB': <function build_date_delta.<locals>._builder>, 'TIMESTAMP_TRUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampTrunc'>>, 'TO_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToArray'>>, 'TO_BASE64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToBase64'>>, 'TO_CHAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToChar'>>, 'TO_DAYS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToDays'>>, 'TO_MAP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToMap'>>, 'TO_NUMBER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToNumber'>>, 'TRANSFORM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Transform'>>, 'TRIM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Trim'>>, 'TRY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Try'>>, 'TRY_CAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TryCast'>>, 'TS_OR_DI_TO_DI': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDiToDi'>>, 'TS_OR_DS_ADD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsAdd'>>, 'TS_OR_DS_DIFF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsDiff'>>, 'TS_OR_DS_TO_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsToDate'>>, 'TS_OR_DS_TO_DATE_STR': <function Parser.<lambda>>, 'TS_OR_DS_TO_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsToTime'>>, 'TS_OR_DS_TO_TIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsToTimestamp'>>, 'UNHEX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Unhex'>>, 'UNIX_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixDate'>>, 'UNIX_TO_STR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixToStr'>>, 'UNIX_TO_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixToTime'>>, 'UNIX_TO_TIME_STR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixToTimeStr'>>, 'UNNEST': <function Parser.<lambda>>, 'UPPER': <function build_upper>, 'UCASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Upper'>>, 'VAR_MAP': <function build_var_map>, 'VARIANCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Variance'>>, 'VARIANCE_SAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Variance'>>, 'VAR_SAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Variance'>>, 'VARIANCE_POP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.VariancePop'>>, 'VAR_POP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.VariancePop'>>, 'WEEK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Week'>>, 'WEEK_OF_YEAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.WeekOfYear'>>, 'WEEKOFYEAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.WeekOfYear'>>, 'WHEN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.When'>>, 'X_M_L_TABLE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.XMLTable'>>, 'XOR': <function ClickHouse.Parser.<lambda>>, 'YEAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Year'>>, 'GLOB': <function Parser.<lambda>>, 'JSON_EXTRACT_PATH_TEXT': <function build_extract_json_with_path.<locals>._builder>, 'LIKE': <function build_like>, 'LOG2': <function Parser.<lambda>>, 'LOG10': <function Parser.<lambda>>, 'LPAD': <function Parser.<lambda>>, 'LEFTPAD': <function Parser.<lambda>>, 'MOD': <function build_mod>, 'RPAD': <function Parser.<lambda>>, 'RIGHTPAD': <function Parser.<lambda>>, 'SCOPE_RESOLUTION': <function Parser.<lambda>>, 'TO_HEX': <function build_hex>, 'ANY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.AnyValue'>>, 'ARRAYSUM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySum'>>, 'DATEADD': <function build_date_delta.<locals>._builder>, 'DATE_FORMAT': <function _build_date_format>, 'DATESUB': <function build_date_delta.<locals>._builder>, 'FORMATDATETIME': <function _build_date_format>, 'JSONEXTRACTSTRING': <function build_json_extract_path.<locals>._builder>, 'MATCH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpLike'>>, 'RANDCANONICAL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Rand'>>, 'TUPLE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Struct'>>, 'TIMESTAMPSUB': <function build_date_delta.<locals>._builder>, 'TIMESTAMPADD': <function build_date_delta.<locals>._builder>, 'UNIQ': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxDistinct'>>, 'SHA256': <function ClickHouse.Parser.<lambda>>, 'SHA512': <function ClickHouse.Parser.<lambda>>}
AGG_FUNCTIONS = {'any', 'uniqUpTo', 'uniqCombined64', 'minMap', 'sumCount', 'topKWeighted', 'quantileTimingWeighted', 'quantilesExact', 'groupArray', 'sumWithOverflow', 'kurtPop', 'min', 'quantiles', 'quantile', 'quantileExactLow', 'groupArrayInsertAt', 'sumKahan', 'covarSamp', 'groupArrayMovingSum', 'theilsU', 'groupArrayLast', 'histogram', 'skewPop', 'quantileBFloat16', 'maxIntersectionsPosition', 'quantileExactWeighted', 'welchTTest', 'kolmogorovSmirnovTest', 'uniqExact', 'simpleLinearRegression', 'groupArrayMovingAvg', 'deltaSumTimestamp', 'cramersVBiasCorrected', 'exponentialTimeDecayedAvg', 'quantilesGK', 'sequenceCount', 'skewSamp', 'avg', 'avgWeighted', 'sequenceMatch', 'kurtSamp', 'uniqHLL12', 'quantilesDeterministic', 'cramersV', 'entropy', 'studentTTest', 'median', 'contingency', 'quantilesExactWeighted', 'quantilesTDigest', 'categoricalInformationValue', 'windowFunnel', 'exponentialMovingAverage', 'argMin', 'topK', 'quantileDeterministic', 'max', 'anyHeavy', 'quantileExact', 'quantilesTimingWeighted', 'quantilesTiming', 'anyLast', 'sum', 'rankCorr', 'sequenceNextNode', 'uniq', 'quantilesExactLow', 'stddevSamp', 'quantileBFloat16Weighted', 'quantilesTDigestWeighted', 'uniqTheta', 'maxMap', 'quantilesExactHigh', 'varPop', 'sparkBar', 'stochasticLogisticRegression', 'quantilesBFloat16', 'last_value', 'quantileExactHigh', 'mannWhitneyUTest', 'stochasticLinearRegression', 'groupUniqArray', 'maxIntersections', 'intervalLengthSum', 'groupBitOr', 'count', 'quantilesBFloat16Weighted', 'deltaSum', 'quantileGK', 'meanZTest', 'groupArraySample', 'covarPop', 'sumMap', 'argMax', 'quantileTDigest', 'corr', 'groupBitmapOr', 'quantilesInterpolatedWeighted', 'largestTriangleThreeBuckets', 'groupBitmap', 'quantileTiming', 'retention', 'groupBitAnd', 'first_value', 'quantileInterpolatedWeighted', 'uniqCombined', 'varSamp', 'stddevPop', 'groupBitmapAnd', 'groupBitmapXor', 'quantileTDigestWeighted', 'boundingRatio', 'groupBitXor'}
AGG_FUNCTIONS_SUFFIXES = ['If', 'Array', 'ArrayIf', 'Map', 'SimpleState', 'State', 'Merge', 'MergeState', 'ForEach', 'Distinct', 'OrDefault', 'OrNull', 'Resample', 'ArgMin', 'ArgMax']
FUNC_TOKENS = {<TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.PRIMARY_KEY: 'PRIMARY_KEY'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.TIME: 'TIME'>, <TokenType.INT256: 'INT256'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.GLOB: 'GLOB'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.FILTER: 'FILTER'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.NESTED: 'NESTED'>, <TokenType.UINT128: 'UINT128'>, <TokenType.INSERT: 'INSERT'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.IPV6: 'IPV6'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.BINARY: 'BINARY'>, <TokenType.WINDOW: 'WINDOW'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.ROW: 'ROW'>, <TokenType.TEXT: 'TEXT'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.INDEX: 'INDEX'>, <TokenType.IPV4: 'IPV4'>, <TokenType.INT128: 'INT128'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.TABLE: 'TABLE'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.LIST: 'LIST'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.ALL: 'ALL'>, <TokenType.MAP: 'MAP'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.NULL: 'NULL'>, <TokenType.LEFT: 'LEFT'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.MONEY: 'MONEY'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.LIKE: 'LIKE'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.SUPER: 'SUPER'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.CHAR: 'CHAR'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.UINT: 'UINT'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.SOME: 'SOME'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.ILIKE: 'ILIKE'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.RANGE: 'RANGE'>, <TokenType.FIRST: 'FIRST'>, <TokenType.UUID: 'UUID'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.MERGE: 'MERGE'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.VAR: 'VAR'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.NAME: 'NAME'>, <TokenType.JSON: 'JSON'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.YEAR: 'YEAR'>, <TokenType.XML: 'XML'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.DATE32: 'DATE32'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.JSONB: 'JSONB'>, <TokenType.BIT: 'BIT'>, <TokenType.FORMAT: 'FORMAT'>, <TokenType.UNIQUEIDENTIFIER: 'UNIQUEIDENTIFIER'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.RIGHT: 'RIGHT'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.RLIKE: 'RLIKE'>, <TokenType.UINT256: 'UINT256'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.XOR: 'XOR'>, <TokenType.INT: 'INT'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.INET: 'INET'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.ANY: 'ANY'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.ENUM: 'ENUM'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.SET: 'SET'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.DATE: 'DATE'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>}
RESERVED_TOKENS = {<TokenType.SEMICOLON: 'SEMICOLON'>, <TokenType.SLASH: 'SLASH'>, <TokenType.L_BRACKET: 'L_BRACKET'>, <TokenType.PLUS: 'PLUS'>, <TokenType.DASH: 'DASH'>, <TokenType.PLACEHOLDER: 'PLACEHOLDER'>, <TokenType.R_BRACKET: 'R_BRACKET'>, <TokenType.TILDA: 'TILDA'>, <TokenType.R_PAREN: 'R_PAREN'>, <TokenType.DOT: 'DOT'>, <TokenType.R_BRACE: 'R_BRACE'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.LT: 'LT'>, <TokenType.CARET: 'CARET'>, <TokenType.COMMA: 'COMMA'>, <TokenType.L_BRACE: 'L_BRACE'>, <TokenType.L_PAREN: 'L_PAREN'>, <TokenType.GT: 'GT'>, <TokenType.STAR: 'STAR'>, <TokenType.MOD: 'MOD'>, <TokenType.EQ: 'EQ'>, <TokenType.NOT: 'NOT'>, <TokenType.PIPE: 'PIPE'>, <TokenType.BACKSLASH: 'BACKSLASH'>, <TokenType.COLON: 'COLON'>, <TokenType.PARAMETER: 'PARAMETER'>, <TokenType.AMP: 'AMP'>, <TokenType.HASH: 'HASH'>}
ID_VAR_TOKENS = {<TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.FINAL: 'FINAL'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.TAG: 'TAG'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.TIME: 'TIME'>, <TokenType.COPY: 'COPY'>, <TokenType.DELETE: 'DELETE'>, <TokenType.ASOF: 'ASOF'>, <TokenType.INT256: 'INT256'>, <TokenType.TRUE: 'TRUE'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.ANTI: 'ANTI'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.FILTER: 'FILTER'>, <TokenType.CACHE: 'CACHE'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.ROWS: 'ROWS'>, <TokenType.NESTED: 'NESTED'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.KEEP: 'KEEP'>, <TokenType.CASE: 'CASE'>, <TokenType.KILL: 'KILL'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.UINT128: 'UINT128'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.STREAMLIT: 'STREAMLIT'>, <TokenType.IPV6: 'IPV6'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.WINDOW: 'WINDOW'>, <TokenType.BINARY: 'BINARY'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.ROW: 'ROW'>, <TokenType.TEXT: 'TEXT'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.USE: 'USE'>, <TokenType.INDEX: 'INDEX'>, <TokenType.IPV4: 'IPV4'>, <TokenType.INT128: 'INT128'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.TABLE: 'TABLE'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.SETTINGS: 'SETTINGS'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.STRAIGHT_JOIN: 'STRAIGHT_JOIN'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.LIST: 'LIST'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.ALL: 'ALL'>, <TokenType.MAP: 'MAP'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.NULL: 'NULL'>, <TokenType.LEFT: 'LEFT'>, <TokenType.SEMI: 'SEMI'>, <TokenType.ROLLUP: 'ROLLUP'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.MONEY: 'MONEY'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.NATURAL: 'NATURAL'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.VIEW: 'VIEW'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.NEXT: 'NEXT'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.LIKE: 'LIKE'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.ORDINALITY: 'ORDINALITY'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.SUPER: 'SUPER'>, <TokenType.END: 'END'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.CHAR: 'CHAR'>, <TokenType.WAREHOUSE: 'WAREHOUSE'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.UINT: 'UINT'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.TOP: 'TOP'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.SOME: 'SOME'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.DESC: 'DESC'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.RANGE: 'RANGE'>, <TokenType.FIRST: 'FIRST'>, <TokenType.UUID: 'UUID'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.MODEL: 'MODEL'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.MERGE: 'MERGE'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.VAR: 'VAR'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.NAME: 'NAME'>, <TokenType.JSON: 'JSON'>, <TokenType.FULL: 'FULL'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.IS: 'IS'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.YEAR: 'YEAR'>, <TokenType.XML: 'XML'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.DATE32: 'DATE32'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.JSONB: 'JSONB'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.BIT: 'BIT'>, <TokenType.FORMAT: 'FORMAT'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.UNIQUEIDENTIFIER: 'UNIQUEIDENTIFIER'>, <TokenType.APPLY: 'APPLY'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.LOAD: 'LOAD'>, <TokenType.RIGHT: 'RIGHT'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.UINT256: 'UINT256'>, <TokenType.DIV: 'DIV'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.SHOW: 'SHOW'>, <TokenType.ASC: 'ASC'>, <TokenType.INT: 'INT'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.INET: 'INET'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.ANY: 'ANY'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.REFERENCES: 'REFERENCES'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.FALSE: 'FALSE'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.ENUM: 'ENUM'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.UNIQUE: 'UNIQUE'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.SET: 'SET'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.DATE: 'DATE'>, <TokenType.STORAGE_INTEGRATION: 'STORAGE_INTEGRATION'>, <TokenType.PROCEDURE: 'PROCEDURE'>}
AGG_FUNC_MAPPING = {'anyIf': ('any', 'If'), 'uniqUpToIf': ('uniqUpTo', 'If'), 'uniqCombined64If': ('uniqCombined64', 'If'), 'minMapIf': ('minMap', 'If'), 'sumCountIf': ('sumCount', 'If'), 'topKWeightedIf': ('topKWeighted', 'If'), 'quantileTimingWeightedIf': ('quantileTimingWeighted', 'If'), 'quantilesExactIf': ('quantilesExact', 'If'), 'groupArrayIf': ('groupArray', 'If'), 'sumWithOverflowIf': ('sumWithOverflow', 'If'), 'kurtPopIf': ('kurtPop', 'If'), 'minIf': ('min', 'If'), 'quantilesIf': ('quantiles', 'If'), 'quantileIf': ('quantile', 'If'), 'quantileExactLowIf': ('quantileExactLow', 'If'), 'groupArrayInsertAtIf': ('groupArrayInsertAt', 'If'), 'sumKahanIf': ('sumKahan', 'If'), 'covarSampIf': ('covarSamp', 'If'), 'groupArrayMovingSumIf': ('groupArrayMovingSum', 'If'), 'theilsUIf': ('theilsU', 'If'), 'groupArrayLastIf': ('groupArrayLast', 'If'), 'histogramIf': ('histogram', 'If'), 'skewPopIf': ('skewPop', 'If'), 'quantileBFloat16If': ('quantileBFloat16', 'If'), 'maxIntersectionsPositionIf': ('maxIntersectionsPosition', 'If'), 'quantileExactWeightedIf': ('quantileExactWeighted', 'If'), 'welchTTestIf': ('welchTTest', 'If'), 'kolmogorovSmirnovTestIf': ('kolmogorovSmirnovTest', 'If'), 'uniqExactIf': ('uniqExact', 'If'), 'simpleLinearRegressionIf': ('simpleLinearRegression', 'If'), 'groupArrayMovingAvgIf': ('groupArrayMovingAvg', 'If'), 'deltaSumTimestampIf': ('deltaSumTimestamp', 'If'), 'cramersVBiasCorrectedIf': ('cramersVBiasCorrected', 'If'), 'exponentialTimeDecayedAvgIf': ('exponentialTimeDecayedAvg', 'If'), 'quantilesGKIf': ('quantilesGK', 'If'), 'sequenceCountIf': ('sequenceCount', 'If'), 'skewSampIf': ('skewSamp', 'If'), 'avgIf': ('avg', 'If'), 'avgWeightedIf': ('avgWeighted', 'If'), 'sequenceMatchIf': ('sequenceMatch', 'If'), 'kurtSampIf': ('kurtSamp', 'If'), 'uniqHLL12If': ('uniqHLL12', 'If'), 'quantilesDeterministicIf': ('quantilesDeterministic', 'If'), 'cramersVIf': ('cramersV', 'If'), 'entropyIf': ('entropy', 'If'), 'studentTTestIf': ('studentTTest', 'If'), 'medianIf': ('median', 'If'), 'contingencyIf': ('contingency', 'If'), 'quantilesExactWeightedIf': ('quantilesExactWeighted', 'If'), 'quantilesTDigestIf': ('quantilesTDigest', 'If'), 'categoricalInformationValueIf': ('categoricalInformationValue', 'If'), 'windowFunnelIf': ('windowFunnel', 'If'), 'exponentialMovingAverageIf': ('exponentialMovingAverage', 'If'), 'argMinIf': ('argMin', 'If'), 'topKIf': ('topK', 'If'), 'quantileDeterministicIf': ('quantileDeterministic', 'If'), 'maxIf': ('max', 'If'), 'anyHeavyIf': ('anyHeavy', 'If'), 'quantileExactIf': ('quantileExact', 'If'), 'quantilesTimingWeightedIf': ('quantilesTimingWeighted', 'If'), 'quantilesTimingIf': ('quantilesTiming', 'If'), 'anyLastIf': ('anyLast', 'If'), 'sumIf': ('sum', 'If'), 'rankCorrIf': ('rankCorr', 'If'), 'sequenceNextNodeIf': ('sequenceNextNode', 'If'), 'uniqIf': ('uniq', 'If'), 'quantilesExactLowIf': ('quantilesExactLow', 'If'), 'stddevSampIf': ('stddevSamp', 'If'), 'quantileBFloat16WeightedIf': ('quantileBFloat16Weighted', 'If'), 'quantilesTDigestWeightedIf': ('quantilesTDigestWeighted', 'If'), 'uniqThetaIf': ('uniqTheta', 'If'), 'maxMapIf': ('maxMap', 'If'), 'quantilesExactHighIf': ('quantilesExactHigh', 'If'), 'varPopIf': ('varPop', 'If'), 'sparkBarIf': ('sparkBar', 'If'), 'stochasticLogisticRegressionIf': ('stochasticLogisticRegression', 'If'), 'quantilesBFloat16If': ('quantilesBFloat16', 'If'), 'last_valueIf': ('last_value', 'If'), 'quantileExactHighIf': ('quantileExactHigh', 'If'), 'mannWhitneyUTestIf': ('mannWhitneyUTest', 'If'), 'stochasticLinearRegressionIf': ('stochasticLinearRegression', 'If'), 'groupUniqArrayIf': ('groupUniqArray', 'If'), 'maxIntersectionsIf': ('maxIntersections', 'If'), 'intervalLengthSumIf': ('intervalLengthSum', 'If'), 'groupBitOrIf': ('groupBitOr', 'If'), 'countIf': ('count', 'If'), 'quantilesBFloat16WeightedIf': ('quantilesBFloat16Weighted', 'If'), 'deltaSumIf': ('deltaSum', 'If'), 'quantileGKIf': ('quantileGK', 'If'), 'meanZTestIf': ('meanZTest', 'If'), 'groupArraySampleIf': ('groupArraySample', 'If'), 'covarPopIf': ('covarPop', 'If'), 'sumMapIf': ('sumMap', 'If'), 'argMaxIf': ('argMax', 'If'), 'quantileTDigestIf': ('quantileTDigest', 'If'), 'corrIf': ('corr', 'If'), 'groupBitmapOrIf': ('groupBitmapOr', 'If'), 'quantilesInterpolatedWeightedIf': ('quantilesInterpolatedWeighted', 'If'), 'largestTriangleThreeBucketsIf': ('largestTriangleThreeBuckets', 'If'), 'groupBitmapIf': ('groupBitmap', 'If'), 'quantileTimingIf': ('quantileTiming', 'If'), 'retentionIf': ('retention', 'If'), 'groupBitAndIf': ('groupBitAnd', 'If'), 'first_valueIf': ('first_value', 'If'), 'quantileInterpolatedWeightedIf': ('quantileInterpolatedWeighted', 'If'), 'uniqCombinedIf': ('uniqCombined', 'If'), 'varSampIf': ('varSamp', 'If'), 'stddevPopIf': ('stddevPop', 'If'), 'groupBitmapAndIf': ('groupBitmapAnd', 'If'), 'groupBitmapXorIf': ('groupBitmapXor', 'If'), 'quantileTDigestWeightedIf': ('quantileTDigestWeighted', 'If'), 'boundingRatioIf': ('boundingRatio', 'If'), 'groupBitXorIf': ('groupBitXor', 'If'), 'anyArray': ('any', 'Array'), 'uniqUpToArray': ('uniqUpTo', 'Array'), 'uniqCombined64Array': ('uniqCombined64', 'Array'), 'minMapArray': ('minMap', 'Array'), 'sumCountArray': ('sumCount', 'Array'), 'topKWeightedArray': ('topKWeighted', 'Array'), 'quantileTimingWeightedArray': ('quantileTimingWeighted', 'Array'), 'quantilesExactArray': ('quantilesExact', 'Array'), 'groupArrayArray': ('groupArray', 'Array'), 'sumWithOverflowArray': ('sumWithOverflow', 'Array'), 'kurtPopArray': ('kurtPop', 'Array'), 'minArray': ('min', 'Array'), 'quantilesArray': ('quantiles', 'Array'), 'quantileArray': ('quantile', 'Array'), 'quantileExactLowArray': ('quantileExactLow', 'Array'), 'groupArrayInsertAtArray': ('groupArrayInsertAt', 'Array'), 'sumKahanArray': ('sumKahan', 'Array'), 'covarSampArray': ('covarSamp', 'Array'), 'groupArrayMovingSumArray': ('groupArrayMovingSum', 'Array'), 'theilsUArray': ('theilsU', 'Array'), 'groupArrayLastArray': ('groupArrayLast', 'Array'), 'histogramArray': ('histogram', 'Array'), 'skewPopArray': ('skewPop', 'Array'), 'quantileBFloat16Array': ('quantileBFloat16', 'Array'), 'maxIntersectionsPositionArray': ('maxIntersectionsPosition', 'Array'), 'quantileExactWeightedArray': ('quantileExactWeighted', 'Array'), 'welchTTestArray': ('welchTTest', 'Array'), 'kolmogorovSmirnovTestArray': ('kolmogorovSmirnovTest', 'Array'), 'uniqExactArray': ('uniqExact', 'Array'), 'simpleLinearRegressionArray': ('simpleLinearRegression', 'Array'), 'groupArrayMovingAvgArray': ('groupArrayMovingAvg', 'Array'), 'deltaSumTimestampArray': ('deltaSumTimestamp', 'Array'), 'cramersVBiasCorrectedArray': ('cramersVBiasCorrected', 'Array'), 'exponentialTimeDecayedAvgArray': ('exponentialTimeDecayedAvg', 'Array'), 'quantilesGKArray': ('quantilesGK', 'Array'), 'sequenceCountArray': ('sequenceCount', 'Array'), 'skewSampArray': ('skewSamp', 'Array'), 'avgArray': ('avg', 'Array'), 'avgWeightedArray': ('avgWeighted', 'Array'), 'sequenceMatchArray': ('sequenceMatch', 'Array'), 'kurtSampArray': ('kurtSamp', 'Array'), 'uniqHLL12Array': ('uniqHLL12', 'Array'), 'quantilesDeterministicArray': ('quantilesDeterministic', 'Array'), 'cramersVArray': ('cramersV', 'Array'), 'entropyArray': ('entropy', 'Array'), 'studentTTestArray': ('studentTTest', 'Array'), 'medianArray': ('median', 'Array'), 'contingencyArray': ('contingency', 'Array'), 'quantilesExactWeightedArray': ('quantilesExactWeighted', 'Array'), 'quantilesTDigestArray': ('quantilesTDigest', 'Array'), 'categoricalInformationValueArray': ('categoricalInformationValue', 'Array'), 'windowFunnelArray': ('windowFunnel', 'Array'), 'exponentialMovingAverageArray': ('exponentialMovingAverage', 'Array'), 'argMinArray': ('argMin', 'Array'), 'topKArray': ('topK', 'Array'), 'quantileDeterministicArray': ('quantileDeterministic', 'Array'), 'maxArray': ('max', 'Array'), 'anyHeavyArray': ('anyHeavy', 'Array'), 'quantileExactArray': ('quantileExact', 'Array'), 'quantilesTimingWeightedArray': ('quantilesTimingWeighted', 'Array'), 'quantilesTimingArray': ('quantilesTiming', 'Array'), 'anyLastArray': ('anyLast', 'Array'), 'sumArray': ('sum', 'Array'), 'rankCorrArray': ('rankCorr', 'Array'), 'sequenceNextNodeArray': ('sequenceNextNode', 'Array'), 'uniqArray': ('uniq', 'Array'), 'quantilesExactLowArray': ('quantilesExactLow', 'Array'), 'stddevSampArray': ('stddevSamp', 'Array'), 'quantileBFloat16WeightedArray': ('quantileBFloat16Weighted', 'Array'), 'quantilesTDigestWeightedArray': ('quantilesTDigestWeighted', 'Array'), 'uniqThetaArray': ('uniqTheta', 'Array'), 'maxMapArray': ('maxMap', 'Array'), 'quantilesExactHighArray': ('quantilesExactHigh', 'Array'), 'varPopArray': ('varPop', 'Array'), 'sparkBarArray': ('sparkBar', 'Array'), 'stochasticLogisticRegressionArray': ('stochasticLogisticRegression', 'Array'), 'quantilesBFloat16Array': ('quantilesBFloat16', 'Array'), 'last_valueArray': ('last_value', 'Array'), 'quantileExactHighArray': ('quantileExactHigh', 'Array'), 'mannWhitneyUTestArray': ('mannWhitneyUTest', 'Array'), 'stochasticLinearRegressionArray': ('stochasticLinearRegression', 'Array'), 'groupUniqArrayArray': ('groupUniqArray', 'Array'), 'maxIntersectionsArray': ('maxIntersections', 'Array'), 'intervalLengthSumArray': ('intervalLengthSum', 'Array'), 'groupBitOrArray': ('groupBitOr', 'Array'), 'countArray': ('count', 'Array'), 'quantilesBFloat16WeightedArray': ('quantilesBFloat16Weighted', 'Array'), 'deltaSumArray': ('deltaSum', 'Array'), 'quantileGKArray': ('quantileGK', 'Array'), 'meanZTestArray': ('meanZTest', 'Array'), 'groupArraySampleArray': ('groupArraySample', 'Array'), 'covarPopArray': ('covarPop', 'Array'), 'sumMapArray': ('sumMap', 'Array'), 'argMaxArray': ('argMax', 'Array'), 'quantileTDigestArray': ('quantileTDigest', 'Array'), 'corrArray': ('corr', 'Array'), 'groupBitmapOrArray': ('groupBitmapOr', 'Array'), 'quantilesInterpolatedWeightedArray': ('quantilesInterpolatedWeighted', 'Array'), 'largestTriangleThreeBucketsArray': ('largestTriangleThreeBuckets', 'Array'), 'groupBitmapArray': ('groupBitmap', 'Array'), 'quantileTimingArray': ('quantileTiming', 'Array'), 'retentionArray': ('retention', 'Array'), 'groupBitAndArray': ('groupBitAnd', 'Array'), 'first_valueArray': ('first_value', 'Array'), 'quantileInterpolatedWeightedArray': ('quantileInterpolatedWeighted', 'Array'), 'uniqCombinedArray': ('uniqCombined', 'Array'), 'varSampArray': ('varSamp', 'Array'), 'stddevPopArray': ('stddevPop', 'Array'), 'groupBitmapAndArray': ('groupBitmapAnd', 'Array'), 'groupBitmapXorArray': ('groupBitmapXor', 'Array'), 'quantileTDigestWeightedArray': ('quantileTDigestWeighted', 'Array'), 'boundingRatioArray': ('boundingRatio', 'Array'), 'groupBitXorArray': ('groupBitXor', 'Array'), 'anyArrayIf': ('any', 'ArrayIf'), 'uniqUpToArrayIf': ('uniqUpTo', 'ArrayIf'), 'uniqCombined64ArrayIf': ('uniqCombined64', 'ArrayIf'), 'minMapArrayIf': ('minMap', 'ArrayIf'), 'sumCountArrayIf': ('sumCount', 'ArrayIf'), 'topKWeightedArrayIf': ('topKWeighted', 'ArrayIf'), 'quantileTimingWeightedArrayIf': ('quantileTimingWeighted', 'ArrayIf'), 'quantilesExactArrayIf': ('quantilesExact', 'ArrayIf'), 'groupArrayArrayIf': ('groupArray', 'ArrayIf'), 'sumWithOverflowArrayIf': ('sumWithOverflow', 'ArrayIf'), 'kurtPopArrayIf': ('kurtPop', 'ArrayIf'), 'minArrayIf': ('min', 'ArrayIf'), 'quantilesArrayIf': ('quantiles', 'ArrayIf'), 'quantileArrayIf': ('quantile', 'ArrayIf'), 'quantileExactLowArrayIf': ('quantileExactLow', 'ArrayIf'), 'groupArrayInsertAtArrayIf': ('groupArrayInsertAt', 'ArrayIf'), 'sumKahanArrayIf': ('sumKahan', 'ArrayIf'), 'covarSampArrayIf': ('covarSamp', 'ArrayIf'), 'groupArrayMovingSumArrayIf': ('groupArrayMovingSum', 'ArrayIf'), 'theilsUArrayIf': ('theilsU', 'ArrayIf'), 'groupArrayLastArrayIf': ('groupArrayLast', 'ArrayIf'), 'histogramArrayIf': ('histogram', 'ArrayIf'), 'skewPopArrayIf': ('skewPop', 'ArrayIf'), 'quantileBFloat16ArrayIf': ('quantileBFloat16', 'ArrayIf'), 'maxIntersectionsPositionArrayIf': ('maxIntersectionsPosition', 'ArrayIf'), 'quantileExactWeightedArrayIf': ('quantileExactWeighted', 'ArrayIf'), 'welchTTestArrayIf': ('welchTTest', 'ArrayIf'), 'kolmogorovSmirnovTestArrayIf': ('kolmogorovSmirnovTest', 'ArrayIf'), 'uniqExactArrayIf': ('uniqExact', 'ArrayIf'), 'simpleLinearRegressionArrayIf': ('simpleLinearRegression', 'ArrayIf'), 'groupArrayMovingAvgArrayIf': ('groupArrayMovingAvg', 'ArrayIf'), 'deltaSumTimestampArrayIf': ('deltaSumTimestamp', 'ArrayIf'), 'cramersVBiasCorrectedArrayIf': ('cramersVBiasCorrected', 'ArrayIf'), 'exponentialTimeDecayedAvgArrayIf': ('exponentialTimeDecayedAvg', 'ArrayIf'), 'quantilesGKArrayIf': ('quantilesGK', 'ArrayIf'), 'sequenceCountArrayIf': ('sequenceCount', 'ArrayIf'), 'skewSampArrayIf': ('skewSamp', 'ArrayIf'), 'avgArrayIf': ('avg', 'ArrayIf'), 'avgWeightedArrayIf': ('avgWeighted', 'ArrayIf'), 'sequenceMatchArrayIf': ('sequenceMatch', 'ArrayIf'), 'kurtSampArrayIf': ('kurtSamp', 'ArrayIf'), 'uniqHLL12ArrayIf': ('uniqHLL12', 'ArrayIf'), 'quantilesDeterministicArrayIf': ('quantilesDeterministic', 'ArrayIf'), 'cramersVArrayIf': ('cramersV', 'ArrayIf'), 'entropyArrayIf': ('entropy', 'ArrayIf'), 'studentTTestArrayIf': ('studentTTest', 'ArrayIf'), 'medianArrayIf': ('median', 'ArrayIf'), 'contingencyArrayIf': ('contingency', 'ArrayIf'), 'quantilesExactWeightedArrayIf': ('quantilesExactWeighted', 'ArrayIf'), 'quantilesTDigestArrayIf': ('quantilesTDigest', 'ArrayIf'), 'categoricalInformationValueArrayIf': ('categoricalInformationValue', 'ArrayIf'), 'windowFunnelArrayIf': ('windowFunnel', 'ArrayIf'), 'exponentialMovingAverageArrayIf': ('exponentialMovingAverage', 'ArrayIf'), 'argMinArrayIf': ('argMin', 'ArrayIf'), 'topKArrayIf': ('topK', 'ArrayIf'), 'quantileDeterministicArrayIf': ('quantileDeterministic', 'ArrayIf'), 'maxArrayIf': ('max', 'ArrayIf'), 'anyHeavyArrayIf': ('anyHeavy', 'ArrayIf'), 'quantileExactArrayIf': ('quantileExact', 'ArrayIf'), 'quantilesTimingWeightedArrayIf': ('quantilesTimingWeighted', 'ArrayIf'), 'quantilesTimingArrayIf': ('quantilesTiming', 'ArrayIf'), 'anyLastArrayIf': ('anyLast', 'ArrayIf'), 'sumArrayIf': ('sum', 'ArrayIf'), 'rankCorrArrayIf': ('rankCorr', 'ArrayIf'), 'sequenceNextNodeArrayIf': ('sequenceNextNode', 'ArrayIf'), 'uniqArrayIf': ('uniq', 'ArrayIf'), 'quantilesExactLowArrayIf': ('quantilesExactLow', 'ArrayIf'), 'stddevSampArrayIf': ('stddevSamp', 'ArrayIf'), 'quantileBFloat16WeightedArrayIf': ('quantileBFloat16Weighted', 'ArrayIf'), 'quantilesTDigestWeightedArrayIf': ('quantilesTDigestWeighted', 'ArrayIf'), 'uniqThetaArrayIf': ('uniqTheta', 'ArrayIf'), 'maxMapArrayIf': ('maxMap', 'ArrayIf'), 'quantilesExactHighArrayIf': ('quantilesExactHigh', 'ArrayIf'), 'varPopArrayIf': ('varPop', 'ArrayIf'), 'sparkBarArrayIf': ('sparkBar', 'ArrayIf'), 'stochasticLogisticRegressionArrayIf': ('stochasticLogisticRegression', 'ArrayIf'), 'quantilesBFloat16ArrayIf': ('quantilesBFloat16', 'ArrayIf'), 'last_valueArrayIf': ('last_value', 'ArrayIf'), 'quantileExactHighArrayIf': ('quantileExactHigh', 'ArrayIf'), 'mannWhitneyUTestArrayIf': ('mannWhitneyUTest', 'ArrayIf'), 'stochasticLinearRegressionArrayIf': ('stochasticLinearRegression', 'ArrayIf'), 'groupUniqArrayArrayIf': ('groupUniqArray', 'ArrayIf'), 'maxIntersectionsArrayIf': ('maxIntersections', 'ArrayIf'), 'intervalLengthSumArrayIf': ('intervalLengthSum', 'ArrayIf'), 'groupBitOrArrayIf': ('groupBitOr', 'ArrayIf'), 'countArrayIf': ('count', 'ArrayIf'), 'quantilesBFloat16WeightedArrayIf': ('quantilesBFloat16Weighted', 'ArrayIf'), 'deltaSumArrayIf': ('deltaSum', 'ArrayIf'), 'quantileGKArrayIf': ('quantileGK', 'ArrayIf'), 'meanZTestArrayIf': ('meanZTest', 'ArrayIf'), 'groupArraySampleArrayIf': ('groupArraySample', 'ArrayIf'), 'covarPopArrayIf': ('covarPop', 'ArrayIf'), 'sumMapArrayIf': ('sumMap', 'ArrayIf'), 'argMaxArrayIf': ('argMax', 'ArrayIf'), 'quantileTDigestArrayIf': ('quantileTDigest', 'ArrayIf'), 'corrArrayIf': ('corr', 'ArrayIf'), 'groupBitmapOrArrayIf': ('groupBitmapOr', 'ArrayIf'), 'quantilesInterpolatedWeightedArrayIf': ('quantilesInterpolatedWeighted', 'ArrayIf'), 'largestTriangleThreeBucketsArrayIf': ('largestTriangleThreeBuckets', 'ArrayIf'), 'groupBitmapArrayIf': ('groupBitmap', 'ArrayIf'), 'quantileTimingArrayIf': ('quantileTiming', 'ArrayIf'), 'retentionArrayIf': ('retention', 'ArrayIf'), 'groupBitAndArrayIf': ('groupBitAnd', 'ArrayIf'), 'first_valueArrayIf': ('first_value', 'ArrayIf'), 'quantileInterpolatedWeightedArrayIf': ('quantileInterpolatedWeighted', 'ArrayIf'), 'uniqCombinedArrayIf': ('uniqCombined', 'ArrayIf'), 'varSampArrayIf': ('varSamp', 'ArrayIf'), 'stddevPopArrayIf': ('stddevPop', 'ArrayIf'), 'groupBitmapAndArrayIf': ('groupBitmapAnd', 'ArrayIf'), 'groupBitmapXorArrayIf': ('groupBitmapXor', 'ArrayIf'), 'quantileTDigestWeightedArrayIf': ('quantileTDigestWeighted', 'ArrayIf'), 'boundingRatioArrayIf': ('boundingRatio', 'ArrayIf'), 'groupBitXorArrayIf': ('groupBitXor', 'ArrayIf'), 'anyMap': ('any', 'Map'), 'uniqUpToMap': ('uniqUpTo', 'Map'), 'uniqCombined64Map': ('uniqCombined64', 'Map'), 'minMapMap': ('minMap', 'Map'), 'sumCountMap': ('sumCount', 'Map'), 'topKWeightedMap': ('topKWeighted', 'Map'), 'quantileTimingWeightedMap': ('quantileTimingWeighted', 'Map'), 'quantilesExactMap': ('quantilesExact', 'Map'), 'groupArrayMap': ('groupArray', 'Map'), 'sumWithOverflowMap': ('sumWithOverflow', 'Map'), 'kurtPopMap': ('kurtPop', 'Map'), 'minMap': ('minMap', ''), 'quantilesMap': ('quantiles', 'Map'), 'quantileMap': ('quantile', 'Map'), 'quantileExactLowMap': ('quantileExactLow', 'Map'), 'groupArrayInsertAtMap': ('groupArrayInsertAt', 'Map'), 'sumKahanMap': ('sumKahan', 'Map'), 'covarSampMap': ('covarSamp', 'Map'), 'groupArrayMovingSumMap': ('groupArrayMovingSum', 'Map'), 'theilsUMap': ('theilsU', 'Map'), 'groupArrayLastMap': ('groupArrayLast', 'Map'), 'histogramMap': ('histogram', 'Map'), 'skewPopMap': ('skewPop', 'Map'), 'quantileBFloat16Map': ('quantileBFloat16', 'Map'), 'maxIntersectionsPositionMap': ('maxIntersectionsPosition', 'Map'), 'quantileExactWeightedMap': ('quantileExactWeighted', 'Map'), 'welchTTestMap': ('welchTTest', 'Map'), 'kolmogorovSmirnovTestMap': ('kolmogorovSmirnovTest', 'Map'), 'uniqExactMap': ('uniqExact', 'Map'), 'simpleLinearRegressionMap': ('simpleLinearRegression', 'Map'), 'groupArrayMovingAvgMap': ('groupArrayMovingAvg', 'Map'), 'deltaSumTimestampMap': ('deltaSumTimestamp', 'Map'), 'cramersVBiasCorrectedMap': ('cramersVBiasCorrected', 'Map'), 'exponentialTimeDecayedAvgMap': ('exponentialTimeDecayedAvg', 'Map'), 'quantilesGKMap': ('quantilesGK', 'Map'), 'sequenceCountMap': ('sequenceCount', 'Map'), 'skewSampMap': ('skewSamp', 'Map'), 'avgMap': ('avg', 'Map'), 'avgWeightedMap': ('avgWeighted', 'Map'), 'sequenceMatchMap': ('sequenceMatch', 'Map'), 'kurtSampMap': ('kurtSamp', 'Map'), 'uniqHLL12Map': ('uniqHLL12', 'Map'), 'quantilesDeterministicMap': ('quantilesDeterministic', 'Map'), 'cramersVMap': ('cramersV', 'Map'), 'entropyMap': ('entropy', 'Map'), 'studentTTestMap': ('studentTTest', 'Map'), 'medianMap': ('median', 'Map'), 'contingencyMap': ('contingency', 'Map'), 'quantilesExactWeightedMap': ('quantilesExactWeighted', 'Map'), 'quantilesTDigestMap': ('quantilesTDigest', 'Map'), 'categoricalInformationValueMap': ('categoricalInformationValue', 'Map'), 'windowFunnelMap': ('windowFunnel', 'Map'), 'exponentialMovingAverageMap': ('exponentialMovingAverage', 'Map'), 'argMinMap': ('argMin', 'Map'), 'topKMap': ('topK', 'Map'), 'quantileDeterministicMap': ('quantileDeterministic', 'Map'), 'maxMap': ('maxMap', ''), 'anyHeavyMap': ('anyHeavy', 'Map'), 'quantileExactMap': ('quantileExact', 'Map'), 'quantilesTimingWeightedMap': ('quantilesTimingWeighted', 'Map'), 'quantilesTimingMap': ('quantilesTiming', 'Map'), 'anyLastMap': ('anyLast', 'Map'), 'sumMap': ('sumMap', ''), 'rankCorrMap': ('rankCorr', 'Map'), 'sequenceNextNodeMap': ('sequenceNextNode', 'Map'), 'uniqMap': ('uniq', 'Map'), 'quantilesExactLowMap': ('quantilesExactLow', 'Map'), 'stddevSampMap': ('stddevSamp', 'Map'), 'quantileBFloat16WeightedMap': ('quantileBFloat16Weighted', 'Map'), 'quantilesTDigestWeightedMap': ('quantilesTDigestWeighted', 'Map'), 'uniqThetaMap': ('uniqTheta', 'Map'), 'maxMapMap': ('maxMap', 'Map'), 'quantilesExactHighMap': ('quantilesExactHigh', 'Map'), 'varPopMap': ('varPop', 'Map'), 'sparkBarMap': ('sparkBar', 'Map'), 'stochasticLogisticRegressionMap': ('stochasticLogisticRegression', 'Map'), 'quantilesBFloat16Map': ('quantilesBFloat16', 'Map'), 'last_valueMap': ('last_value', 'Map'), 'quantileExactHighMap': ('quantileExactHigh', 'Map'), 'mannWhitneyUTestMap': ('mannWhitneyUTest', 'Map'), 'stochasticLinearRegressionMap': ('stochasticLinearRegression', 'Map'), 'groupUniqArrayMap': ('groupUniqArray', 'Map'), 'maxIntersectionsMap': ('maxIntersections', 'Map'), 'intervalLengthSumMap': ('intervalLengthSum', 'Map'), 'groupBitOrMap': ('groupBitOr', 'Map'), 'countMap': ('count', 'Map'), 'quantilesBFloat16WeightedMap': ('quantilesBFloat16Weighted', 'Map'), 'deltaSumMap': ('deltaSum', 'Map'), 'quantileGKMap': ('quantileGK', 'Map'), 'meanZTestMap': ('meanZTest', 'Map'), 'groupArraySampleMap': ('groupArraySample', 'Map'), 'covarPopMap': ('covarPop', 'Map'), 'sumMapMap': ('sumMap', 'Map'), 'argMaxMap': ('argMax', 'Map'), 'quantileTDigestMap': ('quantileTDigest', 'Map'), 'corrMap': ('corr', 'Map'), 'groupBitmapOrMap': ('groupBitmapOr', 'Map'), 'quantilesInterpolatedWeightedMap': ('quantilesInterpolatedWeighted', 'Map'), 'largestTriangleThreeBucketsMap': ('largestTriangleThreeBuckets', 'Map'), 'groupBitmapMap': ('groupBitmap', 'Map'), 'quantileTimingMap': ('quantileTiming', 'Map'), 'retentionMap': ('retention', 'Map'), 'groupBitAndMap': ('groupBitAnd', 'Map'), 'first_valueMap': ('first_value', 'Map'), 'quantileInterpolatedWeightedMap': ('quantileInterpolatedWeighted', 'Map'), 'uniqCombinedMap': ('uniqCombined', 'Map'), 'varSampMap': ('varSamp', 'Map'), 'stddevPopMap': ('stddevPop', 'Map'), 'groupBitmapAndMap': ('groupBitmapAnd', 'Map'), 'groupBitmapXorMap': ('groupBitmapXor', 'Map'), 'quantileTDigestWeightedMap': ('quantileTDigestWeighted', 'Map'), 'boundingRatioMap': ('boundingRatio', 'Map'), 'groupBitXorMap': ('groupBitXor', 'Map'), 'anySimpleState': ('any', 'SimpleState'), 'uniqUpToSimpleState': ('uniqUpTo', 'SimpleState'), 'uniqCombined64SimpleState': ('uniqCombined64', 'SimpleState'), 'minMapSimpleState': ('minMap', 'SimpleState'), 'sumCountSimpleState': ('sumCount', 'SimpleState'), 'topKWeightedSimpleState': ('topKWeighted', 'SimpleState'), 'quantileTimingWeightedSimpleState': ('quantileTimingWeighted', 'SimpleState'), 'quantilesExactSimpleState': ('quantilesExact', 'SimpleState'), 'groupArraySimpleState': ('groupArray', 'SimpleState'), 'sumWithOverflowSimpleState': ('sumWithOverflow', 'SimpleState'), 'kurtPopSimpleState': ('kurtPop', 'SimpleState'), 'minSimpleState': ('min', 'SimpleState'), 'quantilesSimpleState': ('quantiles', 'SimpleState'), 'quantileSimpleState': ('quantile', 'SimpleState'), 'quantileExactLowSimpleState': ('quantileExactLow', 'SimpleState'), 'groupArrayInsertAtSimpleState': ('groupArrayInsertAt', 'SimpleState'), 'sumKahanSimpleState': ('sumKahan', 'SimpleState'), 'covarSampSimpleState': ('covarSamp', 'SimpleState'), 'groupArrayMovingSumSimpleState': ('groupArrayMovingSum', 'SimpleState'), 'theilsUSimpleState': ('theilsU', 'SimpleState'), 'groupArrayLastSimpleState': ('groupArrayLast', 'SimpleState'), 'histogramSimpleState': ('histogram', 'SimpleState'), 'skewPopSimpleState': ('skewPop', 'SimpleState'), 'quantileBFloat16SimpleState': ('quantileBFloat16', 'SimpleState'), 'maxIntersectionsPositionSimpleState': ('maxIntersectionsPosition', 'SimpleState'), 'quantileExactWeightedSimpleState': ('quantileExactWeighted', 'SimpleState'), 'welchTTestSimpleState': ('welchTTest', 'SimpleState'), 'kolmogorovSmirnovTestSimpleState': ('kolmogorovSmirnovTest', 'SimpleState'), 'uniqExactSimpleState': ('uniqExact', 'SimpleState'), 'simpleLinearRegressionSimpleState': ('simpleLinearRegression', 'SimpleState'), 'groupArrayMovingAvgSimpleState': ('groupArrayMovingAvg', 'SimpleState'), 'deltaSumTimestampSimpleState': ('deltaSumTimestamp', 'SimpleState'), 'cramersVBiasCorrectedSimpleState': ('cramersVBiasCorrected', 'SimpleState'), 'exponentialTimeDecayedAvgSimpleState': ('exponentialTimeDecayedAvg', 'SimpleState'), 'quantilesGKSimpleState': ('quantilesGK', 'SimpleState'), 'sequenceCountSimpleState': ('sequenceCount', 'SimpleState'), 'skewSampSimpleState': ('skewSamp', 'SimpleState'), 'avgSimpleState': ('avg', 'SimpleState'), 'avgWeightedSimpleState': ('avgWeighted', 'SimpleState'), 'sequenceMatchSimpleState': ('sequenceMatch', 'SimpleState'), 'kurtSampSimpleState': ('kurtSamp', 'SimpleState'), 'uniqHLL12SimpleState': ('uniqHLL12', 'SimpleState'), 'quantilesDeterministicSimpleState': ('quantilesDeterministic', 'SimpleState'), 'cramersVSimpleState': ('cramersV', 'SimpleState'), 'entropySimpleState': ('entropy', 'SimpleState'), 'studentTTestSimpleState': ('studentTTest', 'SimpleState'), 'medianSimpleState': ('median', 'SimpleState'), 'contingencySimpleState': ('contingency', 'SimpleState'), 'quantilesExactWeightedSimpleState': ('quantilesExactWeighted', 'SimpleState'), 'quantilesTDigestSimpleState': ('quantilesTDigest', 'SimpleState'), 'categoricalInformationValueSimpleState': ('categoricalInformationValue', 'SimpleState'), 'windowFunnelSimpleState': ('windowFunnel', 'SimpleState'), 'exponentialMovingAverageSimpleState': ('exponentialMovingAverage', 'SimpleState'), 'argMinSimpleState': ('argMin', 'SimpleState'), 'topKSimpleState': ('topK', 'SimpleState'), 'quantileDeterministicSimpleState': ('quantileDeterministic', 'SimpleState'), 'maxSimpleState': ('max', 'SimpleState'), 'anyHeavySimpleState': ('anyHeavy', 'SimpleState'), 'quantileExactSimpleState': ('quantileExact', 'SimpleState'), 'quantilesTimingWeightedSimpleState': ('quantilesTimingWeighted', 'SimpleState'), 'quantilesTimingSimpleState': ('quantilesTiming', 'SimpleState'), 'anyLastSimpleState': ('anyLast', 'SimpleState'), 'sumSimpleState': ('sum', 'SimpleState'), 'rankCorrSimpleState': ('rankCorr', 'SimpleState'), 'sequenceNextNodeSimpleState': ('sequenceNextNode', 'SimpleState'), 'uniqSimpleState': ('uniq', 'SimpleState'), 'quantilesExactLowSimpleState': ('quantilesExactLow', 'SimpleState'), 'stddevSampSimpleState': ('stddevSamp', 'SimpleState'), 'quantileBFloat16WeightedSimpleState': ('quantileBFloat16Weighted', 'SimpleState'), 'quantilesTDigestWeightedSimpleState': ('quantilesTDigestWeighted', 'SimpleState'), 'uniqThetaSimpleState': ('uniqTheta', 'SimpleState'), 'maxMapSimpleState': ('maxMap', 'SimpleState'), 'quantilesExactHighSimpleState': ('quantilesExactHigh', 'SimpleState'), 'varPopSimpleState': ('varPop', 'SimpleState'), 'sparkBarSimpleState': ('sparkBar', 'SimpleState'), 'stochasticLogisticRegressionSimpleState': ('stochasticLogisticRegression', 'SimpleState'), 'quantilesBFloat16SimpleState': ('quantilesBFloat16', 'SimpleState'), 'last_valueSimpleState': ('last_value', 'SimpleState'), 'quantileExactHighSimpleState': ('quantileExactHigh', 'SimpleState'), 'mannWhitneyUTestSimpleState': ('mannWhitneyUTest', 'SimpleState'), 'stochasticLinearRegressionSimpleState': ('stochasticLinearRegression', 'SimpleState'), 'groupUniqArraySimpleState': ('groupUniqArray', 'SimpleState'), 'maxIntersectionsSimpleState': ('maxIntersections', 'SimpleState'), 'intervalLengthSumSimpleState': ('intervalLengthSum', 'SimpleState'), 'groupBitOrSimpleState': ('groupBitOr', 'SimpleState'), 'countSimpleState': ('count', 'SimpleState'), 'quantilesBFloat16WeightedSimpleState': ('quantilesBFloat16Weighted', 'SimpleState'), 'deltaSumSimpleState': ('deltaSum', 'SimpleState'), 'quantileGKSimpleState': ('quantileGK', 'SimpleState'), 'meanZTestSimpleState': ('meanZTest', 'SimpleState'), 'groupArraySampleSimpleState': ('groupArraySample', 'SimpleState'), 'covarPopSimpleState': ('covarPop', 'SimpleState'), 'sumMapSimpleState': ('sumMap', 'SimpleState'), 'argMaxSimpleState': ('argMax', 'SimpleState'), 'quantileTDigestSimpleState': ('quantileTDigest', 'SimpleState'), 'corrSimpleState': ('corr', 'SimpleState'), 'groupBitmapOrSimpleState': ('groupBitmapOr', 'SimpleState'), 'quantilesInterpolatedWeightedSimpleState': ('quantilesInterpolatedWeighted', 'SimpleState'), 'largestTriangleThreeBucketsSimpleState': ('largestTriangleThreeBuckets', 'SimpleState'), 'groupBitmapSimpleState': ('groupBitmap', 'SimpleState'), 'quantileTimingSimpleState': ('quantileTiming', 'SimpleState'), 'retentionSimpleState': ('retention', 'SimpleState'), 'groupBitAndSimpleState': ('groupBitAnd', 'SimpleState'), 'first_valueSimpleState': ('first_value', 'SimpleState'), 'quantileInterpolatedWeightedSimpleState': ('quantileInterpolatedWeighted', 'SimpleState'), 'uniqCombinedSimpleState': ('uniqCombined', 'SimpleState'), 'varSampSimpleState': ('varSamp', 'SimpleState'), 'stddevPopSimpleState': ('stddevPop', 'SimpleState'), 'groupBitmapAndSimpleState': ('groupBitmapAnd', 'SimpleState'), 'groupBitmapXorSimpleState': ('groupBitmapXor', 'SimpleState'), 'quantileTDigestWeightedSimpleState': ('quantileTDigestWeighted', 'SimpleState'), 'boundingRatioSimpleState': ('boundingRatio', 'SimpleState'), 'groupBitXorSimpleState': ('groupBitXor', 'SimpleState'), 'anyState': ('any', 'State'), 'uniqUpToState': ('uniqUpTo', 'State'), 'uniqCombined64State': ('uniqCombined64', 'State'), 'minMapState': ('minMap', 'State'), 'sumCountState': ('sumCount', 'State'), 'topKWeightedState': ('topKWeighted', 'State'), 'quantileTimingWeightedState': ('quantileTimingWeighted', 'State'), 'quantilesExactState': ('quantilesExact', 'State'), 'groupArrayState': ('groupArray', 'State'), 'sumWithOverflowState': ('sumWithOverflow', 'State'), 'kurtPopState': ('kurtPop', 'State'), 'minState': ('min', 'State'), 'quantilesState': ('quantiles', 'State'), 'quantileState': ('quantile', 'State'), 'quantileExactLowState': ('quantileExactLow', 'State'), 'groupArrayInsertAtState': ('groupArrayInsertAt', 'State'), 'sumKahanState': ('sumKahan', 'State'), 'covarSampState': ('covarSamp', 'State'), 'groupArrayMovingSumState': ('groupArrayMovingSum', 'State'), 'theilsUState': ('theilsU', 'State'), 'groupArrayLastState': ('groupArrayLast', 'State'), 'histogramState': ('histogram', 'State'), 'skewPopState': ('skewPop', 'State'), 'quantileBFloat16State': ('quantileBFloat16', 'State'), 'maxIntersectionsPositionState': ('maxIntersectionsPosition', 'State'), 'quantileExactWeightedState': ('quantileExactWeighted', 'State'), 'welchTTestState': ('welchTTest', 'State'), 'kolmogorovSmirnovTestState': ('kolmogorovSmirnovTest', 'State'), 'uniqExactState': ('uniqExact', 'State'), 'simpleLinearRegressionState': ('simpleLinearRegression', 'State'), 'groupArrayMovingAvgState': ('groupArrayMovingAvg', 'State'), 'deltaSumTimestampState': ('deltaSumTimestamp', 'State'), 'cramersVBiasCorrectedState': ('cramersVBiasCorrected', 'State'), 'exponentialTimeDecayedAvgState': ('exponentialTimeDecayedAvg', 'State'), 'quantilesGKState': ('quantilesGK', 'State'), 'sequenceCountState': ('sequenceCount', 'State'), 'skewSampState': ('skewSamp', 'State'), 'avgState': ('avg', 'State'), 'avgWeightedState': ('avgWeighted', 'State'), 'sequenceMatchState': ('sequenceMatch', 'State'), 'kurtSampState': ('kurtSamp', 'State'), 'uniqHLL12State': ('uniqHLL12', 'State'), 'quantilesDeterministicState': ('quantilesDeterministic', 'State'), 'cramersVState': ('cramersV', 'State'), 'entropyState': ('entropy', 'State'), 'studentTTestState': ('studentTTest', 'State'), 'medianState': ('median', 'State'), 'contingencyState': ('contingency', 'State'), 'quantilesExactWeightedState': ('quantilesExactWeighted', 'State'), 'quantilesTDigestState': ('quantilesTDigest', 'State'), 'categoricalInformationValueState': ('categoricalInformationValue', 'State'), 'windowFunnelState': ('windowFunnel', 'State'), 'exponentialMovingAverageState': ('exponentialMovingAverage', 'State'), 'argMinState': ('argMin', 'State'), 'topKState': ('topK', 'State'), 'quantileDeterministicState': ('quantileDeterministic', 'State'), 'maxState': ('max', 'State'), 'anyHeavyState': ('anyHeavy', 'State'), 'quantileExactState': ('quantileExact', 'State'), 'quantilesTimingWeightedState': ('quantilesTimingWeighted', 'State'), 'quantilesTimingState': ('quantilesTiming', 'State'), 'anyLastState': ('anyLast', 'State'), 'sumState': ('sum', 'State'), 'rankCorrState': ('rankCorr', 'State'), 'sequenceNextNodeState': ('sequenceNextNode', 'State'), 'uniqState': ('uniq', 'State'), 'quantilesExactLowState': ('quantilesExactLow', 'State'), 'stddevSampState': ('stddevSamp', 'State'), 'quantileBFloat16WeightedState': ('quantileBFloat16Weighted', 'State'), 'quantilesTDigestWeightedState': ('quantilesTDigestWeighted', 'State'), 'uniqThetaState': ('uniqTheta', 'State'), 'maxMapState': ('maxMap', 'State'), 'quantilesExactHighState': ('quantilesExactHigh', 'State'), 'varPopState': ('varPop', 'State'), 'sparkBarState': ('sparkBar', 'State'), 'stochasticLogisticRegressionState': ('stochasticLogisticRegression', 'State'), 'quantilesBFloat16State': ('quantilesBFloat16', 'State'), 'last_valueState': ('last_value', 'State'), 'quantileExactHighState': ('quantileExactHigh', 'State'), 'mannWhitneyUTestState': ('mannWhitneyUTest', 'State'), 'stochasticLinearRegressionState': ('stochasticLinearRegression', 'State'), 'groupUniqArrayState': ('groupUniqArray', 'State'), 'maxIntersectionsState': ('maxIntersections', 'State'), 'intervalLengthSumState': ('intervalLengthSum', 'State'), 'groupBitOrState': ('groupBitOr', 'State'), 'countState': ('count', 'State'), 'quantilesBFloat16WeightedState': ('quantilesBFloat16Weighted', 'State'), 'deltaSumState': ('deltaSum', 'State'), 'quantileGKState': ('quantileGK', 'State'), 'meanZTestState': ('meanZTest', 'State'), 'groupArraySampleState': ('groupArraySample', 'State'), 'covarPopState': ('covarPop', 'State'), 'sumMapState': ('sumMap', 'State'), 'argMaxState': ('argMax', 'State'), 'quantileTDigestState': ('quantileTDigest', 'State'), 'corrState': ('corr', 'State'), 'groupBitmapOrState': ('groupBitmapOr', 'State'), 'quantilesInterpolatedWeightedState': ('quantilesInterpolatedWeighted', 'State'), 'largestTriangleThreeBucketsState': ('largestTriangleThreeBuckets', 'State'), 'groupBitmapState': ('groupBitmap', 'State'), 'quantileTimingState': ('quantileTiming', 'State'), 'retentionState': ('retention', 'State'), 'groupBitAndState': ('groupBitAnd', 'State'), 'first_valueState': ('first_value', 'State'), 'quantileInterpolatedWeightedState': ('quantileInterpolatedWeighted', 'State'), 'uniqCombinedState': ('uniqCombined', 'State'), 'varSampState': ('varSamp', 'State'), 'stddevPopState': ('stddevPop', 'State'), 'groupBitmapAndState': ('groupBitmapAnd', 'State'), 'groupBitmapXorState': ('groupBitmapXor', 'State'), 'quantileTDigestWeightedState': ('quantileTDigestWeighted', 'State'), 'boundingRatioState': ('boundingRatio', 'State'), 'groupBitXorState': ('groupBitXor', 'State'), 'anyMerge': ('any', 'Merge'), 'uniqUpToMerge': ('uniqUpTo', 'Merge'), 'uniqCombined64Merge': ('uniqCombined64', 'Merge'), 'minMapMerge': ('minMap', 'Merge'), 'sumCountMerge': ('sumCount', 'Merge'), 'topKWeightedMerge': ('topKWeighted', 'Merge'), 'quantileTimingWeightedMerge': ('quantileTimingWeighted', 'Merge'), 'quantilesExactMerge': ('quantilesExact', 'Merge'), 'groupArrayMerge': ('groupArray', 'Merge'), 'sumWithOverflowMerge': ('sumWithOverflow', 'Merge'), 'kurtPopMerge': ('kurtPop', 'Merge'), 'minMerge': ('min', 'Merge'), 'quantilesMerge': ('quantiles', 'Merge'), 'quantileMerge': ('quantile', 'Merge'), 'quantileExactLowMerge': ('quantileExactLow', 'Merge'), 'groupArrayInsertAtMerge': ('groupArrayInsertAt', 'Merge'), 'sumKahanMerge': ('sumKahan', 'Merge'), 'covarSampMerge': ('covarSamp', 'Merge'), 'groupArrayMovingSumMerge': ('groupArrayMovingSum', 'Merge'), 'theilsUMerge': ('theilsU', 'Merge'), 'groupArrayLastMerge': ('groupArrayLast', 'Merge'), 'histogramMerge': ('histogram', 'Merge'), 'skewPopMerge': ('skewPop', 'Merge'), 'quantileBFloat16Merge': ('quantileBFloat16', 'Merge'), 'maxIntersectionsPositionMerge': ('maxIntersectionsPosition', 'Merge'), 'quantileExactWeightedMerge': ('quantileExactWeighted', 'Merge'), 'welchTTestMerge': ('welchTTest', 'Merge'), 'kolmogorovSmirnovTestMerge': ('kolmogorovSmirnovTest', 'Merge'), 'uniqExactMerge': ('uniqExact', 'Merge'), 'simpleLinearRegressionMerge': ('simpleLinearRegression', 'Merge'), 'groupArrayMovingAvgMerge': ('groupArrayMovingAvg', 'Merge'), 'deltaSumTimestampMerge': ('deltaSumTimestamp', 'Merge'), 'cramersVBiasCorrectedMerge': ('cramersVBiasCorrected', 'Merge'), 'exponentialTimeDecayedAvgMerge': ('exponentialTimeDecayedAvg', 'Merge'), 'quantilesGKMerge': ('quantilesGK', 'Merge'), 'sequenceCountMerge': ('sequenceCount', 'Merge'), 'skewSampMerge': ('skewSamp', 'Merge'), 'avgMerge': ('avg', 'Merge'), 'avgWeightedMerge': ('avgWeighted', 'Merge'), 'sequenceMatchMerge': ('sequenceMatch', 'Merge'), 'kurtSampMerge': ('kurtSamp', 'Merge'), 'uniqHLL12Merge': ('uniqHLL12', 'Merge'), 'quantilesDeterministicMerge': ('quantilesDeterministic', 'Merge'), 'cramersVMerge': ('cramersV', 'Merge'), 'entropyMerge': ('entropy', 'Merge'), 'studentTTestMerge': ('studentTTest', 'Merge'), 'medianMerge': ('median', 'Merge'), 'contingencyMerge': ('contingency', 'Merge'), 'quantilesExactWeightedMerge': ('quantilesExactWeighted', 'Merge'), 'quantilesTDigestMerge': ('quantilesTDigest', 'Merge'), 'categoricalInformationValueMerge': ('categoricalInformationValue', 'Merge'), 'windowFunnelMerge': ('windowFunnel', 'Merge'), 'exponentialMovingAverageMerge': ('exponentialMovingAverage', 'Merge'), 'argMinMerge': ('argMin', 'Merge'), 'topKMerge': ('topK', 'Merge'), 'quantileDeterministicMerge': ('quantileDeterministic', 'Merge'), 'maxMerge': ('max', 'Merge'), 'anyHeavyMerge': ('anyHeavy', 'Merge'), 'quantileExactMerge': ('quantileExact', 'Merge'), 'quantilesTimingWeightedMerge': ('quantilesTimingWeighted', 'Merge'), 'quantilesTimingMerge': ('quantilesTiming', 'Merge'), 'anyLastMerge': ('anyLast', 'Merge'), 'sumMerge': ('sum', 'Merge'), 'rankCorrMerge': ('rankCorr', 'Merge'), 'sequenceNextNodeMerge': ('sequenceNextNode', 'Merge'), 'uniqMerge': ('uniq', 'Merge'), 'quantilesExactLowMerge': ('quantilesExactLow', 'Merge'), 'stddevSampMerge': ('stddevSamp', 'Merge'), 'quantileBFloat16WeightedMerge': ('quantileBFloat16Weighted', 'Merge'), 'quantilesTDigestWeightedMerge': ('quantilesTDigestWeighted', 'Merge'), 'uniqThetaMerge': ('uniqTheta', 'Merge'), 'maxMapMerge': ('maxMap', 'Merge'), 'quantilesExactHighMerge': ('quantilesExactHigh', 'Merge'), 'varPopMerge': ('varPop', 'Merge'), 'sparkBarMerge': ('sparkBar', 'Merge'), 'stochasticLogisticRegressionMerge': ('stochasticLogisticRegression', 'Merge'), 'quantilesBFloat16Merge': ('quantilesBFloat16', 'Merge'), 'last_valueMerge': ('last_value', 'Merge'), 'quantileExactHighMerge': ('quantileExactHigh', 'Merge'), 'mannWhitneyUTestMerge': ('mannWhitneyUTest', 'Merge'), 'stochasticLinearRegressionMerge': ('stochasticLinearRegression', 'Merge'), 'groupUniqArrayMerge': ('groupUniqArray', 'Merge'), 'maxIntersectionsMerge': ('maxIntersections', 'Merge'), 'intervalLengthSumMerge': ('intervalLengthSum', 'Merge'), 'groupBitOrMerge': ('groupBitOr', 'Merge'), 'countMerge': ('count', 'Merge'), 'quantilesBFloat16WeightedMerge': ('quantilesBFloat16Weighted', 'Merge'), 'deltaSumMerge': ('deltaSum', 'Merge'), 'quantileGKMerge': ('quantileGK', 'Merge'), 'meanZTestMerge': ('meanZTest', 'Merge'), 'groupArraySampleMerge': ('groupArraySample', 'Merge'), 'covarPopMerge': ('covarPop', 'Merge'), 'sumMapMerge': ('sumMap', 'Merge'), 'argMaxMerge': ('argMax', 'Merge'), 'quantileTDigestMerge': ('quantileTDigest', 'Merge'), 'corrMerge': ('corr', 'Merge'), 'groupBitmapOrMerge': ('groupBitmapOr', 'Merge'), 'quantilesInterpolatedWeightedMerge': ('quantilesInterpolatedWeighted', 'Merge'), 'largestTriangleThreeBucketsMerge': ('largestTriangleThreeBuckets', 'Merge'), 'groupBitmapMerge': ('groupBitmap', 'Merge'), 'quantileTimingMerge': ('quantileTiming', 'Merge'), 'retentionMerge': ('retention', 'Merge'), 'groupBitAndMerge': ('groupBitAnd', 'Merge'), 'first_valueMerge': ('first_value', 'Merge'), 'quantileInterpolatedWeightedMerge': ('quantileInterpolatedWeighted', 'Merge'), 'uniqCombinedMerge': ('uniqCombined', 'Merge'), 'varSampMerge': ('varSamp', 'Merge'), 'stddevPopMerge': ('stddevPop', 'Merge'), 'groupBitmapAndMerge': ('groupBitmapAnd', 'Merge'), 'groupBitmapXorMerge': ('groupBitmapXor', 'Merge'), 'quantileTDigestWeightedMerge': ('quantileTDigestWeighted', 'Merge'), 'boundingRatioMerge': ('boundingRatio', 'Merge'), 'groupBitXorMerge': ('groupBitXor', 'Merge'), 'anyMergeState': ('any', 'MergeState'), 'uniqUpToMergeState': ('uniqUpTo', 'MergeState'), 'uniqCombined64MergeState': ('uniqCombined64', 'MergeState'), 'minMapMergeState': ('minMap', 'MergeState'), 'sumCountMergeState': ('sumCount', 'MergeState'), 'topKWeightedMergeState': ('topKWeighted', 'MergeState'), 'quantileTimingWeightedMergeState': ('quantileTimingWeighted', 'MergeState'), 'quantilesExactMergeState': ('quantilesExact', 'MergeState'), 'groupArrayMergeState': ('groupArray', 'MergeState'), 'sumWithOverflowMergeState': ('sumWithOverflow', 'MergeState'), 'kurtPopMergeState': ('kurtPop', 'MergeState'), 'minMergeState': ('min', 'MergeState'), 'quantilesMergeState': ('quantiles', 'MergeState'), 'quantileMergeState': ('quantile', 'MergeState'), 'quantileExactLowMergeState': ('quantileExactLow', 'MergeState'), 'groupArrayInsertAtMergeState': ('groupArrayInsertAt', 'MergeState'), 'sumKahanMergeState': ('sumKahan', 'MergeState'), 'covarSampMergeState': ('covarSamp', 'MergeState'), 'groupArrayMovingSumMergeState': ('groupArrayMovingSum', 'MergeState'), 'theilsUMergeState': ('theilsU', 'MergeState'), 'groupArrayLastMergeState': ('groupArrayLast', 'MergeState'), 'histogramMergeState': ('histogram', 'MergeState'), 'skewPopMergeState': ('skewPop', 'MergeState'), 'quantileBFloat16MergeState': ('quantileBFloat16', 'MergeState'), 'maxIntersectionsPositionMergeState': ('maxIntersectionsPosition', 'MergeState'), 'quantileExactWeightedMergeState': ('quantileExactWeighted', 'MergeState'), 'welchTTestMergeState': ('welchTTest', 'MergeState'), 'kolmogorovSmirnovTestMergeState': ('kolmogorovSmirnovTest', 'MergeState'), 'uniqExactMergeState': ('uniqExact', 'MergeState'), 'simpleLinearRegressionMergeState': ('simpleLinearRegression', 'MergeState'), 'groupArrayMovingAvgMergeState': ('groupArrayMovingAvg', 'MergeState'), 'deltaSumTimestampMergeState': ('deltaSumTimestamp', 'MergeState'), 'cramersVBiasCorrectedMergeState': ('cramersVBiasCorrected', 'MergeState'), 'exponentialTimeDecayedAvgMergeState': ('exponentialTimeDecayedAvg', 'MergeState'), 'quantilesGKMergeState': ('quantilesGK', 'MergeState'), 'sequenceCountMergeState': ('sequenceCount', 'MergeState'), 'skewSampMergeState': ('skewSamp', 'MergeState'), 'avgMergeState': ('avg', 'MergeState'), 'avgWeightedMergeState': ('avgWeighted', 'MergeState'), 'sequenceMatchMergeState': ('sequenceMatch', 'MergeState'), 'kurtSampMergeState': ('kurtSamp', 'MergeState'), 'uniqHLL12MergeState': ('uniqHLL12', 'MergeState'), 'quantilesDeterministicMergeState': ('quantilesDeterministic', 'MergeState'), 'cramersVMergeState': ('cramersV', 'MergeState'), 'entropyMergeState': ('entropy', 'MergeState'), 'studentTTestMergeState': ('studentTTest', 'MergeState'), 'medianMergeState': ('median', 'MergeState'), 'contingencyMergeState': ('contingency', 'MergeState'), 'quantilesExactWeightedMergeState': ('quantilesExactWeighted', 'MergeState'), 'quantilesTDigestMergeState': ('quantilesTDigest', 'MergeState'), 'categoricalInformationValueMergeState': ('categoricalInformationValue', 'MergeState'), 'windowFunnelMergeState': ('windowFunnel', 'MergeState'), 'exponentialMovingAverageMergeState': ('exponentialMovingAverage', 'MergeState'), 'argMinMergeState': ('argMin', 'MergeState'), 'topKMergeState': ('topK', 'MergeState'), 'quantileDeterministicMergeState': ('quantileDeterministic', 'MergeState'), 'maxMergeState': ('max', 'MergeState'), 'anyHeavyMergeState': ('anyHeavy', 'MergeState'), 'quantileExactMergeState': ('quantileExact', 'MergeState'), 'quantilesTimingWeightedMergeState': ('quantilesTimingWeighted', 'MergeState'), 'quantilesTimingMergeState': ('quantilesTiming', 'MergeState'), 'anyLastMergeState': ('anyLast', 'MergeState'), 'sumMergeState': ('sum', 'MergeState'), 'rankCorrMergeState': ('rankCorr', 'MergeState'), 'sequenceNextNodeMergeState': ('sequenceNextNode', 'MergeState'), 'uniqMergeState': ('uniq', 'MergeState'), 'quantilesExactLowMergeState': ('quantilesExactLow', 'MergeState'), 'stddevSampMergeState': ('stddevSamp', 'MergeState'), 'quantileBFloat16WeightedMergeState': ('quantileBFloat16Weighted', 'MergeState'), 'quantilesTDigestWeightedMergeState': ('quantilesTDigestWeighted', 'MergeState'), 'uniqThetaMergeState': ('uniqTheta', 'MergeState'), 'maxMapMergeState': ('maxMap', 'MergeState'), 'quantilesExactHighMergeState': ('quantilesExactHigh', 'MergeState'), 'varPopMergeState': ('varPop', 'MergeState'), 'sparkBarMergeState': ('sparkBar', 'MergeState'), 'stochasticLogisticRegressionMergeState': ('stochasticLogisticRegression', 'MergeState'), 'quantilesBFloat16MergeState': ('quantilesBFloat16', 'MergeState'), 'last_valueMergeState': ('last_value', 'MergeState'), 'quantileExactHighMergeState': ('quantileExactHigh', 'MergeState'), 'mannWhitneyUTestMergeState': ('mannWhitneyUTest', 'MergeState'), 'stochasticLinearRegressionMergeState': ('stochasticLinearRegression', 'MergeState'), 'groupUniqArrayMergeState': ('groupUniqArray', 'MergeState'), 'maxIntersectionsMergeState': ('maxIntersections', 'MergeState'), 'intervalLengthSumMergeState': ('intervalLengthSum', 'MergeState'), 'groupBitOrMergeState': ('groupBitOr', 'MergeState'), 'countMergeState': ('count', 'MergeState'), 'quantilesBFloat16WeightedMergeState': ('quantilesBFloat16Weighted', 'MergeState'), 'deltaSumMergeState': ('deltaSum', 'MergeState'), 'quantileGKMergeState': ('quantileGK', 'MergeState'), 'meanZTestMergeState': ('meanZTest', 'MergeState'), 'groupArraySampleMergeState': ('groupArraySample', 'MergeState'), 'covarPopMergeState': ('covarPop', 'MergeState'), 'sumMapMergeState': ('sumMap', 'MergeState'), 'argMaxMergeState': ('argMax', 'MergeState'), 'quantileTDigestMergeState': ('quantileTDigest', 'MergeState'), 'corrMergeState': ('corr', 'MergeState'), 'groupBitmapOrMergeState': ('groupBitmapOr', 'MergeState'), 'quantilesInterpolatedWeightedMergeState': ('quantilesInterpolatedWeighted', 'MergeState'), 'largestTriangleThreeBucketsMergeState': ('largestTriangleThreeBuckets', 'MergeState'), 'groupBitmapMergeState': ('groupBitmap', 'MergeState'), 'quantileTimingMergeState': ('quantileTiming', 'MergeState'), 'retentionMergeState': ('retention', 'MergeState'), 'groupBitAndMergeState': ('groupBitAnd', 'MergeState'), 'first_valueMergeState': ('first_value', 'MergeState'), 'quantileInterpolatedWeightedMergeState': ('quantileInterpolatedWeighted', 'MergeState'), 'uniqCombinedMergeState': ('uniqCombined', 'MergeState'), 'varSampMergeState': ('varSamp', 'MergeState'), 'stddevPopMergeState': ('stddevPop', 'MergeState'), 'groupBitmapAndMergeState': ('groupBitmapAnd', 'MergeState'), 'groupBitmapXorMergeState': ('groupBitmapXor', 'MergeState'), 'quantileTDigestWeightedMergeState': ('quantileTDigestWeighted', 'MergeState'), 'boundingRatioMergeState': ('boundingRatio', 'MergeState'), 'groupBitXorMergeState': ('groupBitXor', 'MergeState'), 'anyForEach': ('any', 'ForEach'), 'uniqUpToForEach': ('uniqUpTo', 'ForEach'), 'uniqCombined64ForEach': ('uniqCombined64', 'ForEach'), 'minMapForEach': ('minMap', 'ForEach'), 'sumCountForEach': ('sumCount', 'ForEach'), 'topKWeightedForEach': ('topKWeighted', 'ForEach'), 'quantileTimingWeightedForEach': ('quantileTimingWeighted', 'ForEach'), 'quantilesExactForEach': ('quantilesExact', 'ForEach'), 'groupArrayForEach': ('groupArray', 'ForEach'), 'sumWithOverflowForEach': ('sumWithOverflow', 'ForEach'), 'kurtPopForEach': ('kurtPop', 'ForEach'), 'minForEach': ('min', 'ForEach'), 'quantilesForEach': ('quantiles', 'ForEach'), 'quantileForEach': ('quantile', 'ForEach'), 'quantileExactLowForEach': ('quantileExactLow', 'ForEach'), 'groupArrayInsertAtForEach': ('groupArrayInsertAt', 'ForEach'), 'sumKahanForEach': ('sumKahan', 'ForEach'), 'covarSampForEach': ('covarSamp', 'ForEach'), 'groupArrayMovingSumForEach': ('groupArrayMovingSum', 'ForEach'), 'theilsUForEach': ('theilsU', 'ForEach'), 'groupArrayLastForEach': ('groupArrayLast', 'ForEach'), 'histogramForEach': ('histogram', 'ForEach'), 'skewPopForEach': ('skewPop', 'ForEach'), 'quantileBFloat16ForEach': ('quantileBFloat16', 'ForEach'), 'maxIntersectionsPositionForEach': ('maxIntersectionsPosition', 'ForEach'), 'quantileExactWeightedForEach': ('quantileExactWeighted', 'ForEach'), 'welchTTestForEach': ('welchTTest', 'ForEach'), 'kolmogorovSmirnovTestForEach': ('kolmogorovSmirnovTest', 'ForEach'), 'uniqExactForEach': ('uniqExact', 'ForEach'), 'simpleLinearRegressionForEach': ('simpleLinearRegression', 'ForEach'), 'groupArrayMovingAvgForEach': ('groupArrayMovingAvg', 'ForEach'), 'deltaSumTimestampForEach': ('deltaSumTimestamp', 'ForEach'), 'cramersVBiasCorrectedForEach': ('cramersVBiasCorrected', 'ForEach'), 'exponentialTimeDecayedAvgForEach': ('exponentialTimeDecayedAvg', 'ForEach'), 'quantilesGKForEach': ('quantilesGK', 'ForEach'), 'sequenceCountForEach': ('sequenceCount', 'ForEach'), 'skewSampForEach': ('skewSamp', 'ForEach'), 'avgForEach': ('avg', 'ForEach'), 'avgWeightedForEach': ('avgWeighted', 'ForEach'), 'sequenceMatchForEach': ('sequenceMatch', 'ForEach'), 'kurtSampForEach': ('kurtSamp', 'ForEach'), 'uniqHLL12ForEach': ('uniqHLL12', 'ForEach'), 'quantilesDeterministicForEach': ('quantilesDeterministic', 'ForEach'), 'cramersVForEach': ('cramersV', 'ForEach'), 'entropyForEach': ('entropy', 'ForEach'), 'studentTTestForEach': ('studentTTest', 'ForEach'), 'medianForEach': ('median', 'ForEach'), 'contingencyForEach': ('contingency', 'ForEach'), 'quantilesExactWeightedForEach': ('quantilesExactWeighted', 'ForEach'), 'quantilesTDigestForEach': ('quantilesTDigest', 'ForEach'), 'categoricalInformationValueForEach': ('categoricalInformationValue', 'ForEach'), 'windowFunnelForEach': ('windowFunnel', 'ForEach'), 'exponentialMovingAverageForEach': ('exponentialMovingAverage', 'ForEach'), 'argMinForEach': ('argMin', 'ForEach'), 'topKForEach': ('topK', 'ForEach'), 'quantileDeterministicForEach': ('quantileDeterministic', 'ForEach'), 'maxForEach': ('max', 'ForEach'), 'anyHeavyForEach': ('anyHeavy', 'ForEach'), 'quantileExactForEach': ('quantileExact', 'ForEach'), 'quantilesTimingWeightedForEach': ('quantilesTimingWeighted', 'ForEach'), 'quantilesTimingForEach': ('quantilesTiming', 'ForEach'), 'anyLastForEach': ('anyLast', 'ForEach'), 'sumForEach': ('sum', 'ForEach'), 'rankCorrForEach': ('rankCorr', 'ForEach'), 'sequenceNextNodeForEach': ('sequenceNextNode', 'ForEach'), 'uniqForEach': ('uniq', 'ForEach'), 'quantilesExactLowForEach': ('quantilesExactLow', 'ForEach'), 'stddevSampForEach': ('stddevSamp', 'ForEach'), 'quantileBFloat16WeightedForEach': ('quantileBFloat16Weighted', 'ForEach'), 'quantilesTDigestWeightedForEach': ('quantilesTDigestWeighted', 'ForEach'), 'uniqThetaForEach': ('uniqTheta', 'ForEach'), 'maxMapForEach': ('maxMap', 'ForEach'), 'quantilesExactHighForEach': ('quantilesExactHigh', 'ForEach'), 'varPopForEach': ('varPop', 'ForEach'), 'sparkBarForEach': ('sparkBar', 'ForEach'), 'stochasticLogisticRegressionForEach': ('stochasticLogisticRegression', 'ForEach'), 'quantilesBFloat16ForEach': ('quantilesBFloat16', 'ForEach'), 'last_valueForEach': ('last_value', 'ForEach'), 'quantileExactHighForEach': ('quantileExactHigh', 'ForEach'), 'mannWhitneyUTestForEach': ('mannWhitneyUTest', 'ForEach'), 'stochasticLinearRegressionForEach': ('stochasticLinearRegression', 'ForEach'), 'groupUniqArrayForEach': ('groupUniqArray', 'ForEach'), 'maxIntersectionsForEach': ('maxIntersections', 'ForEach'), 'intervalLengthSumForEach': ('intervalLengthSum', 'ForEach'), 'groupBitOrForEach': ('groupBitOr', 'ForEach'), 'countForEach': ('count', 'ForEach'), 'quantilesBFloat16WeightedForEach': ('quantilesBFloat16Weighted', 'ForEach'), 'deltaSumForEach': ('deltaSum', 'ForEach'), 'quantileGKForEach': ('quantileGK', 'ForEach'), 'meanZTestForEach': ('meanZTest', 'ForEach'), 'groupArraySampleForEach': ('groupArraySample', 'ForEach'), 'covarPopForEach': ('covarPop', 'ForEach'), 'sumMapForEach': ('sumMap', 'ForEach'), 'argMaxForEach': ('argMax', 'ForEach'), 'quantileTDigestForEach': ('quantileTDigest', 'ForEach'), 'corrForEach': ('corr', 'ForEach'), 'groupBitmapOrForEach': ('groupBitmapOr', 'ForEach'), 'quantilesInterpolatedWeightedForEach': ('quantilesInterpolatedWeighted', 'ForEach'), 'largestTriangleThreeBucketsForEach': ('largestTriangleThreeBuckets', 'ForEach'), 'groupBitmapForEach': ('groupBitmap', 'ForEach'), 'quantileTimingForEach': ('quantileTiming', 'ForEach'), 'retentionForEach': ('retention', 'ForEach'), 'groupBitAndForEach': ('groupBitAnd', 'ForEach'), 'first_valueForEach': ('first_value', 'ForEach'), 'quantileInterpolatedWeightedForEach': ('quantileInterpolatedWeighted', 'ForEach'), 'uniqCombinedForEach': ('uniqCombined', 'ForEach'), 'varSampForEach': ('varSamp', 'ForEach'), 'stddevPopForEach': ('stddevPop', 'ForEach'), 'groupBitmapAndForEach': ('groupBitmapAnd', 'ForEach'), 'groupBitmapXorForEach': ('groupBitmapXor', 'ForEach'), 'quantileTDigestWeightedForEach': ('quantileTDigestWeighted', 'ForEach'), 'boundingRatioForEach': ('boundingRatio', 'ForEach'), 'groupBitXorForEach': ('groupBitXor', 'ForEach'), 'anyDistinct': ('any', 'Distinct'), 'uniqUpToDistinct': ('uniqUpTo', 'Distinct'), 'uniqCombined64Distinct': ('uniqCombined64', 'Distinct'), 'minMapDistinct': ('minMap', 'Distinct'), 'sumCountDistinct': ('sumCount', 'Distinct'), 'topKWeightedDistinct': ('topKWeighted', 'Distinct'), 'quantileTimingWeightedDistinct': ('quantileTimingWeighted', 'Distinct'), 'quantilesExactDistinct': ('quantilesExact', 'Distinct'), 'groupArrayDistinct': ('groupArray', 'Distinct'), 'sumWithOverflowDistinct': ('sumWithOverflow', 'Distinct'), 'kurtPopDistinct': ('kurtPop', 'Distinct'), 'minDistinct': ('min', 'Distinct'), 'quantilesDistinct': ('quantiles', 'Distinct'), 'quantileDistinct': ('quantile', 'Distinct'), 'quantileExactLowDistinct': ('quantileExactLow', 'Distinct'), 'groupArrayInsertAtDistinct': ('groupArrayInsertAt', 'Distinct'), 'sumKahanDistinct': ('sumKahan', 'Distinct'), 'covarSampDistinct': ('covarSamp', 'Distinct'), 'groupArrayMovingSumDistinct': ('groupArrayMovingSum', 'Distinct'), 'theilsUDistinct': ('theilsU', 'Distinct'), 'groupArrayLastDistinct': ('groupArrayLast', 'Distinct'), 'histogramDistinct': ('histogram', 'Distinct'), 'skewPopDistinct': ('skewPop', 'Distinct'), 'quantileBFloat16Distinct': ('quantileBFloat16', 'Distinct'), 'maxIntersectionsPositionDistinct': ('maxIntersectionsPosition', 'Distinct'), 'quantileExactWeightedDistinct': ('quantileExactWeighted', 'Distinct'), 'welchTTestDistinct': ('welchTTest', 'Distinct'), 'kolmogorovSmirnovTestDistinct': ('kolmogorovSmirnovTest', 'Distinct'), 'uniqExactDistinct': ('uniqExact', 'Distinct'), 'simpleLinearRegressionDistinct': ('simpleLinearRegression', 'Distinct'), 'groupArrayMovingAvgDistinct': ('groupArrayMovingAvg', 'Distinct'), 'deltaSumTimestampDistinct': ('deltaSumTimestamp', 'Distinct'), 'cramersVBiasCorrectedDistinct': ('cramersVBiasCorrected', 'Distinct'), 'exponentialTimeDecayedAvgDistinct': ('exponentialTimeDecayedAvg', 'Distinct'), 'quantilesGKDistinct': ('quantilesGK', 'Distinct'), 'sequenceCountDistinct': ('sequenceCount', 'Distinct'), 'skewSampDistinct': ('skewSamp', 'Distinct'), 'avgDistinct': ('avg', 'Distinct'), 'avgWeightedDistinct': ('avgWeighted', 'Distinct'), 'sequenceMatchDistinct': ('sequenceMatch', 'Distinct'), 'kurtSampDistinct': ('kurtSamp', 'Distinct'), 'uniqHLL12Distinct': ('uniqHLL12', 'Distinct'), 'quantilesDeterministicDistinct': ('quantilesDeterministic', 'Distinct'), 'cramersVDistinct': ('cramersV', 'Distinct'), 'entropyDistinct': ('entropy', 'Distinct'), 'studentTTestDistinct': ('studentTTest', 'Distinct'), 'medianDistinct': ('median', 'Distinct'), 'contingencyDistinct': ('contingency', 'Distinct'), 'quantilesExactWeightedDistinct': ('quantilesExactWeighted', 'Distinct'), 'quantilesTDigestDistinct': ('quantilesTDigest', 'Distinct'), 'categoricalInformationValueDistinct': ('categoricalInformationValue', 'Distinct'), 'windowFunnelDistinct': ('windowFunnel', 'Distinct'), 'exponentialMovingAverageDistinct': ('exponentialMovingAverage', 'Distinct'), 'argMinDistinct': ('argMin', 'Distinct'), 'topKDistinct': ('topK', 'Distinct'), 'quantileDeterministicDistinct': ('quantileDeterministic', 'Distinct'), 'maxDistinct': ('max', 'Distinct'), 'anyHeavyDistinct': ('anyHeavy', 'Distinct'), 'quantileExactDistinct': ('quantileExact', 'Distinct'), 'quantilesTimingWeightedDistinct': ('quantilesTimingWeighted', 'Distinct'), 'quantilesTimingDistinct': ('quantilesTiming', 'Distinct'), 'anyLastDistinct': ('anyLast', 'Distinct'), 'sumDistinct': ('sum', 'Distinct'), 'rankCorrDistinct': ('rankCorr', 'Distinct'), 'sequenceNextNodeDistinct': ('sequenceNextNode', 'Distinct'), 'uniqDistinct': ('uniq', 'Distinct'), 'quantilesExactLowDistinct': ('quantilesExactLow', 'Distinct'), 'stddevSampDistinct': ('stddevSamp', 'Distinct'), 'quantileBFloat16WeightedDistinct': ('quantileBFloat16Weighted', 'Distinct'), 'quantilesTDigestWeightedDistinct': ('quantilesTDigestWeighted', 'Distinct'), 'uniqThetaDistinct': ('uniqTheta', 'Distinct'), 'maxMapDistinct': ('maxMap', 'Distinct'), 'quantilesExactHighDistinct': ('quantilesExactHigh', 'Distinct'), 'varPopDistinct': ('varPop', 'Distinct'), 'sparkBarDistinct': ('sparkBar', 'Distinct'), 'stochasticLogisticRegressionDistinct': ('stochasticLogisticRegression', 'Distinct'), 'quantilesBFloat16Distinct': ('quantilesBFloat16', 'Distinct'), 'last_valueDistinct': ('last_value', 'Distinct'), 'quantileExactHighDistinct': ('quantileExactHigh', 'Distinct'), 'mannWhitneyUTestDistinct': ('mannWhitneyUTest', 'Distinct'), 'stochasticLinearRegressionDistinct': ('stochasticLinearRegression', 'Distinct'), 'groupUniqArrayDistinct': ('groupUniqArray', 'Distinct'), 'maxIntersectionsDistinct': ('maxIntersections', 'Distinct'), 'intervalLengthSumDistinct': ('intervalLengthSum', 'Distinct'), 'groupBitOrDistinct': ('groupBitOr', 'Distinct'), 'countDistinct': ('count', 'Distinct'), 'quantilesBFloat16WeightedDistinct': ('quantilesBFloat16Weighted', 'Distinct'), 'deltaSumDistinct': ('deltaSum', 'Distinct'), 'quantileGKDistinct': ('quantileGK', 'Distinct'), 'meanZTestDistinct': ('meanZTest', 'Distinct'), 'groupArraySampleDistinct': ('groupArraySample', 'Distinct'), 'covarPopDistinct': ('covarPop', 'Distinct'), 'sumMapDistinct': ('sumMap', 'Distinct'), 'argMaxDistinct': ('argMax', 'Distinct'), 'quantileTDigestDistinct': ('quantileTDigest', 'Distinct'), 'corrDistinct': ('corr', 'Distinct'), 'groupBitmapOrDistinct': ('groupBitmapOr', 'Distinct'), 'quantilesInterpolatedWeightedDistinct': ('quantilesInterpolatedWeighted', 'Distinct'), 'largestTriangleThreeBucketsDistinct': ('largestTriangleThreeBuckets', 'Distinct'), 'groupBitmapDistinct': ('groupBitmap', 'Distinct'), 'quantileTimingDistinct': ('quantileTiming', 'Distinct'), 'retentionDistinct': ('retention', 'Distinct'), 'groupBitAndDistinct': ('groupBitAnd', 'Distinct'), 'first_valueDistinct': ('first_value', 'Distinct'), 'quantileInterpolatedWeightedDistinct': ('quantileInterpolatedWeighted', 'Distinct'), 'uniqCombinedDistinct': ('uniqCombined', 'Distinct'), 'varSampDistinct': ('varSamp', 'Distinct'), 'stddevPopDistinct': ('stddevPop', 'Distinct'), 'groupBitmapAndDistinct': ('groupBitmapAnd', 'Distinct'), 'groupBitmapXorDistinct': ('groupBitmapXor', 'Distinct'), 'quantileTDigestWeightedDistinct': ('quantileTDigestWeighted', 'Distinct'), 'boundingRatioDistinct': ('boundingRatio', 'Distinct'), 'groupBitXorDistinct': ('groupBitXor', 'Distinct'), 'anyOrDefault': ('any', 'OrDefault'), 'uniqUpToOrDefault': ('uniqUpTo', 'OrDefault'), 'uniqCombined64OrDefault': ('uniqCombined64', 'OrDefault'), 'minMapOrDefault': ('minMap', 'OrDefault'), 'sumCountOrDefault': ('sumCount', 'OrDefault'), 'topKWeightedOrDefault': ('topKWeighted', 'OrDefault'), 'quantileTimingWeightedOrDefault': ('quantileTimingWeighted', 'OrDefault'), 'quantilesExactOrDefault': ('quantilesExact', 'OrDefault'), 'groupArrayOrDefault': ('groupArray', 'OrDefault'), 'sumWithOverflowOrDefault': ('sumWithOverflow', 'OrDefault'), 'kurtPopOrDefault': ('kurtPop', 'OrDefault'), 'minOrDefault': ('min', 'OrDefault'), 'quantilesOrDefault': ('quantiles', 'OrDefault'), 'quantileOrDefault': ('quantile', 'OrDefault'), 'quantileExactLowOrDefault': ('quantileExactLow', 'OrDefault'), 'groupArrayInsertAtOrDefault': ('groupArrayInsertAt', 'OrDefault'), 'sumKahanOrDefault': ('sumKahan', 'OrDefault'), 'covarSampOrDefault': ('covarSamp', 'OrDefault'), 'groupArrayMovingSumOrDefault': ('groupArrayMovingSum', 'OrDefault'), 'theilsUOrDefault': ('theilsU', 'OrDefault'), 'groupArrayLastOrDefault': ('groupArrayLast', 'OrDefault'), 'histogramOrDefault': ('histogram', 'OrDefault'), 'skewPopOrDefault': ('skewPop', 'OrDefault'), 'quantileBFloat16OrDefault': ('quantileBFloat16', 'OrDefault'), 'maxIntersectionsPositionOrDefault': ('maxIntersectionsPosition', 'OrDefault'), 'quantileExactWeightedOrDefault': ('quantileExactWeighted', 'OrDefault'), 'welchTTestOrDefault': ('welchTTest', 'OrDefault'), 'kolmogorovSmirnovTestOrDefault': ('kolmogorovSmirnovTest', 'OrDefault'), 'uniqExactOrDefault': ('uniqExact', 'OrDefault'), 'simpleLinearRegressionOrDefault': ('simpleLinearRegression', 'OrDefault'), 'groupArrayMovingAvgOrDefault': ('groupArrayMovingAvg', 'OrDefault'), 'deltaSumTimestampOrDefault': ('deltaSumTimestamp', 'OrDefault'), 'cramersVBiasCorrectedOrDefault': ('cramersVBiasCorrected', 'OrDefault'), 'exponentialTimeDecayedAvgOrDefault': ('exponentialTimeDecayedAvg', 'OrDefault'), 'quantilesGKOrDefault': ('quantilesGK', 'OrDefault'), 'sequenceCountOrDefault': ('sequenceCount', 'OrDefault'), 'skewSampOrDefault': ('skewSamp', 'OrDefault'), 'avgOrDefault': ('avg', 'OrDefault'), 'avgWeightedOrDefault': ('avgWeighted', 'OrDefault'), 'sequenceMatchOrDefault': ('sequenceMatch', 'OrDefault'), 'kurtSampOrDefault': ('kurtSamp', 'OrDefault'), 'uniqHLL12OrDefault': ('uniqHLL12', 'OrDefault'), 'quantilesDeterministicOrDefault': ('quantilesDeterministic', 'OrDefault'), 'cramersVOrDefault': ('cramersV', 'OrDefault'), 'entropyOrDefault': ('entropy', 'OrDefault'), 'studentTTestOrDefault': ('studentTTest', 'OrDefault'), 'medianOrDefault': ('median', 'OrDefault'), 'contingencyOrDefault': ('contingency', 'OrDefault'), 'quantilesExactWeightedOrDefault': ('quantilesExactWeighted', 'OrDefault'), 'quantilesTDigestOrDefault': ('quantilesTDigest', 'OrDefault'), 'categoricalInformationValueOrDefault': ('categoricalInformationValue', 'OrDefault'), 'windowFunnelOrDefault': ('windowFunnel', 'OrDefault'), 'exponentialMovingAverageOrDefault': ('exponentialMovingAverage', 'OrDefault'), 'argMinOrDefault': ('argMin', 'OrDefault'), 'topKOrDefault': ('topK', 'OrDefault'), 'quantileDeterministicOrDefault': ('quantileDeterministic', 'OrDefault'), 'maxOrDefault': ('max', 'OrDefault'), 'anyHeavyOrDefault': ('anyHeavy', 'OrDefault'), 'quantileExactOrDefault': ('quantileExact', 'OrDefault'), 'quantilesTimingWeightedOrDefault': ('quantilesTimingWeighted', 'OrDefault'), 'quantilesTimingOrDefault': ('quantilesTiming', 'OrDefault'), 'anyLastOrDefault': ('anyLast', 'OrDefault'), 'sumOrDefault': ('sum', 'OrDefault'), 'rankCorrOrDefault': ('rankCorr', 'OrDefault'), 'sequenceNextNodeOrDefault': ('sequenceNextNode', 'OrDefault'), 'uniqOrDefault': ('uniq', 'OrDefault'), 'quantilesExactLowOrDefault': ('quantilesExactLow', 'OrDefault'), 'stddevSampOrDefault': ('stddevSamp', 'OrDefault'), 'quantileBFloat16WeightedOrDefault': ('quantileBFloat16Weighted', 'OrDefault'), 'quantilesTDigestWeightedOrDefault': ('quantilesTDigestWeighted', 'OrDefault'), 'uniqThetaOrDefault': ('uniqTheta', 'OrDefault'), 'maxMapOrDefault': ('maxMap', 'OrDefault'), 'quantilesExactHighOrDefault': ('quantilesExactHigh', 'OrDefault'), 'varPopOrDefault': ('varPop', 'OrDefault'), 'sparkBarOrDefault': ('sparkBar', 'OrDefault'), 'stochasticLogisticRegressionOrDefault': ('stochasticLogisticRegression', 'OrDefault'), 'quantilesBFloat16OrDefault': ('quantilesBFloat16', 'OrDefault'), 'last_valueOrDefault': ('last_value', 'OrDefault'), 'quantileExactHighOrDefault': ('quantileExactHigh', 'OrDefault'), 'mannWhitneyUTestOrDefault': ('mannWhitneyUTest', 'OrDefault'), 'stochasticLinearRegressionOrDefault': ('stochasticLinearRegression', 'OrDefault'), 'groupUniqArrayOrDefault': ('groupUniqArray', 'OrDefault'), 'maxIntersectionsOrDefault': ('maxIntersections', 'OrDefault'), 'intervalLengthSumOrDefault': ('intervalLengthSum', 'OrDefault'), 'groupBitOrOrDefault': ('groupBitOr', 'OrDefault'), 'countOrDefault': ('count', 'OrDefault'), 'quantilesBFloat16WeightedOrDefault': ('quantilesBFloat16Weighted', 'OrDefault'), 'deltaSumOrDefault': ('deltaSum', 'OrDefault'), 'quantileGKOrDefault': ('quantileGK', 'OrDefault'), 'meanZTestOrDefault': ('meanZTest', 'OrDefault'), 'groupArraySampleOrDefault': ('groupArraySample', 'OrDefault'), 'covarPopOrDefault': ('covarPop', 'OrDefault'), 'sumMapOrDefault': ('sumMap', 'OrDefault'), 'argMaxOrDefault': ('argMax', 'OrDefault'), 'quantileTDigestOrDefault': ('quantileTDigest', 'OrDefault'), 'corrOrDefault': ('corr', 'OrDefault'), 'groupBitmapOrOrDefault': ('groupBitmapOr', 'OrDefault'), 'quantilesInterpolatedWeightedOrDefault': ('quantilesInterpolatedWeighted', 'OrDefault'), 'largestTriangleThreeBucketsOrDefault': ('largestTriangleThreeBuckets', 'OrDefault'), 'groupBitmapOrDefault': ('groupBitmap', 'OrDefault'), 'quantileTimingOrDefault': ('quantileTiming', 'OrDefault'), 'retentionOrDefault': ('retention', 'OrDefault'), 'groupBitAndOrDefault': ('groupBitAnd', 'OrDefault'), 'first_valueOrDefault': ('first_value', 'OrDefault'), 'quantileInterpolatedWeightedOrDefault': ('quantileInterpolatedWeighted', 'OrDefault'), 'uniqCombinedOrDefault': ('uniqCombined', 'OrDefault'), 'varSampOrDefault': ('varSamp', 'OrDefault'), 'stddevPopOrDefault': ('stddevPop', 'OrDefault'), 'groupBitmapAndOrDefault': ('groupBitmapAnd', 'OrDefault'), 'groupBitmapXorOrDefault': ('groupBitmapXor', 'OrDefault'), 'quantileTDigestWeightedOrDefault': ('quantileTDigestWeighted', 'OrDefault'), 'boundingRatioOrDefault': ('boundingRatio', 'OrDefault'), 'groupBitXorOrDefault': ('groupBitXor', 'OrDefault'), 'anyOrNull': ('any', 'OrNull'), 'uniqUpToOrNull': ('uniqUpTo', 'OrNull'), 'uniqCombined64OrNull': ('uniqCombined64', 'OrNull'), 'minMapOrNull': ('minMap', 'OrNull'), 'sumCountOrNull': ('sumCount', 'OrNull'), 'topKWeightedOrNull': ('topKWeighted', 'OrNull'), 'quantileTimingWeightedOrNull': ('quantileTimingWeighted', 'OrNull'), 'quantilesExactOrNull': ('quantilesExact', 'OrNull'), 'groupArrayOrNull': ('groupArray', 'OrNull'), 'sumWithOverflowOrNull': ('sumWithOverflow', 'OrNull'), 'kurtPopOrNull': ('kurtPop', 'OrNull'), 'minOrNull': ('min', 'OrNull'), 'quantilesOrNull': ('quantiles', 'OrNull'), 'quantileOrNull': ('quantile', 'OrNull'), 'quantileExactLowOrNull': ('quantileExactLow', 'OrNull'), 'groupArrayInsertAtOrNull': ('groupArrayInsertAt', 'OrNull'), 'sumKahanOrNull': ('sumKahan', 'OrNull'), 'covarSampOrNull': ('covarSamp', 'OrNull'), 'groupArrayMovingSumOrNull': ('groupArrayMovingSum', 'OrNull'), 'theilsUOrNull': ('theilsU', 'OrNull'), 'groupArrayLastOrNull': ('groupArrayLast', 'OrNull'), 'histogramOrNull': ('histogram', 'OrNull'), 'skewPopOrNull': ('skewPop', 'OrNull'), 'quantileBFloat16OrNull': ('quantileBFloat16', 'OrNull'), 'maxIntersectionsPositionOrNull': ('maxIntersectionsPosition', 'OrNull'), 'quantileExactWeightedOrNull': ('quantileExactWeighted', 'OrNull'), 'welchTTestOrNull': ('welchTTest', 'OrNull'), 'kolmogorovSmirnovTestOrNull': ('kolmogorovSmirnovTest', 'OrNull'), 'uniqExactOrNull': ('uniqExact', 'OrNull'), 'simpleLinearRegressionOrNull': ('simpleLinearRegression', 'OrNull'), 'groupArrayMovingAvgOrNull': ('groupArrayMovingAvg', 'OrNull'), 'deltaSumTimestampOrNull': ('deltaSumTimestamp', 'OrNull'), 'cramersVBiasCorrectedOrNull': ('cramersVBiasCorrected', 'OrNull'), 'exponentialTimeDecayedAvgOrNull': ('exponentialTimeDecayedAvg', 'OrNull'), 'quantilesGKOrNull': ('quantilesGK', 'OrNull'), 'sequenceCountOrNull': ('sequenceCount', 'OrNull'), 'skewSampOrNull': ('skewSamp', 'OrNull'), 'avgOrNull': ('avg', 'OrNull'), 'avgWeightedOrNull': ('avgWeighted', 'OrNull'), 'sequenceMatchOrNull': ('sequenceMatch', 'OrNull'), 'kurtSampOrNull': ('kurtSamp', 'OrNull'), 'uniqHLL12OrNull': ('uniqHLL12', 'OrNull'), 'quantilesDeterministicOrNull': ('quantilesDeterministic', 'OrNull'), 'cramersVOrNull': ('cramersV', 'OrNull'), 'entropyOrNull': ('entropy', 'OrNull'), 'studentTTestOrNull': ('studentTTest', 'OrNull'), 'medianOrNull': ('median', 'OrNull'), 'contingencyOrNull': ('contingency', 'OrNull'), 'quantilesExactWeightedOrNull': ('quantilesExactWeighted', 'OrNull'), 'quantilesTDigestOrNull': ('quantilesTDigest', 'OrNull'), 'categoricalInformationValueOrNull': ('categoricalInformationValue', 'OrNull'), 'windowFunnelOrNull': ('windowFunnel', 'OrNull'), 'exponentialMovingAverageOrNull': ('exponentialMovingAverage', 'OrNull'), 'argMinOrNull': ('argMin', 'OrNull'), 'topKOrNull': ('topK', 'OrNull'), 'quantileDeterministicOrNull': ('quantileDeterministic', 'OrNull'), 'maxOrNull': ('max', 'OrNull'), 'anyHeavyOrNull': ('anyHeavy', 'OrNull'), 'quantileExactOrNull': ('quantileExact', 'OrNull'), 'quantilesTimingWeightedOrNull': ('quantilesTimingWeighted', 'OrNull'), 'quantilesTimingOrNull': ('quantilesTiming', 'OrNull'), 'anyLastOrNull': ('anyLast', 'OrNull'), 'sumOrNull': ('sum', 'OrNull'), 'rankCorrOrNull': ('rankCorr', 'OrNull'), 'sequenceNextNodeOrNull': ('sequenceNextNode', 'OrNull'), 'uniqOrNull': ('uniq', 'OrNull'), 'quantilesExactLowOrNull': ('quantilesExactLow', 'OrNull'), 'stddevSampOrNull': ('stddevSamp', 'OrNull'), 'quantileBFloat16WeightedOrNull': ('quantileBFloat16Weighted', 'OrNull'), 'quantilesTDigestWeightedOrNull': ('quantilesTDigestWeighted', 'OrNull'), 'uniqThetaOrNull': ('uniqTheta', 'OrNull'), 'maxMapOrNull': ('maxMap', 'OrNull'), 'quantilesExactHighOrNull': ('quantilesExactHigh', 'OrNull'), 'varPopOrNull': ('varPop', 'OrNull'), 'sparkBarOrNull': ('sparkBar', 'OrNull'), 'stochasticLogisticRegressionOrNull': ('stochasticLogisticRegression', 'OrNull'), 'quantilesBFloat16OrNull': ('quantilesBFloat16', 'OrNull'), 'last_valueOrNull': ('last_value', 'OrNull'), 'quantileExactHighOrNull': ('quantileExactHigh', 'OrNull'), 'mannWhitneyUTestOrNull': ('mannWhitneyUTest', 'OrNull'), 'stochasticLinearRegressionOrNull': ('stochasticLinearRegression', 'OrNull'), 'groupUniqArrayOrNull': ('groupUniqArray', 'OrNull'), 'maxIntersectionsOrNull': ('maxIntersections', 'OrNull'), 'intervalLengthSumOrNull': ('intervalLengthSum', 'OrNull'), 'groupBitOrOrNull': ('groupBitOr', 'OrNull'), 'countOrNull': ('count', 'OrNull'), 'quantilesBFloat16WeightedOrNull': ('quantilesBFloat16Weighted', 'OrNull'), 'deltaSumOrNull': ('deltaSum', 'OrNull'), 'quantileGKOrNull': ('quantileGK', 'OrNull'), 'meanZTestOrNull': ('meanZTest', 'OrNull'), 'groupArraySampleOrNull': ('groupArraySample', 'OrNull'), 'covarPopOrNull': ('covarPop', 'OrNull'), 'sumMapOrNull': ('sumMap', 'OrNull'), 'argMaxOrNull': ('argMax', 'OrNull'), 'quantileTDigestOrNull': ('quantileTDigest', 'OrNull'), 'corrOrNull': ('corr', 'OrNull'), 'groupBitmapOrOrNull': ('groupBitmapOr', 'OrNull'), 'quantilesInterpolatedWeightedOrNull': ('quantilesInterpolatedWeighted', 'OrNull'), 'largestTriangleThreeBucketsOrNull': ('largestTriangleThreeBuckets', 'OrNull'), 'groupBitmapOrNull': ('groupBitmap', 'OrNull'), 'quantileTimingOrNull': ('quantileTiming', 'OrNull'), 'retentionOrNull': ('retention', 'OrNull'), 'groupBitAndOrNull': ('groupBitAnd', 'OrNull'), 'first_valueOrNull': ('first_value', 'OrNull'), 'quantileInterpolatedWeightedOrNull': ('quantileInterpolatedWeighted', 'OrNull'), 'uniqCombinedOrNull': ('uniqCombined', 'OrNull'), 'varSampOrNull': ('varSamp', 'OrNull'), 'stddevPopOrNull': ('stddevPop', 'OrNull'), 'groupBitmapAndOrNull': ('groupBitmapAnd', 'OrNull'), 'groupBitmapXorOrNull': ('groupBitmapXor', 'OrNull'), 'quantileTDigestWeightedOrNull': ('quantileTDigestWeighted', 'OrNull'), 'boundingRatioOrNull': ('boundingRatio', 'OrNull'), 'groupBitXorOrNull': ('groupBitXor', 'OrNull'), 'anyResample': ('any', 'Resample'), 'uniqUpToResample': ('uniqUpTo', 'Resample'), 'uniqCombined64Resample': ('uniqCombined64', 'Resample'), 'minMapResample': ('minMap', 'Resample'), 'sumCountResample': ('sumCount', 'Resample'), 'topKWeightedResample': ('topKWeighted', 'Resample'), 'quantileTimingWeightedResample': ('quantileTimingWeighted', 'Resample'), 'quantilesExactResample': ('quantilesExact', 'Resample'), 'groupArrayResample': ('groupArray', 'Resample'), 'sumWithOverflowResample': ('sumWithOverflow', 'Resample'), 'kurtPopResample': ('kurtPop', 'Resample'), 'minResample': ('min', 'Resample'), 'quantilesResample': ('quantiles', 'Resample'), 'quantileResample': ('quantile', 'Resample'), 'quantileExactLowResample': ('quantileExactLow', 'Resample'), 'groupArrayInsertAtResample': ('groupArrayInsertAt', 'Resample'), 'sumKahanResample': ('sumKahan', 'Resample'), 'covarSampResample': ('covarSamp', 'Resample'), 'groupArrayMovingSumResample': ('groupArrayMovingSum', 'Resample'), 'theilsUResample': ('theilsU', 'Resample'), 'groupArrayLastResample': ('groupArrayLast', 'Resample'), 'histogramResample': ('histogram', 'Resample'), 'skewPopResample': ('skewPop', 'Resample'), 'quantileBFloat16Resample': ('quantileBFloat16', 'Resample'), 'maxIntersectionsPositionResample': ('maxIntersectionsPosition', 'Resample'), 'quantileExactWeightedResample': ('quantileExactWeighted', 'Resample'), 'welchTTestResample': ('welchTTest', 'Resample'), 'kolmogorovSmirnovTestResample': ('kolmogorovSmirnovTest', 'Resample'), 'uniqExactResample': ('uniqExact', 'Resample'), 'simpleLinearRegressionResample': ('simpleLinearRegression', 'Resample'), 'groupArrayMovingAvgResample': ('groupArrayMovingAvg', 'Resample'), 'deltaSumTimestampResample': ('deltaSumTimestamp', 'Resample'), 'cramersVBiasCorrectedResample': ('cramersVBiasCorrected', 'Resample'), 'exponentialTimeDecayedAvgResample': ('exponentialTimeDecayedAvg', 'Resample'), 'quantilesGKResample': ('quantilesGK', 'Resample'), 'sequenceCountResample': ('sequenceCount', 'Resample'), 'skewSampResample': ('skewSamp', 'Resample'), 'avgResample': ('avg', 'Resample'), 'avgWeightedResample': ('avgWeighted', 'Resample'), 'sequenceMatchResample': ('sequenceMatch', 'Resample'), 'kurtSampResample': ('kurtSamp', 'Resample'), 'uniqHLL12Resample': ('uniqHLL12', 'Resample'), 'quantilesDeterministicResample': ('quantilesDeterministic', 'Resample'), 'cramersVResample': ('cramersV', 'Resample'), 'entropyResample': ('entropy', 'Resample'), 'studentTTestResample': ('studentTTest', 'Resample'), 'medianResample': ('median', 'Resample'), 'contingencyResample': ('contingency', 'Resample'), 'quantilesExactWeightedResample': ('quantilesExactWeighted', 'Resample'), 'quantilesTDigestResample': ('quantilesTDigest', 'Resample'), 'categoricalInformationValueResample': ('categoricalInformationValue', 'Resample'), 'windowFunnelResample': ('windowFunnel', 'Resample'), 'exponentialMovingAverageResample': ('exponentialMovingAverage', 'Resample'), 'argMinResample': ('argMin', 'Resample'), 'topKResample': ('topK', 'Resample'), 'quantileDeterministicResample': ('quantileDeterministic', 'Resample'), 'maxResample': ('max', 'Resample'), 'anyHeavyResample': ('anyHeavy', 'Resample'), 'quantileExactResample': ('quantileExact', 'Resample'), 'quantilesTimingWeightedResample': ('quantilesTimingWeighted', 'Resample'), 'quantilesTimingResample': ('quantilesTiming', 'Resample'), 'anyLastResample': ('anyLast', 'Resample'), 'sumResample': ('sum', 'Resample'), 'rankCorrResample': ('rankCorr', 'Resample'), 'sequenceNextNodeResample': ('sequenceNextNode', 'Resample'), 'uniqResample': ('uniq', 'Resample'), 'quantilesExactLowResample': ('quantilesExactLow', 'Resample'), 'stddevSampResample': ('stddevSamp', 'Resample'), 'quantileBFloat16WeightedResample': ('quantileBFloat16Weighted', 'Resample'), 'quantilesTDigestWeightedResample': ('quantilesTDigestWeighted', 'Resample'), 'uniqThetaResample': ('uniqTheta', 'Resample'), 'maxMapResample': ('maxMap', 'Resample'), 'quantilesExactHighResample': ('quantilesExactHigh', 'Resample'), 'varPopResample': ('varPop', 'Resample'), 'sparkBarResample': ('sparkBar', 'Resample'), 'stochasticLogisticRegressionResample': ('stochasticLogisticRegression', 'Resample'), 'quantilesBFloat16Resample': ('quantilesBFloat16', 'Resample'), 'last_valueResample': ('last_value', 'Resample'), 'quantileExactHighResample': ('quantileExactHigh', 'Resample'), 'mannWhitneyUTestResample': ('mannWhitneyUTest', 'Resample'), 'stochasticLinearRegressionResample': ('stochasticLinearRegression', 'Resample'), 'groupUniqArrayResample': ('groupUniqArray', 'Resample'), 'maxIntersectionsResample': ('maxIntersections', 'Resample'), 'intervalLengthSumResample': ('intervalLengthSum', 'Resample'), 'groupBitOrResample': ('groupBitOr', 'Resample'), 'countResample': ('count', 'Resample'), 'quantilesBFloat16WeightedResample': ('quantilesBFloat16Weighted', 'Resample'), 'deltaSumResample': ('deltaSum', 'Resample'), 'quantileGKResample': ('quantileGK', 'Resample'), 'meanZTestResample': ('meanZTest', 'Resample'), 'groupArraySampleResample': ('groupArraySample', 'Resample'), 'covarPopResample': ('covarPop', 'Resample'), 'sumMapResample': ('sumMap', 'Resample'), 'argMaxResample': ('argMax', 'Resample'), 'quantileTDigestResample': ('quantileTDigest', 'Resample'), 'corrResample': ('corr', 'Resample'), 'groupBitmapOrResample': ('groupBitmapOr', 'Resample'), 'quantilesInterpolatedWeightedResample': ('quantilesInterpolatedWeighted', 'Resample'), 'largestTriangleThreeBucketsResample': ('largestTriangleThreeBuckets', 'Resample'), 'groupBitmapResample': ('groupBitmap', 'Resample'), 'quantileTimingResample': ('quantileTiming', 'Resample'), 'retentionResample': ('retention', 'Resample'), 'groupBitAndResample': ('groupBitAnd', 'Resample'), 'first_valueResample': ('first_value', 'Resample'), 'quantileInterpolatedWeightedResample': ('quantileInterpolatedWeighted', 'Resample'), 'uniqCombinedResample': ('uniqCombined', 'Resample'), 'varSampResample': ('varSamp', 'Resample'), 'stddevPopResample': ('stddevPop', 'Resample'), 'groupBitmapAndResample': ('groupBitmapAnd', 'Resample'), 'groupBitmapXorResample': ('groupBitmapXor', 'Resample'), 'quantileTDigestWeightedResample': ('quantileTDigestWeighted', 'Resample'), 'boundingRatioResample': ('boundingRatio', 'Resample'), 'groupBitXorResample': ('groupBitXor', 'Resample'), 'anyArgMin': ('any', 'ArgMin'), 'uniqUpToArgMin': ('uniqUpTo', 'ArgMin'), 'uniqCombined64ArgMin': ('uniqCombined64', 'ArgMin'), 'minMapArgMin': ('minMap', 'ArgMin'), 'sumCountArgMin': ('sumCount', 'ArgMin'), 'topKWeightedArgMin': ('topKWeighted', 'ArgMin'), 'quantileTimingWeightedArgMin': ('quantileTimingWeighted', 'ArgMin'), 'quantilesExactArgMin': ('quantilesExact', 'ArgMin'), 'groupArrayArgMin': ('groupArray', 'ArgMin'), 'sumWithOverflowArgMin': ('sumWithOverflow', 'ArgMin'), 'kurtPopArgMin': ('kurtPop', 'ArgMin'), 'minArgMin': ('min', 'ArgMin'), 'quantilesArgMin': ('quantiles', 'ArgMin'), 'quantileArgMin': ('quantile', 'ArgMin'), 'quantileExactLowArgMin': ('quantileExactLow', 'ArgMin'), 'groupArrayInsertAtArgMin': ('groupArrayInsertAt', 'ArgMin'), 'sumKahanArgMin': ('sumKahan', 'ArgMin'), 'covarSampArgMin': ('covarSamp', 'ArgMin'), 'groupArrayMovingSumArgMin': ('groupArrayMovingSum', 'ArgMin'), 'theilsUArgMin': ('theilsU', 'ArgMin'), 'groupArrayLastArgMin': ('groupArrayLast', 'ArgMin'), 'histogramArgMin': ('histogram', 'ArgMin'), 'skewPopArgMin': ('skewPop', 'ArgMin'), 'quantileBFloat16ArgMin': ('quantileBFloat16', 'ArgMin'), 'maxIntersectionsPositionArgMin': ('maxIntersectionsPosition', 'ArgMin'), 'quantileExactWeightedArgMin': ('quantileExactWeighted', 'ArgMin'), 'welchTTestArgMin': ('welchTTest', 'ArgMin'), 'kolmogorovSmirnovTestArgMin': ('kolmogorovSmirnovTest', 'ArgMin'), 'uniqExactArgMin': ('uniqExact', 'ArgMin'), 'simpleLinearRegressionArgMin': ('simpleLinearRegression', 'ArgMin'), 'groupArrayMovingAvgArgMin': ('groupArrayMovingAvg', 'ArgMin'), 'deltaSumTimestampArgMin': ('deltaSumTimestamp', 'ArgMin'), 'cramersVBiasCorrectedArgMin': ('cramersVBiasCorrected', 'ArgMin'), 'exponentialTimeDecayedAvgArgMin': ('exponentialTimeDecayedAvg', 'ArgMin'), 'quantilesGKArgMin': ('quantilesGK', 'ArgMin'), 'sequenceCountArgMin': ('sequenceCount', 'ArgMin'), 'skewSampArgMin': ('skewSamp', 'ArgMin'), 'avgArgMin': ('avg', 'ArgMin'), 'avgWeightedArgMin': ('avgWeighted', 'ArgMin'), 'sequenceMatchArgMin': ('sequenceMatch', 'ArgMin'), 'kurtSampArgMin': ('kurtSamp', 'ArgMin'), 'uniqHLL12ArgMin': ('uniqHLL12', 'ArgMin'), 'quantilesDeterministicArgMin': ('quantilesDeterministic', 'ArgMin'), 'cramersVArgMin': ('cramersV', 'ArgMin'), 'entropyArgMin': ('entropy', 'ArgMin'), 'studentTTestArgMin': ('studentTTest', 'ArgMin'), 'medianArgMin': ('median', 'ArgMin'), 'contingencyArgMin': ('contingency', 'ArgMin'), 'quantilesExactWeightedArgMin': ('quantilesExactWeighted', 'ArgMin'), 'quantilesTDigestArgMin': ('quantilesTDigest', 'ArgMin'), 'categoricalInformationValueArgMin': ('categoricalInformationValue', 'ArgMin'), 'windowFunnelArgMin': ('windowFunnel', 'ArgMin'), 'exponentialMovingAverageArgMin': ('exponentialMovingAverage', 'ArgMin'), 'argMinArgMin': ('argMin', 'ArgMin'), 'topKArgMin': ('topK', 'ArgMin'), 'quantileDeterministicArgMin': ('quantileDeterministic', 'ArgMin'), 'maxArgMin': ('max', 'ArgMin'), 'anyHeavyArgMin': ('anyHeavy', 'ArgMin'), 'quantileExactArgMin': ('quantileExact', 'ArgMin'), 'quantilesTimingWeightedArgMin': ('quantilesTimingWeighted', 'ArgMin'), 'quantilesTimingArgMin': ('quantilesTiming', 'ArgMin'), 'anyLastArgMin': ('anyLast', 'ArgMin'), 'sumArgMin': ('sum', 'ArgMin'), 'rankCorrArgMin': ('rankCorr', 'ArgMin'), 'sequenceNextNodeArgMin': ('sequenceNextNode', 'ArgMin'), 'uniqArgMin': ('uniq', 'ArgMin'), 'quantilesExactLowArgMin': ('quantilesExactLow', 'ArgMin'), 'stddevSampArgMin': ('stddevSamp', 'ArgMin'), 'quantileBFloat16WeightedArgMin': ('quantileBFloat16Weighted', 'ArgMin'), 'quantilesTDigestWeightedArgMin': ('quantilesTDigestWeighted', 'ArgMin'), 'uniqThetaArgMin': ('uniqTheta', 'ArgMin'), 'maxMapArgMin': ('maxMap', 'ArgMin'), 'quantilesExactHighArgMin': ('quantilesExactHigh', 'ArgMin'), 'varPopArgMin': ('varPop', 'ArgMin'), 'sparkBarArgMin': ('sparkBar', 'ArgMin'), 'stochasticLogisticRegressionArgMin': ('stochasticLogisticRegression', 'ArgMin'), 'quantilesBFloat16ArgMin': ('quantilesBFloat16', 'ArgMin'), 'last_valueArgMin': ('last_value', 'ArgMin'), 'quantileExactHighArgMin': ('quantileExactHigh', 'ArgMin'), 'mannWhitneyUTestArgMin': ('mannWhitneyUTest', 'ArgMin'), 'stochasticLinearRegressionArgMin': ('stochasticLinearRegression', 'ArgMin'), 'groupUniqArrayArgMin': ('groupUniqArray', 'ArgMin'), 'maxIntersectionsArgMin': ('maxIntersections', 'ArgMin'), 'intervalLengthSumArgMin': ('intervalLengthSum', 'ArgMin'), 'groupBitOrArgMin': ('groupBitOr', 'ArgMin'), 'countArgMin': ('count', 'ArgMin'), 'quantilesBFloat16WeightedArgMin': ('quantilesBFloat16Weighted', 'ArgMin'), 'deltaSumArgMin': ('deltaSum', 'ArgMin'), 'quantileGKArgMin': ('quantileGK', 'ArgMin'), 'meanZTestArgMin': ('meanZTest', 'ArgMin'), 'groupArraySampleArgMin': ('groupArraySample', 'ArgMin'), 'covarPopArgMin': ('covarPop', 'ArgMin'), 'sumMapArgMin': ('sumMap', 'ArgMin'), 'argMaxArgMin': ('argMax', 'ArgMin'), 'quantileTDigestArgMin': ('quantileTDigest', 'ArgMin'), 'corrArgMin': ('corr', 'ArgMin'), 'groupBitmapOrArgMin': ('groupBitmapOr', 'ArgMin'), 'quantilesInterpolatedWeightedArgMin': ('quantilesInterpolatedWeighted', 'ArgMin'), 'largestTriangleThreeBucketsArgMin': ('largestTriangleThreeBuckets', 'ArgMin'), 'groupBitmapArgMin': ('groupBitmap', 'ArgMin'), 'quantileTimingArgMin': ('quantileTiming', 'ArgMin'), 'retentionArgMin': ('retention', 'ArgMin'), 'groupBitAndArgMin': ('groupBitAnd', 'ArgMin'), 'first_valueArgMin': ('first_value', 'ArgMin'), 'quantileInterpolatedWeightedArgMin': ('quantileInterpolatedWeighted', 'ArgMin'), 'uniqCombinedArgMin': ('uniqCombined', 'ArgMin'), 'varSampArgMin': ('varSamp', 'ArgMin'), 'stddevPopArgMin': ('stddevPop', 'ArgMin'), 'groupBitmapAndArgMin': ('groupBitmapAnd', 'ArgMin'), 'groupBitmapXorArgMin': ('groupBitmapXor', 'ArgMin'), 'quantileTDigestWeightedArgMin': ('quantileTDigestWeighted', 'ArgMin'), 'boundingRatioArgMin': ('boundingRatio', 'ArgMin'), 'groupBitXorArgMin': ('groupBitXor', 'ArgMin'), 'anyArgMax': ('any', 'ArgMax'), 'uniqUpToArgMax': ('uniqUpTo', 'ArgMax'), 'uniqCombined64ArgMax': ('uniqCombined64', 'ArgMax'), 'minMapArgMax': ('minMap', 'ArgMax'), 'sumCountArgMax': ('sumCount', 'ArgMax'), 'topKWeightedArgMax': ('topKWeighted', 'ArgMax'), 'quantileTimingWeightedArgMax': ('quantileTimingWeighted', 'ArgMax'), 'quantilesExactArgMax': ('quantilesExact', 'ArgMax'), 'groupArrayArgMax': ('groupArray', 'ArgMax'), 'sumWithOverflowArgMax': ('sumWithOverflow', 'ArgMax'), 'kurtPopArgMax': ('kurtPop', 'ArgMax'), 'minArgMax': ('min', 'ArgMax'), 'quantilesArgMax': ('quantiles', 'ArgMax'), 'quantileArgMax': ('quantile', 'ArgMax'), 'quantileExactLowArgMax': ('quantileExactLow', 'ArgMax'), 'groupArrayInsertAtArgMax': ('groupArrayInsertAt', 'ArgMax'), 'sumKahanArgMax': ('sumKahan', 'ArgMax'), 'covarSampArgMax': ('covarSamp', 'ArgMax'), 'groupArrayMovingSumArgMax': ('groupArrayMovingSum', 'ArgMax'), 'theilsUArgMax': ('theilsU', 'ArgMax'), 'groupArrayLastArgMax': ('groupArrayLast', 'ArgMax'), 'histogramArgMax': ('histogram', 'ArgMax'), 'skewPopArgMax': ('skewPop', 'ArgMax'), 'quantileBFloat16ArgMax': ('quantileBFloat16', 'ArgMax'), 'maxIntersectionsPositionArgMax': ('maxIntersectionsPosition', 'ArgMax'), 'quantileExactWeightedArgMax': ('quantileExactWeighted', 'ArgMax'), 'welchTTestArgMax': ('welchTTest', 'ArgMax'), 'kolmogorovSmirnovTestArgMax': ('kolmogorovSmirnovTest', 'ArgMax'), 'uniqExactArgMax': ('uniqExact', 'ArgMax'), 'simpleLinearRegressionArgMax': ('simpleLinearRegression', 'ArgMax'), 'groupArrayMovingAvgArgMax': ('groupArrayMovingAvg', 'ArgMax'), 'deltaSumTimestampArgMax': ('deltaSumTimestamp', 'ArgMax'), 'cramersVBiasCorrectedArgMax': ('cramersVBiasCorrected', 'ArgMax'), 'exponentialTimeDecayedAvgArgMax': ('exponentialTimeDecayedAvg', 'ArgMax'), 'quantilesGKArgMax': ('quantilesGK', 'ArgMax'), 'sequenceCountArgMax': ('sequenceCount', 'ArgMax'), 'skewSampArgMax': ('skewSamp', 'ArgMax'), 'avgArgMax': ('avg', 'ArgMax'), 'avgWeightedArgMax': ('avgWeighted', 'ArgMax'), 'sequenceMatchArgMax': ('sequenceMatch', 'ArgMax'), 'kurtSampArgMax': ('kurtSamp', 'ArgMax'), 'uniqHLL12ArgMax': ('uniqHLL12', 'ArgMax'), 'quantilesDeterministicArgMax': ('quantilesDeterministic', 'ArgMax'), 'cramersVArgMax': ('cramersV', 'ArgMax'), 'entropyArgMax': ('entropy', 'ArgMax'), 'studentTTestArgMax': ('studentTTest', 'ArgMax'), 'medianArgMax': ('median', 'ArgMax'), 'contingencyArgMax': ('contingency', 'ArgMax'), 'quantilesExactWeightedArgMax': ('quantilesExactWeighted', 'ArgMax'), 'quantilesTDigestArgMax': ('quantilesTDigest', 'ArgMax'), 'categoricalInformationValueArgMax': ('categoricalInformationValue', 'ArgMax'), 'windowFunnelArgMax': ('windowFunnel', 'ArgMax'), 'exponentialMovingAverageArgMax': ('exponentialMovingAverage', 'ArgMax'), 'argMinArgMax': ('argMin', 'ArgMax'), 'topKArgMax': ('topK', 'ArgMax'), 'quantileDeterministicArgMax': ('quantileDeterministic', 'ArgMax'), 'maxArgMax': ('max', 'ArgMax'), 'anyHeavyArgMax': ('anyHeavy', 'ArgMax'), 'quantileExactArgMax': ('quantileExact', 'ArgMax'), 'quantilesTimingWeightedArgMax': ('quantilesTimingWeighted', 'ArgMax'), 'quantilesTimingArgMax': ('quantilesTiming', 'ArgMax'), 'anyLastArgMax': ('anyLast', 'ArgMax'), 'sumArgMax': ('sum', 'ArgMax'), 'rankCorrArgMax': ('rankCorr', 'ArgMax'), 'sequenceNextNodeArgMax': ('sequenceNextNode', 'ArgMax'), 'uniqArgMax': ('uniq', 'ArgMax'), 'quantilesExactLowArgMax': ('quantilesExactLow', 'ArgMax'), 'stddevSampArgMax': ('stddevSamp', 'ArgMax'), 'quantileBFloat16WeightedArgMax': ('quantileBFloat16Weighted', 'ArgMax'), 'quantilesTDigestWeightedArgMax': ('quantilesTDigestWeighted', 'ArgMax'), 'uniqThetaArgMax': ('uniqTheta', 'ArgMax'), 'maxMapArgMax': ('maxMap', 'ArgMax'), 'quantilesExactHighArgMax': ('quantilesExactHigh', 'ArgMax'), 'varPopArgMax': ('varPop', 'ArgMax'), 'sparkBarArgMax': ('sparkBar', 'ArgMax'), 'stochasticLogisticRegressionArgMax': ('stochasticLogisticRegression', 'ArgMax'), 'quantilesBFloat16ArgMax': ('quantilesBFloat16', 'ArgMax'), 'last_valueArgMax': ('last_value', 'ArgMax'), 'quantileExactHighArgMax': ('quantileExactHigh', 'ArgMax'), 'mannWhitneyUTestArgMax': ('mannWhitneyUTest', 'ArgMax'), 'stochasticLinearRegressionArgMax': ('stochasticLinearRegression', 'ArgMax'), 'groupUniqArrayArgMax': ('groupUniqArray', 'ArgMax'), 'maxIntersectionsArgMax': ('maxIntersections', 'ArgMax'), 'intervalLengthSumArgMax': ('intervalLengthSum', 'ArgMax'), 'groupBitOrArgMax': ('groupBitOr', 'ArgMax'), 'countArgMax': ('count', 'ArgMax'), 'quantilesBFloat16WeightedArgMax': ('quantilesBFloat16Weighted', 'ArgMax'), 'deltaSumArgMax': ('deltaSum', 'ArgMax'), 'quantileGKArgMax': ('quantileGK', 'ArgMax'), 'meanZTestArgMax': ('meanZTest', 'ArgMax'), 'groupArraySampleArgMax': ('groupArraySample', 'ArgMax'), 'covarPopArgMax': ('covarPop', 'ArgMax'), 'sumMapArgMax': ('sumMap', 'ArgMax'), 'argMaxArgMax': ('argMax', 'ArgMax'), 'quantileTDigestArgMax': ('quantileTDigest', 'ArgMax'), 'corrArgMax': ('corr', 'ArgMax'), 'groupBitmapOrArgMax': ('groupBitmapOr', 'ArgMax'), 'quantilesInterpolatedWeightedArgMax': ('quantilesInterpolatedWeighted', 'ArgMax'), 'largestTriangleThreeBucketsArgMax': ('largestTriangleThreeBuckets', 'ArgMax'), 'groupBitmapArgMax': ('groupBitmap', 'ArgMax'), 'quantileTimingArgMax': ('quantileTiming', 'ArgMax'), 'retentionArgMax': ('retention', 'ArgMax'), 'groupBitAndArgMax': ('groupBitAnd', 'ArgMax'), 'first_valueArgMax': ('first_value', 'ArgMax'), 'quantileInterpolatedWeightedArgMax': ('quantileInterpolatedWeighted', 'ArgMax'), 'uniqCombinedArgMax': ('uniqCombined', 'ArgMax'), 'varSampArgMax': ('varSamp', 'ArgMax'), 'stddevPopArgMax': ('stddevPop', 'ArgMax'), 'groupBitmapAndArgMax': ('groupBitmapAnd', 'ArgMax'), 'groupBitmapXorArgMax': ('groupBitmapXor', 'ArgMax'), 'quantileTDigestWeightedArgMax': ('quantileTDigestWeighted', 'ArgMax'), 'boundingRatioArgMax': ('boundingRatio', 'ArgMax'), 'groupBitXorArgMax': ('groupBitXor', 'ArgMax'), 'any': ('any', ''), 'uniqUpTo': ('uniqUpTo', ''), 'uniqCombined64': ('uniqCombined64', ''), 'sumCount': ('sumCount', ''), 'topKWeighted': ('topKWeighted', ''), 'quantileTimingWeighted': ('quantileTimingWeighted', ''), 'quantilesExact': ('quantilesExact', ''), 'groupArray': ('groupArray', ''), 'sumWithOverflow': ('sumWithOverflow', ''), 'kurtPop': ('kurtPop', ''), 'min': ('min', ''), 'quantiles': ('quantiles', ''), 'quantile': ('quantile', ''), 'quantileExactLow': ('quantileExactLow', ''), 'groupArrayInsertAt': ('groupArrayInsertAt', ''), 'sumKahan': ('sumKahan', ''), 'covarSamp': ('covarSamp', ''), 'groupArrayMovingSum': ('groupArrayMovingSum', ''), 'theilsU': ('theilsU', ''), 'groupArrayLast': ('groupArrayLast', ''), 'histogram': ('histogram', ''), 'skewPop': ('skewPop', ''), 'quantileBFloat16': ('quantileBFloat16', ''), 'maxIntersectionsPosition': ('maxIntersectionsPosition', ''), 'quantileExactWeighted': ('quantileExactWeighted', ''), 'welchTTest': ('welchTTest', ''), 'kolmogorovSmirnovTest': ('kolmogorovSmirnovTest', ''), 'uniqExact': ('uniqExact', ''), 'simpleLinearRegression': ('simpleLinearRegression', ''), 'groupArrayMovingAvg': ('groupArrayMovingAvg', ''), 'deltaSumTimestamp': ('deltaSumTimestamp', ''), 'cramersVBiasCorrected': ('cramersVBiasCorrected', ''), 'exponentialTimeDecayedAvg': ('exponentialTimeDecayedAvg', ''), 'quantilesGK': ('quantilesGK', ''), 'sequenceCount': ('sequenceCount', ''), 'skewSamp': ('skewSamp', ''), 'avg': ('avg', ''), 'avgWeighted': ('avgWeighted', ''), 'sequenceMatch': ('sequenceMatch', ''), 'kurtSamp': ('kurtSamp', ''), 'uniqHLL12': ('uniqHLL12', ''), 'quantilesDeterministic': ('quantilesDeterministic', ''), 'cramersV': ('cramersV', ''), 'entropy': ('entropy', ''), 'studentTTest': ('studentTTest', ''), 'median': ('median', ''), 'contingency': ('contingency', ''), 'quantilesExactWeighted': ('quantilesExactWeighted', ''), 'quantilesTDigest': ('quantilesTDigest', ''), 'categoricalInformationValue': ('categoricalInformationValue', ''), 'windowFunnel': ('windowFunnel', ''), 'exponentialMovingAverage': ('exponentialMovingAverage', ''), 'argMin': ('argMin', ''), 'topK': ('topK', ''), 'quantileDeterministic': ('quantileDeterministic', ''), 'max': ('max', ''), 'anyHeavy': ('anyHeavy', ''), 'quantileExact': ('quantileExact', ''), 'quantilesTimingWeighted': ('quantilesTimingWeighted', ''), 'quantilesTiming': ('quantilesTiming', ''), 'anyLast': ('anyLast', ''), 'sum': ('sum', ''), 'rankCorr': ('rankCorr', ''), 'sequenceNextNode': ('sequenceNextNode', ''), 'uniq': ('uniq', ''), 'quantilesExactLow': ('quantilesExactLow', ''), 'stddevSamp': ('stddevSamp', ''), 'quantileBFloat16Weighted': ('quantileBFloat16Weighted', ''), 'quantilesTDigestWeighted': ('quantilesTDigestWeighted', ''), 'uniqTheta': ('uniqTheta', ''), 'quantilesExactHigh': ('quantilesExactHigh', ''), 'varPop': ('varPop', ''), 'sparkBar': ('sparkBar', ''), 'stochasticLogisticRegression': ('stochasticLogisticRegression', ''), 'quantilesBFloat16': ('quantilesBFloat16', ''), 'last_value': ('last_value', ''), 'quantileExactHigh': ('quantileExactHigh', ''), 'mannWhitneyUTest': ('mannWhitneyUTest', ''), 'stochasticLinearRegression': ('stochasticLinearRegression', ''), 'groupUniqArray': ('groupUniqArray', ''), 'maxIntersections': ('maxIntersections', ''), 'intervalLengthSum': ('intervalLengthSum', ''), 'groupBitOr': ('groupBitOr', ''), 'count': ('count', ''), 'quantilesBFloat16Weighted': ('quantilesBFloat16Weighted', ''), 'deltaSum': ('deltaSum', ''), 'quantileGK': ('quantileGK', ''), 'meanZTest': ('meanZTest', ''), 'groupArraySample': ('groupArraySample', ''), 'covarPop': ('covarPop', ''), 'argMax': ('argMax', ''), 'quantileTDigest': ('quantileTDigest', ''), 'corr': ('corr', ''), 'groupBitmapOr': ('groupBitmapOr', ''), 'quantilesInterpolatedWeighted': ('quantilesInterpolatedWeighted', ''), 'largestTriangleThreeBuckets': ('largestTriangleThreeBuckets', ''), 'groupBitmap': ('groupBitmap', ''), 'quantileTiming': ('quantileTiming', ''), 'retention': ('retention', ''), 'groupBitAnd': ('groupBitAnd', ''), 'first_value': ('first_value', ''), 'quantileInterpolatedWeighted': ('quantileInterpolatedWeighted', ''), 'uniqCombined': ('uniqCombined', ''), 'varSamp': ('varSamp', ''), 'stddevPop': ('stddevPop', ''), 'groupBitmapAnd': ('groupBitmapAnd', ''), 'groupBitmapXor': ('groupBitmapXor', ''), 'quantileTDigestWeighted': ('quantileTDigestWeighted', ''), 'boundingRatio': ('boundingRatio', ''), 'groupBitXor': ('groupBitXor', '')}
FUNCTIONS_WITH_ALIASED_ARGS = {'STRUCT', 'TUPLE'}
FUNCTION_PARSERS = {'CAST': <function Parser.<lambda>>, 'CONVERT': <function Parser.<lambda>>, 'DECODE': <function Parser.<lambda>>, 'EXTRACT': <function Parser.<lambda>>, 'GAP_FILL': <function Parser.<lambda>>, 'JSON_OBJECT': <function Parser.<lambda>>, 'JSON_OBJECTAGG': <function Parser.<lambda>>, 'JSON_TABLE': <function Parser.<lambda>>, 'OPENJSON': <function Parser.<lambda>>, 'POSITION': <function Parser.<lambda>>, 'PREDICT': <function Parser.<lambda>>, 'SAFE_CAST': <function Parser.<lambda>>, 'STRING_AGG': <function Parser.<lambda>>, 'SUBSTRING': <function Parser.<lambda>>, 'TRIM': <function Parser.<lambda>>, 'TRY_CAST': <function Parser.<lambda>>, 'TRY_CONVERT': <function Parser.<lambda>>, 'ARRAYJOIN': <function ClickHouse.Parser.<lambda>>, 'QUANTILE': <function ClickHouse.Parser.<lambda>>}
NO_PAREN_FUNCTION_PARSERS = {'CASE': <function Parser.<lambda>>, 'CONNECT_BY_ROOT': <function Parser.<lambda>>, 'IF': <function Parser.<lambda>>, 'NEXT': <function Parser.<lambda>>}
RANGE_PARSERS = {<TokenType.BETWEEN: 'BETWEEN'>: <function Parser.<lambda>>, <TokenType.GLOB: 'GLOB'>: <function binary_range_parser.<locals>._parse_binary_range>, <TokenType.ILIKE: 'ILIKE'>: <function binary_range_parser.<locals>._parse_binary_range>, <TokenType.IN: 'IN'>: <function Parser.<lambda>>, <TokenType.IRLIKE: 'IRLIKE'>: <function binary_range_parser.<locals>._parse_binary_range>, <TokenType.IS: 'IS'>: <function Parser.<lambda>>, <TokenType.LIKE: 'LIKE'>: <function binary_range_parser.<locals>._parse_binary_range>, <TokenType.OVERLAPS: 'OVERLAPS'>: <function binary_range_parser.<locals>._parse_binary_range>, <TokenType.RLIKE: 'RLIKE'>: <function binary_range_parser.<locals>._parse_binary_range>, <TokenType.SIMILAR_TO: 'SIMILAR_TO'>: <function binary_range_parser.<locals>._parse_binary_range>, <TokenType.FOR: 'FOR'>: <function Parser.<lambda>>, <TokenType.GLOBAL: 'GLOBAL'>: <function ClickHouse.Parser.<lambda>>}
COLUMN_OPERATORS = {<TokenType.DOT: 'DOT'>: None, <TokenType.DCOLON: 'DCOLON'>: <function Parser.<lambda>>, <TokenType.ARROW: 'ARROW'>: <function Parser.<lambda>>, <TokenType.DARROW: 'DARROW'>: <function Parser.<lambda>>, <TokenType.HASH_ARROW: 'HASH_ARROW'>: <function Parser.<lambda>>, <TokenType.DHASH_ARROW: 'DHASH_ARROW'>: <function Parser.<lambda>>}
JOIN_KINDS = {<TokenType.STRAIGHT_JOIN: 'STRAIGHT_JOIN'>, <TokenType.CROSS: 'CROSS'>, <TokenType.SEMI: 'SEMI'>, <TokenType.OUTER: 'OUTER'>, <TokenType.ANY: 'ANY'>, <TokenType.INNER: 'INNER'>, <TokenType.ASOF: 'ASOF'>, <TokenType.ANTI: 'ANTI'>, <TokenType.ARRAY: 'ARRAY'>}
TABLE_ALIAS_TOKENS = {<TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.TAG: 'TAG'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.TIME: 'TIME'>, <TokenType.COPY: 'COPY'>, <TokenType.DELETE: 'DELETE'>, <TokenType.INT256: 'INT256'>, <TokenType.TRUE: 'TRUE'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.FILTER: 'FILTER'>, <TokenType.CACHE: 'CACHE'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.ROWS: 'ROWS'>, <TokenType.NESTED: 'NESTED'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.KEEP: 'KEEP'>, <TokenType.CASE: 'CASE'>, <TokenType.KILL: 'KILL'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.UINT128: 'UINT128'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.STREAMLIT: 'STREAMLIT'>, <TokenType.IPV6: 'IPV6'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.BINARY: 'BINARY'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.ROW: 'ROW'>, <TokenType.TEXT: 'TEXT'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.USE: 'USE'>, <TokenType.INDEX: 'INDEX'>, <TokenType.IPV4: 'IPV4'>, <TokenType.INT128: 'INT128'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.TABLE: 'TABLE'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.STRAIGHT_JOIN: 'STRAIGHT_JOIN'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.LIST: 'LIST'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.ALL: 'ALL'>, <TokenType.MAP: 'MAP'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.NULL: 'NULL'>, <TokenType.ROLLUP: 'ROLLUP'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.MONEY: 'MONEY'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.VIEW: 'VIEW'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.NEXT: 'NEXT'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.ORDINALITY: 'ORDINALITY'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.SUPER: 'SUPER'>, <TokenType.END: 'END'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.CHAR: 'CHAR'>, <TokenType.WAREHOUSE: 'WAREHOUSE'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.UINT: 'UINT'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.TOP: 'TOP'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.SOME: 'SOME'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.DESC: 'DESC'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.RANGE: 'RANGE'>, <TokenType.FIRST: 'FIRST'>, <TokenType.UUID: 'UUID'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.MODEL: 'MODEL'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.MERGE: 'MERGE'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.VAR: 'VAR'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.NAME: 'NAME'>, <TokenType.JSON: 'JSON'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.IS: 'IS'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.YEAR: 'YEAR'>, <TokenType.XML: 'XML'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.DATE32: 'DATE32'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.JSONB: 'JSONB'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.BIT: 'BIT'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.UNIQUEIDENTIFIER: 'UNIQUEIDENTIFIER'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.LOAD: 'LOAD'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.UINT256: 'UINT256'>, <TokenType.DIV: 'DIV'>, <TokenType.SHOW: 'SHOW'>, <TokenType.ASC: 'ASC'>, <TokenType.INT: 'INT'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.INET: 'INET'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.REFERENCES: 'REFERENCES'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.FALSE: 'FALSE'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.ENUM: 'ENUM'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.UNIQUE: 'UNIQUE'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.SET: 'SET'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.DATE: 'DATE'>, <TokenType.STORAGE_INTEGRATION: 'STORAGE_INTEGRATION'>, <TokenType.PROCEDURE: 'PROCEDURE'>}
ALIAS_TOKENS = {<TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.FINAL: 'FINAL'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.TAG: 'TAG'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.TIME: 'TIME'>, <TokenType.COPY: 'COPY'>, <TokenType.DELETE: 'DELETE'>, <TokenType.ASOF: 'ASOF'>, <TokenType.INT256: 'INT256'>, <TokenType.TRUE: 'TRUE'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.ANTI: 'ANTI'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.FILTER: 'FILTER'>, <TokenType.CACHE: 'CACHE'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.ROWS: 'ROWS'>, <TokenType.NESTED: 'NESTED'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.KEEP: 'KEEP'>, <TokenType.CASE: 'CASE'>, <TokenType.KILL: 'KILL'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.UINT128: 'UINT128'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.STREAMLIT: 'STREAMLIT'>, <TokenType.IPV6: 'IPV6'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.WINDOW: 'WINDOW'>, <TokenType.BINARY: 'BINARY'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.ROW: 'ROW'>, <TokenType.TEXT: 'TEXT'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.USE: 'USE'>, <TokenType.INDEX: 'INDEX'>, <TokenType.IPV4: 'IPV4'>, <TokenType.INT128: 'INT128'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.TABLE: 'TABLE'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.SETTINGS: 'SETTINGS'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.LIST: 'LIST'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.ALL: 'ALL'>, <TokenType.MAP: 'MAP'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.NULL: 'NULL'>, <TokenType.LEFT: 'LEFT'>, <TokenType.SEMI: 'SEMI'>, <TokenType.ROLLUP: 'ROLLUP'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.MONEY: 'MONEY'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.NATURAL: 'NATURAL'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.VIEW: 'VIEW'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.NEXT: 'NEXT'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.ORDINALITY: 'ORDINALITY'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.SUPER: 'SUPER'>, <TokenType.END: 'END'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.CHAR: 'CHAR'>, <TokenType.WAREHOUSE: 'WAREHOUSE'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.UINT: 'UINT'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.TOP: 'TOP'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.SOME: 'SOME'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.DESC: 'DESC'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.RANGE: 'RANGE'>, <TokenType.FIRST: 'FIRST'>, <TokenType.UUID: 'UUID'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.MODEL: 'MODEL'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.MERGE: 'MERGE'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.VAR: 'VAR'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.NAME: 'NAME'>, <TokenType.JSON: 'JSON'>, <TokenType.FULL: 'FULL'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.IS: 'IS'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.YEAR: 'YEAR'>, <TokenType.XML: 'XML'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.DATE32: 'DATE32'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.JSONB: 'JSONB'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.BIT: 'BIT'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.UNIQUEIDENTIFIER: 'UNIQUEIDENTIFIER'>, <TokenType.APPLY: 'APPLY'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.LOAD: 'LOAD'>, <TokenType.RIGHT: 'RIGHT'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.UINT256: 'UINT256'>, <TokenType.DIV: 'DIV'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.SHOW: 'SHOW'>, <TokenType.ASC: 'ASC'>, <TokenType.INT: 'INT'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.INET: 'INET'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.ANY: 'ANY'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.REFERENCES: 'REFERENCES'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.FALSE: 'FALSE'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.ENUM: 'ENUM'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.UNIQUE: 'UNIQUE'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.SET: 'SET'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.DATE: 'DATE'>, <TokenType.STORAGE_INTEGRATION: 'STORAGE_INTEGRATION'>, <TokenType.PROCEDURE: 'PROCEDURE'>}
LOG_DEFAULTS_TO_LN = True
QUERY_MODIFIER_PARSERS = {<TokenType.MATCH_RECOGNIZE: 'MATCH_RECOGNIZE'>: <function Parser.<lambda>>, <TokenType.PREWHERE: 'PREWHERE'>: <function Parser.<lambda>>, <TokenType.WHERE: 'WHERE'>: <function Parser.<lambda>>, <TokenType.GROUP_BY: 'GROUP_BY'>: <function Parser.<lambda>>, <TokenType.HAVING: 'HAVING'>: <function Parser.<lambda>>, <TokenType.QUALIFY: 'QUALIFY'>: <function Parser.<lambda>>, <TokenType.WINDOW: 'WINDOW'>: <function Parser.<lambda>>, <TokenType.ORDER_BY: 'ORDER_BY'>: <function Parser.<lambda>>, <TokenType.LIMIT: 'LIMIT'>: <function Parser.<lambda>>, <TokenType.FETCH: 'FETCH'>: <function Parser.<lambda>>, <TokenType.OFFSET: 'OFFSET'>: <function Parser.<lambda>>, <TokenType.FOR: 'FOR'>: <function Parser.<lambda>>, <TokenType.LOCK: 'LOCK'>: <function Parser.<lambda>>, <TokenType.TABLE_SAMPLE: 'TABLE_SAMPLE'>: <function Parser.<lambda>>, <TokenType.USING: 'USING'>: <function Parser.<lambda>>, <TokenType.CLUSTER_BY: 'CLUSTER_BY'>: <function Parser.<lambda>>, <TokenType.DISTRIBUTE_BY: 'DISTRIBUTE_BY'>: <function Parser.<lambda>>, <TokenType.SORT_BY: 'SORT_BY'>: <function Parser.<lambda>>, <TokenType.CONNECT_BY: 'CONNECT_BY'>: <function Parser.<lambda>>, <TokenType.START_WITH: 'START_WITH'>: <function Parser.<lambda>>, <TokenType.SETTINGS: 'SETTINGS'>: <function ClickHouse.Parser.<lambda>>, <TokenType.FORMAT: 'FORMAT'>: <function ClickHouse.Parser.<lambda>>}
CONSTRAINT_PARSERS = {'AUTOINCREMENT': <function Parser.<lambda>>, 'AUTO_INCREMENT': <function Parser.<lambda>>, 'CASESPECIFIC': <function Parser.<lambda>>, 'CHARACTER SET': <function Parser.<lambda>>, 'CHECK': <function Parser.<lambda>>, 'COLLATE': <function Parser.<lambda>>, 'COMMENT': <function Parser.<lambda>>, 'COMPRESS': <function Parser.<lambda>>, 'CLUSTERED': <function Parser.<lambda>>, 'NONCLUSTERED': <function Parser.<lambda>>, 'DEFAULT': <function Parser.<lambda>>, 'ENCODE': <function Parser.<lambda>>, 'EPHEMERAL': <function Parser.<lambda>>, 'EXCLUDE': <function Parser.<lambda>>, 'FOREIGN KEY': <function Parser.<lambda>>, 'FORMAT': <function Parser.<lambda>>, 'GENERATED': <function Parser.<lambda>>, 'IDENTITY': <function Parser.<lambda>>, 'INLINE': <function Parser.<lambda>>, 'LIKE': <function Parser.<lambda>>, 'NOT': <function Parser.<lambda>>, 'NULL': <function Parser.<lambda>>, 'ON': <function Parser.<lambda>>, 'PATH': <function Parser.<lambda>>, 'PERIOD': <function Parser.<lambda>>, 'PRIMARY KEY': <function Parser.<lambda>>, 'REFERENCES': <function Parser.<lambda>>, 'TITLE': <function Parser.<lambda>>, 'TTL': <function Parser.<lambda>>, 'UNIQUE': <function Parser.<lambda>>, 'UPPERCASE': <function Parser.<lambda>>, 'WITH': <function Parser.<lambda>>, 'INDEX': <function ClickHouse.Parser.<lambda>>, 'CODEC': <function ClickHouse.Parser.<lambda>>}
ALTER_PARSERS = {'ADD': <function Parser.<lambda>>, 'ALTER': <function Parser.<lambda>>, 'CLUSTER BY': <function Parser.<lambda>>, 'DELETE': <function Parser.<lambda>>, 'DROP': <function Parser.<lambda>>, 'RENAME': <function Parser.<lambda>>, 'SET': <function Parser.<lambda>>, 'REPLACE': <function ClickHouse.Parser.<lambda>>}
SCHEMA_UNNAMED_CONSTRAINTS = {'UNIQUE', 'CHECK', 'FOREIGN KEY', 'INDEX', 'EXCLUDE', 'PERIOD', 'PRIMARY KEY', 'LIKE'}
SHOW_TRIE: Dict = {}
SET_TRIE: Dict = {'GLOBAL': {0: True}, 'LOCAL': {0: True}, 'SESSION': {0: True}, 'TRANSACTION': {0: True}}
Inherited Members
sqlglot.parser.Parser
Parser
NO_PAREN_FUNCTIONS
STRUCT_TYPE_TOKENS
NESTED_TYPE_TOKENS
ENUM_TYPE_TOKENS
AGGREGATE_TYPE_TOKENS
TYPE_TOKENS
SIGNED_TO_UNSIGNED_TYPE_TOKEN
SUBQUERY_PREDICATES
DB_CREATABLES
CREATABLES
INTERVAL_VARS
ARRAY_CONSTRUCTORS
COMMENT_TABLE_ALIAS_TOKENS
UPDATE_ALIAS_TOKENS
TRIM_TYPES
CONJUNCTION
ASSIGNMENT
DISJUNCTION
EQUALITY
COMPARISON
BITWISE
TERM
FACTOR
EXPONENT
TIMES
TIMESTAMPS
SET_OPERATIONS
JOIN_METHODS
JOIN_SIDES
JOIN_HINTS
LAMBDAS
EXPRESSION_PARSERS
STATEMENT_PARSERS
UNARY_PARSERS
STRING_PARSERS
NUMERIC_PARSERS
PRIMARY_PARSERS
PLACEHOLDER_PARSERS
PROPERTY_PARSERS
ALTER_ALTER_PARSERS
INVALID_FUNC_NAME_TOKENS
KEY_VALUE_DEFINITIONS
SET_PARSERS
SHOW_PARSERS
TYPE_LITERAL_PARSERS
TYPE_CONVERTERS
DDL_SELECT_TOKENS
PRE_VOLATILE_TOKENS
TRANSACTION_KIND
TRANSACTION_CHARACTERISTICS
CONFLICT_ACTIONS
CREATE_SEQUENCE
ISOLATED_LOADING_OPTIONS
USABLES
CAST_ACTIONS
SCHEMA_BINDING_OPTIONS
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
STRICT_CAST
PREFIXED_PIVOT_COLUMNS
IDENTIFY_PIVOT_STRINGS
ALTER_TABLE_ADD_REQUIRED_FOR_EACH_COLUMN
TABLESAMPLE_CSV
DEFAULT_SAMPLING_METHOD
SET_REQUIRES_ASSIGNMENT_DELIMITER
TRIM_PATTERN_FIRST
STRING_ALIASES
SET_OP_MODIFIERS
NO_PAREN_IF_COMMANDS
JSON_ARROWS_REQUIRE_JSON_TYPE
COLON_IS_VARIANT_EXTRACT
VALUES_FOLLOWED_BY_PAREN
SUPPORTS_IMPLICIT_UNNEST
SUPPORTS_PARTITION_SELECTION
error_level
error_message_context
max_errors
dialect
reset
parse
parse_into
check_errors
raise_error
expression
validate_expression
errors
sql
class ClickHouse.Generator(sqlglot.generator.Generator):
694    class Generator(generator.Generator):
695        QUERY_HINTS = False
696        STRUCT_DELIMITER = ("(", ")")
697        NVL2_SUPPORTED = False
698        TABLESAMPLE_REQUIRES_PARENS = False
699        TABLESAMPLE_SIZE_IS_ROWS = False
700        TABLESAMPLE_KEYWORDS = "SAMPLE"
701        LAST_DAY_SUPPORTS_DATE_PART = False
702        CAN_IMPLEMENT_ARRAY_ANY = True
703        SUPPORTS_TO_NUMBER = False
704        JOIN_HINTS = False
705        TABLE_HINTS = False
706        EXPLICIT_SET_OP = True
707        GROUPINGS_SEP = ""
708        SET_OP_MODIFIERS = False
709        SUPPORTS_TABLE_ALIAS_COLUMNS = False
710
711        STRING_TYPE_MAPPING = {
712            exp.DataType.Type.CHAR: "String",
713            exp.DataType.Type.LONGBLOB: "String",
714            exp.DataType.Type.LONGTEXT: "String",
715            exp.DataType.Type.MEDIUMBLOB: "String",
716            exp.DataType.Type.MEDIUMTEXT: "String",
717            exp.DataType.Type.TINYBLOB: "String",
718            exp.DataType.Type.TINYTEXT: "String",
719            exp.DataType.Type.TEXT: "String",
720            exp.DataType.Type.VARBINARY: "String",
721            exp.DataType.Type.VARCHAR: "String",
722        }
723
724        SUPPORTED_JSON_PATH_PARTS = {
725            exp.JSONPathKey,
726            exp.JSONPathRoot,
727            exp.JSONPathSubscript,
728        }
729
730        TYPE_MAPPING = {
731            **generator.Generator.TYPE_MAPPING,
732            **STRING_TYPE_MAPPING,
733            exp.DataType.Type.ARRAY: "Array",
734            exp.DataType.Type.BIGINT: "Int64",
735            exp.DataType.Type.DATE32: "Date32",
736            exp.DataType.Type.DATETIME64: "DateTime64",
737            exp.DataType.Type.DOUBLE: "Float64",
738            exp.DataType.Type.ENUM: "Enum",
739            exp.DataType.Type.ENUM8: "Enum8",
740            exp.DataType.Type.ENUM16: "Enum16",
741            exp.DataType.Type.FIXEDSTRING: "FixedString",
742            exp.DataType.Type.FLOAT: "Float32",
743            exp.DataType.Type.INT: "Int32",
744            exp.DataType.Type.MEDIUMINT: "Int32",
745            exp.DataType.Type.INT128: "Int128",
746            exp.DataType.Type.INT256: "Int256",
747            exp.DataType.Type.LOWCARDINALITY: "LowCardinality",
748            exp.DataType.Type.MAP: "Map",
749            exp.DataType.Type.NESTED: "Nested",
750            exp.DataType.Type.NULLABLE: "Nullable",
751            exp.DataType.Type.SMALLINT: "Int16",
752            exp.DataType.Type.STRUCT: "Tuple",
753            exp.DataType.Type.TINYINT: "Int8",
754            exp.DataType.Type.UBIGINT: "UInt64",
755            exp.DataType.Type.UINT: "UInt32",
756            exp.DataType.Type.UINT128: "UInt128",
757            exp.DataType.Type.UINT256: "UInt256",
758            exp.DataType.Type.USMALLINT: "UInt16",
759            exp.DataType.Type.UTINYINT: "UInt8",
760            exp.DataType.Type.IPV4: "IPv4",
761            exp.DataType.Type.IPV6: "IPv6",
762            exp.DataType.Type.AGGREGATEFUNCTION: "AggregateFunction",
763            exp.DataType.Type.SIMPLEAGGREGATEFUNCTION: "SimpleAggregateFunction",
764        }
765
766        TRANSFORMS = {
767            **generator.Generator.TRANSFORMS,
768            exp.AnyValue: rename_func("any"),
769            exp.ApproxDistinct: rename_func("uniq"),
770            exp.ArrayFilter: lambda self, e: self.func("arrayFilter", e.expression, e.this),
771            exp.ArraySize: rename_func("LENGTH"),
772            exp.ArraySum: rename_func("arraySum"),
773            exp.ArgMax: arg_max_or_min_no_count("argMax"),
774            exp.ArgMin: arg_max_or_min_no_count("argMin"),
775            exp.Array: inline_array_sql,
776            exp.CastToStrType: rename_func("CAST"),
777            exp.CountIf: rename_func("countIf"),
778            exp.CompressColumnConstraint: lambda self,
779            e: f"CODEC({self.expressions(e, key='this', flat=True)})",
780            exp.ComputedColumnConstraint: lambda self,
781            e: f"{'MATERIALIZED' if e.args.get('persisted') else 'ALIAS'} {self.sql(e, 'this')}",
782            exp.CurrentDate: lambda self, e: self.func("CURRENT_DATE"),
783            exp.DateAdd: _datetime_delta_sql("DATE_ADD"),
784            exp.DateDiff: _datetime_delta_sql("DATE_DIFF"),
785            exp.DateSub: _datetime_delta_sql("DATE_SUB"),
786            exp.Explode: rename_func("arrayJoin"),
787            exp.Final: lambda self, e: f"{self.sql(e, 'this')} FINAL",
788            exp.IsNan: rename_func("isNaN"),
789            exp.JSONExtract: json_extract_segments("JSONExtractString", quoted_index=False),
790            exp.JSONExtractScalar: json_extract_segments("JSONExtractString", quoted_index=False),
791            exp.JSONPathKey: json_path_key_only_name,
792            exp.JSONPathRoot: lambda *_: "",
793            exp.Map: lambda self, e: _lower_func(var_map_sql(self, e)),
794            exp.Nullif: rename_func("nullIf"),
795            exp.PartitionedByProperty: lambda self, e: f"PARTITION BY {self.sql(e, 'this')}",
796            exp.Pivot: no_pivot_sql,
797            exp.Quantile: _quantile_sql,
798            exp.RegexpLike: lambda self, e: self.func("match", e.this, e.expression),
799            exp.Rand: rename_func("randCanonical"),
800            exp.StartsWith: rename_func("startsWith"),
801            exp.StrPosition: lambda self, e: self.func(
802                "position", e.this, e.args.get("substr"), e.args.get("position")
803            ),
804            exp.TimeToStr: lambda self, e: self.func(
805                "DATE_FORMAT", e.this, self.format_time(e), e.args.get("timezone")
806            ),
807            exp.TimestampAdd: _datetime_delta_sql("TIMESTAMP_ADD"),
808            exp.TimestampSub: _datetime_delta_sql("TIMESTAMP_SUB"),
809            exp.VarMap: lambda self, e: _lower_func(var_map_sql(self, e)),
810            exp.Xor: lambda self, e: self.func("xor", e.this, e.expression, *e.expressions),
811            exp.MD5Digest: rename_func("MD5"),
812            exp.MD5: lambda self, e: self.func("LOWER", self.func("HEX", self.func("MD5", e.this))),
813            exp.SHA: rename_func("SHA1"),
814            exp.SHA2: sha256_sql,
815            exp.UnixToTime: _unix_to_time_sql,
816            exp.TimestampTrunc: timestamptrunc_sql(zone=True),
817            exp.Variance: rename_func("varSamp"),
818            exp.Stddev: rename_func("stddevSamp"),
819        }
820
821        PROPERTIES_LOCATION = {
822            **generator.Generator.PROPERTIES_LOCATION,
823            exp.VolatileProperty: exp.Properties.Location.UNSUPPORTED,
824            exp.PartitionedByProperty: exp.Properties.Location.POST_SCHEMA,
825            exp.OnCluster: exp.Properties.Location.POST_NAME,
826        }
827
828        # there's no list in docs, but it can be found in Clickhouse code
829        # see `ClickHouse/src/Parsers/ParserCreate*.cpp`
830        ON_CLUSTER_TARGETS = {
831            "DATABASE",
832            "TABLE",
833            "VIEW",
834            "DICTIONARY",
835            "INDEX",
836            "FUNCTION",
837            "NAMED COLLECTION",
838        }
839
840        def _jsonpathsubscript_sql(self, expression: exp.JSONPathSubscript) -> str:
841            this = self.json_path_part(expression.this)
842            return str(int(this) + 1) if is_int(this) else this
843
844        def likeproperty_sql(self, expression: exp.LikeProperty) -> str:
845            return f"AS {self.sql(expression, 'this')}"
846
847        def _any_to_has(
848            self,
849            expression: exp.EQ | exp.NEQ,
850            default: t.Callable[[t.Any], str],
851            prefix: str = "",
852        ) -> str:
853            if isinstance(expression.left, exp.Any):
854                arr = expression.left
855                this = expression.right
856            elif isinstance(expression.right, exp.Any):
857                arr = expression.right
858                this = expression.left
859            else:
860                return default(expression)
861
862            return prefix + self.func("has", arr.this.unnest(), this)
863
864        def eq_sql(self, expression: exp.EQ) -> str:
865            return self._any_to_has(expression, super().eq_sql)
866
867        def neq_sql(self, expression: exp.NEQ) -> str:
868            return self._any_to_has(expression, super().neq_sql, "NOT ")
869
870        def regexpilike_sql(self, expression: exp.RegexpILike) -> str:
871            # Manually add a flag to make the search case-insensitive
872            regex = self.func("CONCAT", "'(?i)'", expression.expression)
873            return self.func("match", expression.this, regex)
874
875        def datatype_sql(self, expression: exp.DataType) -> str:
876            # String is the standard ClickHouse type, every other variant is just an alias.
877            # Additionally, any supplied length parameter will be ignored.
878            #
879            # https://clickhouse.com/docs/en/sql-reference/data-types/string
880            if expression.this in self.STRING_TYPE_MAPPING:
881                return "String"
882
883            return super().datatype_sql(expression)
884
885        def cte_sql(self, expression: exp.CTE) -> str:
886            if expression.args.get("scalar"):
887                this = self.sql(expression, "this")
888                alias = self.sql(expression, "alias")
889                return f"{this} AS {alias}"
890
891            return super().cte_sql(expression)
892
893        def after_limit_modifiers(self, expression: exp.Expression) -> t.List[str]:
894            return super().after_limit_modifiers(expression) + [
895                (
896                    self.seg("SETTINGS ") + self.expressions(expression, key="settings", flat=True)
897                    if expression.args.get("settings")
898                    else ""
899                ),
900                (
901                    self.seg("FORMAT ") + self.sql(expression, "format")
902                    if expression.args.get("format")
903                    else ""
904                ),
905            ]
906
907        def parameterizedagg_sql(self, expression: exp.ParameterizedAgg) -> str:
908            params = self.expressions(expression, key="params", flat=True)
909            return self.func(expression.name, *expression.expressions) + f"({params})"
910
911        def anonymousaggfunc_sql(self, expression: exp.AnonymousAggFunc) -> str:
912            return self.func(expression.name, *expression.expressions)
913
914        def combinedaggfunc_sql(self, expression: exp.CombinedAggFunc) -> str:
915            return self.anonymousaggfunc_sql(expression)
916
917        def combinedparameterizedagg_sql(self, expression: exp.CombinedParameterizedAgg) -> str:
918            return self.parameterizedagg_sql(expression)
919
920        def placeholder_sql(self, expression: exp.Placeholder) -> str:
921            return f"{{{expression.name}: {self.sql(expression, 'kind')}}}"
922
923        def oncluster_sql(self, expression: exp.OnCluster) -> str:
924            return f"ON CLUSTER {self.sql(expression, 'this')}"
925
926        def createable_sql(self, expression: exp.Create, locations: t.DefaultDict) -> str:
927            if expression.kind in self.ON_CLUSTER_TARGETS and locations.get(
928                exp.Properties.Location.POST_NAME
929            ):
930                this_name = self.sql(expression.this, "this")
931                this_properties = " ".join(
932                    [self.sql(prop) for prop in locations[exp.Properties.Location.POST_NAME]]
933                )
934                this_schema = self.schema_columns_sql(expression.this)
935                return f"{this_name}{self.sep()}{this_properties}{self.sep()}{this_schema}"
936
937            return super().createable_sql(expression, locations)
938
939        def prewhere_sql(self, expression: exp.PreWhere) -> str:
940            this = self.indent(self.sql(expression, "this"))
941            return f"{self.seg('PREWHERE')}{self.sep()}{this}"
942
943        def indexcolumnconstraint_sql(self, expression: exp.IndexColumnConstraint) -> str:
944            this = self.sql(expression, "this")
945            this = f" {this}" if this else ""
946            expr = self.sql(expression, "expression")
947            expr = f" {expr}" if expr else ""
948            index_type = self.sql(expression, "index_type")
949            index_type = f" TYPE {index_type}" if index_type else ""
950            granularity = self.sql(expression, "granularity")
951            granularity = f" GRANULARITY {granularity}" if granularity else ""
952
953            return f"INDEX{this}{expr}{index_type}{granularity}"
954
955        def partition_sql(self, expression: exp.Partition) -> str:
956            return f"PARTITION {self.expressions(expression, flat=True)}"
957
958        def partitionid_sql(self, expression: exp.PartitionId) -> str:
959            return f"ID {self.sql(expression.this)}"
960
961        def replacepartition_sql(self, expression: exp.ReplacePartition) -> str:
962            return (
963                f"REPLACE {self.sql(expression.expression)} FROM {self.sql(expression, 'source')}"
964            )
965
966        def projectiondef_sql(self, expression: exp.ProjectionDef) -> str:
967            return f"PROJECTION {self.sql(expression.this)} {self.wrap(expression.expression)}"

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

Arguments:
  • pretty: Whether to format the produced SQL string. Default: False.
  • identify: Determines when an identifier should be quoted. Possible values are: False (default): Never quote, except in cases where it's mandatory by the dialect. True or 'always': Always quote. 'safe': Only quote identifiers that are case insensitive.
  • normalize: Whether to normalize identifiers to lowercase. Default: False.
  • pad: The pad size in a formatted string. For example, this affects the indentation of a projection in a query, relative to its nesting level. Default: 2.
  • indent: The indentation size in a formatted string. For example, this affects the indentation of subqueries and filters under a WHERE clause. Default: 2.
  • normalize_functions: How to normalize function names. Possible values are: "upper" or True (default): Convert names to uppercase. "lower": Convert names to lowercase. False: Disables function name normalization.
  • unsupported_level: Determines the generator's behavior when it encounters unsupported expressions. Default ErrorLevel.WARN.
  • max_unsupported: Maximum number of unsupported messages to include in a raised UnsupportedError. This is only relevant if unsupported_level is ErrorLevel.RAISE. Default: 3
  • leading_comma: Whether the comma is leading or trailing in select expressions. This is only relevant when generating in pretty mode. Default: False
  • max_text_width: The max number of characters in a segment before creating new lines in pretty mode. The default is on the smaller end because the length only represents a segment and not the true line length. Default: 80
  • comments: Whether to preserve comments in the output SQL code. Default: True
QUERY_HINTS = False
STRUCT_DELIMITER = ('(', ')')
NVL2_SUPPORTED = False
TABLESAMPLE_REQUIRES_PARENS = False
TABLESAMPLE_SIZE_IS_ROWS = False
TABLESAMPLE_KEYWORDS = 'SAMPLE'
LAST_DAY_SUPPORTS_DATE_PART = False
CAN_IMPLEMENT_ARRAY_ANY = True
SUPPORTS_TO_NUMBER = False
JOIN_HINTS = False
TABLE_HINTS = False
EXPLICIT_SET_OP = True
GROUPINGS_SEP = ''
SET_OP_MODIFIERS = False
SUPPORTS_TABLE_ALIAS_COLUMNS = False
STRING_TYPE_MAPPING = {<Type.CHAR: 'CHAR'>: 'String', <Type.LONGBLOB: 'LONGBLOB'>: 'String', <Type.LONGTEXT: 'LONGTEXT'>: 'String', <Type.MEDIUMBLOB: 'MEDIUMBLOB'>: 'String', <Type.MEDIUMTEXT: 'MEDIUMTEXT'>: 'String', <Type.TINYBLOB: 'TINYBLOB'>: 'String', <Type.TINYTEXT: 'TINYTEXT'>: 'String', <Type.TEXT: 'TEXT'>: 'String', <Type.VARBINARY: 'VARBINARY'>: 'String', <Type.VARCHAR: 'VARCHAR'>: 'String'}
TYPE_MAPPING = {<Type.NCHAR: 'NCHAR'>: 'CHAR', <Type.NVARCHAR: 'NVARCHAR'>: 'VARCHAR', <Type.MEDIUMTEXT: 'MEDIUMTEXT'>: 'String', <Type.LONGTEXT: 'LONGTEXT'>: 'String', <Type.TINYTEXT: 'TINYTEXT'>: 'String', <Type.MEDIUMBLOB: 'MEDIUMBLOB'>: 'String', <Type.LONGBLOB: 'LONGBLOB'>: 'String', <Type.TINYBLOB: 'TINYBLOB'>: 'String', <Type.INET: 'INET'>: 'INET', <Type.ROWVERSION: 'ROWVERSION'>: 'VARBINARY', <Type.CHAR: 'CHAR'>: 'String', <Type.TEXT: 'TEXT'>: 'String', <Type.VARBINARY: 'VARBINARY'>: 'String', <Type.VARCHAR: 'VARCHAR'>: 'String', <Type.ARRAY: 'ARRAY'>: 'Array', <Type.BIGINT: 'BIGINT'>: 'Int64', <Type.DATE32: 'DATE32'>: 'Date32', <Type.DATETIME64: 'DATETIME64'>: 'DateTime64', <Type.DOUBLE: 'DOUBLE'>: 'Float64', <Type.ENUM: 'ENUM'>: 'Enum', <Type.ENUM8: 'ENUM8'>: 'Enum8', <Type.ENUM16: 'ENUM16'>: 'Enum16', <Type.FIXEDSTRING: 'FIXEDSTRING'>: 'FixedString', <Type.FLOAT: 'FLOAT'>: 'Float32', <Type.INT: 'INT'>: 'Int32', <Type.MEDIUMINT: 'MEDIUMINT'>: 'Int32', <Type.INT128: 'INT128'>: 'Int128', <Type.INT256: 'INT256'>: 'Int256', <Type.LOWCARDINALITY: 'LOWCARDINALITY'>: 'LowCardinality', <Type.MAP: 'MAP'>: 'Map', <Type.NESTED: 'NESTED'>: 'Nested', <Type.NULLABLE: 'NULLABLE'>: 'Nullable', <Type.SMALLINT: 'SMALLINT'>: 'Int16', <Type.STRUCT: 'STRUCT'>: 'Tuple', <Type.TINYINT: 'TINYINT'>: 'Int8', <Type.UBIGINT: 'UBIGINT'>: 'UInt64', <Type.UINT: 'UINT'>: 'UInt32', <Type.UINT128: 'UINT128'>: 'UInt128', <Type.UINT256: 'UINT256'>: 'UInt256', <Type.USMALLINT: 'USMALLINT'>: 'UInt16', <Type.UTINYINT: 'UTINYINT'>: 'UInt8', <Type.IPV4: 'IPV4'>: 'IPv4', <Type.IPV6: 'IPV6'>: 'IPv6', <Type.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>: 'AggregateFunction', <Type.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>: 'SimpleAggregateFunction'}
TRANSFORMS = {<class 'sqlglot.expressions.JSONPathKey'>: <function json_path_key_only_name>, <class 'sqlglot.expressions.JSONPathRoot'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.JSONPathSubscript'>: <function <lambda>>, <class 'sqlglot.expressions.AllowedValuesProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.AutoRefreshProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.BackupProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CaseSpecificColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CharacterSetColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CharacterSetProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ClusteredColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CollateColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CommentColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ConnectByRoot'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CopyGrantsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.DateFormatColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.DefaultColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.DynamicProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.EncodeColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.EphemeralColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ExcludeColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ExecuteAsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ExternalProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.GlobalProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.HeapProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.IcebergProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.InheritsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.InlineLengthColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.InputModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.IntervalSpan'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.JSONExtract'>: <function json_extract_segments.<locals>._json_extract_segments>, <class 'sqlglot.expressions.JSONExtractScalar'>: <function json_extract_segments.<locals>._json_extract_segments>, <class 'sqlglot.expressions.LanguageProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.LocationProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.LogProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.MaterializedProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.NonClusteredColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.NoPrimaryIndexProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.NotForReplicationColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.OnCommitProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.OnProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.OnUpdateColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.OutputModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.PathColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ProjectionPolicyColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.RemoteWithConnectionModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ReturnsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SampleProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SecureProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SetConfigProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SetProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SettingsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SharingProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SqlReadWriteProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SqlSecurityProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.StabilityProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.StrictProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TemporaryProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TagColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TitleColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Timestamp'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ToMap'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ToTableProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TransformModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TransientProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.UppercaseColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.UnloggedProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.VarMap'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.ViewAttributeProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.VolatileProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WithJournalTableProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WithSchemaBindingProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WithOperator'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.AnyValue'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.ApproxDistinct'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.ArrayFilter'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.ArraySize'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.ArraySum'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.ArgMax'>: <function arg_max_or_min_no_count.<locals>._arg_max_or_min_sql>, <class 'sqlglot.expressions.ArgMin'>: <function arg_max_or_min_no_count.<locals>._arg_max_or_min_sql>, <class 'sqlglot.expressions.Array'>: <function inline_array_sql>, <class 'sqlglot.expressions.CastToStrType'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.CountIf'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.CompressColumnConstraint'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.ComputedColumnConstraint'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.CurrentDate'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.DateAdd'>: <function _datetime_delta_sql.<locals>._delta_sql>, <class 'sqlglot.expressions.DateDiff'>: <function _datetime_delta_sql.<locals>._delta_sql>, <class 'sqlglot.expressions.DateSub'>: <function _datetime_delta_sql.<locals>._delta_sql>, <class 'sqlglot.expressions.Explode'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.Final'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.IsNan'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.Map'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.Nullif'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.PartitionedByProperty'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.Pivot'>: <function no_pivot_sql>, <class 'sqlglot.expressions.Quantile'>: <function _quantile_sql>, <class 'sqlglot.expressions.RegexpLike'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.Rand'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.StartsWith'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.StrPosition'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.TimeToStr'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.TimestampAdd'>: <function _datetime_delta_sql.<locals>._delta_sql>, <class 'sqlglot.expressions.TimestampSub'>: <function _datetime_delta_sql.<locals>._delta_sql>, <class 'sqlglot.expressions.Xor'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.MD5Digest'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.MD5'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.SHA'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.SHA2'>: <function sha256_sql>, <class 'sqlglot.expressions.UnixToTime'>: <function _unix_to_time_sql>, <class 'sqlglot.expressions.TimestampTrunc'>: <function timestamptrunc_sql.<locals>._timestamptrunc_sql>, <class 'sqlglot.expressions.Variance'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.Stddev'>: <function rename_func.<locals>.<lambda>>}
PROPERTIES_LOCATION = {<class 'sqlglot.expressions.AllowedValuesProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.AlgorithmProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.AutoIncrementProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.AutoRefreshProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.BackupProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.BlockCompressionProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.CharacterSetProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ChecksumProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.CollateProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.CopyGrantsProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.Cluster'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ClusteredByProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DataBlocksizeProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.DataDeletionProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DefinerProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.DictRange'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DictProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DynamicProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.DistKeyProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DistStyleProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.EngineProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ExecuteAsProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ExternalProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.FallbackProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.FileFormatProperty'>: <Location.POST_WITH: 'POST_WITH'>, <class 'sqlglot.expressions.FreespaceProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.GlobalProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.HeapProperty'>: <Location.POST_WITH: 'POST_WITH'>, <class 'sqlglot.expressions.InheritsProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.IcebergProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.InputModelProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.IsolatedLoadingProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.JournalProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.LanguageProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.LikeProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.LocationProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.LockProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.LockingProperty'>: <Location.POST_ALIAS: 'POST_ALIAS'>, <class 'sqlglot.expressions.LogProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.MaterializedProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.MergeBlockRatioProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.NoPrimaryIndexProperty'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.OnProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.OnCommitProperty'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.Order'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.OutputModelProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.PartitionedByProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.PartitionedOfProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.PrimaryKey'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.Property'>: <Location.POST_WITH: 'POST_WITH'>, <class 'sqlglot.expressions.RemoteWithConnectionModelProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ReturnsProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.RowFormatProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.RowFormatDelimitedProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.RowFormatSerdeProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SampleProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SchemaCommentProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SecureProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.SerdeProperties'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.Set'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SettingsProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SetProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.SetConfigProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SharingProperty'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.SequenceProperties'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.SortKeyProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SqlReadWriteProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SqlSecurityProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.StabilityProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.StrictProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.TemporaryProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.ToTableProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.TransientProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.TransformModelProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.MergeTreeTTL'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.UnloggedProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.ViewAttributeProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.VolatileProperty'>: <Location.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.WithDataProperty'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.WithJournalTableProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.WithSchemaBindingProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.WithSystemVersioningProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.OnCluster'>: <Location.POST_NAME: 'POST_NAME'>}
ON_CLUSTER_TARGETS = {'TABLE', 'FUNCTION', 'DATABASE', 'DICTIONARY', 'INDEX', 'VIEW', 'NAMED COLLECTION'}
def likeproperty_sql(self, expression: sqlglot.expressions.LikeProperty) -> str:
844        def likeproperty_sql(self, expression: exp.LikeProperty) -> str:
845            return f"AS {self.sql(expression, 'this')}"
def eq_sql(self, expression: sqlglot.expressions.EQ) -> str:
864        def eq_sql(self, expression: exp.EQ) -> str:
865            return self._any_to_has(expression, super().eq_sql)
def neq_sql(self, expression: sqlglot.expressions.NEQ) -> str:
867        def neq_sql(self, expression: exp.NEQ) -> str:
868            return self._any_to_has(expression, super().neq_sql, "NOT ")
def regexpilike_sql(self, expression: sqlglot.expressions.RegexpILike) -> str:
870        def regexpilike_sql(self, expression: exp.RegexpILike) -> str:
871            # Manually add a flag to make the search case-insensitive
872            regex = self.func("CONCAT", "'(?i)'", expression.expression)
873            return self.func("match", expression.this, regex)
def datatype_sql(self, expression: sqlglot.expressions.DataType) -> str:
875        def datatype_sql(self, expression: exp.DataType) -> str:
876            # String is the standard ClickHouse type, every other variant is just an alias.
877            # Additionally, any supplied length parameter will be ignored.
878            #
879            # https://clickhouse.com/docs/en/sql-reference/data-types/string
880            if expression.this in self.STRING_TYPE_MAPPING:
881                return "String"
882
883            return super().datatype_sql(expression)
def cte_sql(self, expression: sqlglot.expressions.CTE) -> str:
885        def cte_sql(self, expression: exp.CTE) -> str:
886            if expression.args.get("scalar"):
887                this = self.sql(expression, "this")
888                alias = self.sql(expression, "alias")
889                return f"{this} AS {alias}"
890
891            return super().cte_sql(expression)
def after_limit_modifiers(self, expression: sqlglot.expressions.Expression) -> List[str]:
893        def after_limit_modifiers(self, expression: exp.Expression) -> t.List[str]:
894            return super().after_limit_modifiers(expression) + [
895                (
896                    self.seg("SETTINGS ") + self.expressions(expression, key="settings", flat=True)
897                    if expression.args.get("settings")
898                    else ""
899                ),
900                (
901                    self.seg("FORMAT ") + self.sql(expression, "format")
902                    if expression.args.get("format")
903                    else ""
904                ),
905            ]
def parameterizedagg_sql(self, expression: sqlglot.expressions.ParameterizedAgg) -> str:
907        def parameterizedagg_sql(self, expression: exp.ParameterizedAgg) -> str:
908            params = self.expressions(expression, key="params", flat=True)
909            return self.func(expression.name, *expression.expressions) + f"({params})"
def anonymousaggfunc_sql(self, expression: sqlglot.expressions.AnonymousAggFunc) -> str:
911        def anonymousaggfunc_sql(self, expression: exp.AnonymousAggFunc) -> str:
912            return self.func(expression.name, *expression.expressions)
def combinedaggfunc_sql(self, expression: sqlglot.expressions.CombinedAggFunc) -> str:
914        def combinedaggfunc_sql(self, expression: exp.CombinedAggFunc) -> str:
915            return self.anonymousaggfunc_sql(expression)
def combinedparameterizedagg_sql(self, expression: sqlglot.expressions.CombinedParameterizedAgg) -> str:
917        def combinedparameterizedagg_sql(self, expression: exp.CombinedParameterizedAgg) -> str:
918            return self.parameterizedagg_sql(expression)
def placeholder_sql(self, expression: sqlglot.expressions.Placeholder) -> str:
920        def placeholder_sql(self, expression: exp.Placeholder) -> str:
921            return f"{{{expression.name}: {self.sql(expression, 'kind')}}}"
def oncluster_sql(self, expression: sqlglot.expressions.OnCluster) -> str:
923        def oncluster_sql(self, expression: exp.OnCluster) -> str:
924            return f"ON CLUSTER {self.sql(expression, 'this')}"
def createable_sql( self, expression: sqlglot.expressions.Create, locations: DefaultDict) -> str:
926        def createable_sql(self, expression: exp.Create, locations: t.DefaultDict) -> str:
927            if expression.kind in self.ON_CLUSTER_TARGETS and locations.get(
928                exp.Properties.Location.POST_NAME
929            ):
930                this_name = self.sql(expression.this, "this")
931                this_properties = " ".join(
932                    [self.sql(prop) for prop in locations[exp.Properties.Location.POST_NAME]]
933                )
934                this_schema = self.schema_columns_sql(expression.this)
935                return f"{this_name}{self.sep()}{this_properties}{self.sep()}{this_schema}"
936
937            return super().createable_sql(expression, locations)
def prewhere_sql(self, expression: sqlglot.expressions.PreWhere) -> str:
939        def prewhere_sql(self, expression: exp.PreWhere) -> str:
940            this = self.indent(self.sql(expression, "this"))
941            return f"{self.seg('PREWHERE')}{self.sep()}{this}"
def indexcolumnconstraint_sql(self, expression: sqlglot.expressions.IndexColumnConstraint) -> str:
943        def indexcolumnconstraint_sql(self, expression: exp.IndexColumnConstraint) -> str:
944            this = self.sql(expression, "this")
945            this = f" {this}" if this else ""
946            expr = self.sql(expression, "expression")
947            expr = f" {expr}" if expr else ""
948            index_type = self.sql(expression, "index_type")
949            index_type = f" TYPE {index_type}" if index_type else ""
950            granularity = self.sql(expression, "granularity")
951            granularity = f" GRANULARITY {granularity}" if granularity else ""
952
953            return f"INDEX{this}{expr}{index_type}{granularity}"
def partition_sql(self, expression: sqlglot.expressions.Partition) -> str:
955        def partition_sql(self, expression: exp.Partition) -> str:
956            return f"PARTITION {self.expressions(expression, flat=True)}"
def partitionid_sql(self, expression: sqlglot.expressions.PartitionId) -> str:
958        def partitionid_sql(self, expression: exp.PartitionId) -> str:
959            return f"ID {self.sql(expression.this)}"
def replacepartition_sql(self, expression: sqlglot.expressions.ReplacePartition) -> str:
961        def replacepartition_sql(self, expression: exp.ReplacePartition) -> str:
962            return (
963                f"REPLACE {self.sql(expression.expression)} FROM {self.sql(expression, 'source')}"
964            )
def projectiondef_sql(self, expression: sqlglot.expressions.ProjectionDef) -> str:
966        def projectiondef_sql(self, expression: exp.ProjectionDef) -> str:
967            return f"PROJECTION {self.sql(expression.this)} {self.wrap(expression.expression)}"
SELECT_KINDS: Tuple[str, ...] = ()
TRY_SUPPORTED = False
SUPPORTS_UESCAPE = False
AFTER_HAVING_MODIFIER_TRANSFORMS = {'windows': <function Generator.<lambda>>, 'qualify': <function Generator.<lambda>>}
Inherited Members
sqlglot.generator.Generator
Generator
NULL_ORDERING_SUPPORTED
IGNORE_NULLS_IN_FUNC
LOCKING_READS_SUPPORTED
WRAP_DERIVED_VALUES
CREATE_FUNCTION_RETURN_AS
MATCHED_BY_SOURCE
SINGLE_STRING_INTERVAL
INTERVAL_ALLOWS_PLURAL_FORM
LIMIT_FETCH
LIMIT_ONLY_LITERALS
RENAME_TABLE_WITH_DB
INDEX_ON
QUERY_HINT_SEP
IS_BOOL_ALLOWED
DUPLICATE_KEY_UPDATE_WITH_SET
LIMIT_IS_TOP
RETURNING_END
EXTRACT_ALLOWS_QUOTES
TZ_TO_WITH_TIME_ZONE
VALUES_AS_TABLE
ALTER_TABLE_INCLUDE_COLUMN_KEYWORD
UNNEST_WITH_ORDINALITY
AGGREGATE_FILTER_SUPPORTED
SEMI_ANTI_JOIN_WITH_SIDE
COMPUTED_COLUMN_WITH_TYPE
SUPPORTS_TABLE_COPY
TABLESAMPLE_WITH_METHOD
TABLESAMPLE_SEED_KEYWORD
COLLATE_IS_FUNC
DATA_TYPE_SPECIFIERS_ALLOWED
ENSURE_BOOLS
CTE_RECURSIVE_KEYWORD_REQUIRED
SUPPORTS_SINGLE_ARG_CONCAT
UNPIVOT_ALIASES_ARE_IDENTIFIERS
JSON_KEY_VALUE_PAIR_SEP
INSERT_OVERWRITE
SUPPORTS_SELECT_INTO
SUPPORTS_UNLOGGED_TABLES
SUPPORTS_CREATE_TABLE_LIKE
LIKE_PROPERTY_INSIDE_SCHEMA
MULTI_ARG_DISTINCT
JSON_TYPE_REQUIRED_FOR_EXTRACTION
JSON_PATH_BRACKETED_KEY_SUPPORTED
JSON_PATH_SINGLE_QUOTE_ESCAPE
COPY_PARAMS_ARE_WRAPPED
COPY_PARAMS_EQ_REQUIRED
COPY_HAS_INTO_KEYWORD
STAR_EXCEPT
HEX_FUNC
WITH_PROPERTIES_PREFIX
QUOTE_JSON_PATH
PAD_FILL_PATTERN_IS_REQUIRED
PARSE_JSON_NAME
TIME_PART_SINGULARS
TOKEN_MAPPING
PARAMETER_TOKEN
NAMED_PLACEHOLDER_TOKEN
RESERVED_KEYWORDS
WITH_SEPARATED_COMMENTS
EXCLUDE_COMMENTS
UNWRAPPED_INTERVAL_VALUES
PARAMETERIZABLE_TEXT_TYPES
EXPRESSIONS_WITHOUT_NESTED_CTES
SENTINEL_LINE_BREAK
pretty
identify
normalize
pad
unsupported_level
max_unsupported
leading_comma
max_text_width
comments
dialect
normalize_functions
unsupported_messages
generate
preprocess
unsupported
sep
seg
pad_comment
maybe_comment
wrap
no_identify
normalize_func
indent
sql
uncache_sql
cache_sql
characterset_sql
column_parts
column_sql
columnposition_sql
columndef_sql
columnconstraint_sql
computedcolumnconstraint_sql
autoincrementcolumnconstraint_sql
compresscolumnconstraint_sql
generatedasidentitycolumnconstraint_sql
generatedasrowcolumnconstraint_sql
periodforsystemtimeconstraint_sql
notnullcolumnconstraint_sql
transformcolumnconstraint_sql
primarykeycolumnconstraint_sql
uniquecolumnconstraint_sql
create_sql
sequenceproperties_sql
clone_sql
describe_sql
heredoc_sql
prepend_ctes
with_sql
tablealias_sql
bitstring_sql
hexstring_sql
bytestring_sql
unicodestring_sql
rawstring_sql
datatypeparam_sql
directory_sql
delete_sql
drop_sql
except_sql
except_op
fetch_sql
filter_sql
hint_sql
indexparameters_sql
index_sql
identifier_sql
hex_sql
lowerhex_sql
inputoutputformat_sql
national_sql
properties_sql
root_properties
properties
with_properties
locate_properties
property_name
property_sql
fallbackproperty_sql
journalproperty_sql
freespaceproperty_sql
checksumproperty_sql
mergeblockratioproperty_sql
datablocksizeproperty_sql
blockcompressionproperty_sql
isolatedloadingproperty_sql
partitionboundspec_sql
partitionedofproperty_sql
lockingproperty_sql
withdataproperty_sql
withsystemversioningproperty_sql
insert_sql
intersect_sql
intersect_op
introducer_sql
kill_sql
pseudotype_sql
objectidentifier_sql
onconflict_sql
returning_sql
rowformatdelimitedproperty_sql
withtablehint_sql
indextablehint_sql
historicaldata_sql
table_parts
table_sql
tablesample_sql
pivot_sql
version_sql
tuple_sql
update_sql
values_sql
var_sql
into_sql
from_sql
group_sql
having_sql
connect_sql
prior_sql
join_sql
lambda_sql
lateral_op
lateral_sql
limit_sql
offset_sql
setitem_sql
set_sql
pragma_sql
lock_sql
literal_sql
escape_str
loaddata_sql
null_sql
boolean_sql
order_sql
withfill_sql
cluster_sql
distribute_sql
sort_sql
ordered_sql
matchrecognizemeasure_sql
matchrecognize_sql
query_modifiers
options_modifier
queryoption_sql
offset_limit_modifiers
select_sql
schema_sql
schema_columns_sql
star_sql
parameter_sql
sessionparameter_sql
subquery_sql
qualify_sql
set_operations
union_sql
union_op
unnest_sql
where_sql
window_sql
partition_by_sql
windowspec_sql
withingroup_sql
between_sql
bracket_offset_expressions
bracket_sql
all_sql
any_sql
exists_sql
case_sql
constraint_sql
nextvaluefor_sql
extract_sql
trim_sql
convert_concat_args
concat_sql
concatws_sql
check_sql
foreignkey_sql
primarykey_sql
if_sql
matchagainst_sql
jsonkeyvalue_sql
jsonpath_sql
json_path_part
formatjson_sql
jsonobject_sql
jsonobjectagg_sql
jsonarray_sql
jsonarrayagg_sql
jsoncolumndef_sql
jsonschema_sql
jsontable_sql
openjsoncolumndef_sql
openjson_sql
in_sql
in_unnest_op
interval_sql
return_sql
reference_sql
anonymous_sql
paren_sql
neg_sql
not_sql
alias_sql
pivotalias_sql
aliases_sql
atindex_sql
attimezone_sql
fromtimezone_sql
add_sql
and_sql
or_sql
xor_sql
connector_sql
bitwiseand_sql
bitwiseleftshift_sql
bitwisenot_sql
bitwiseor_sql
bitwiserightshift_sql
bitwisexor_sql
cast_sql
currentdate_sql
currenttimestamp_sql
collate_sql
command_sql
comment_sql
mergetreettlaction_sql
mergetreettl_sql
transaction_sql
commit_sql
rollback_sql
altercolumn_sql
alterdiststyle_sql
altersortkey_sql
renametable_sql
renamecolumn_sql
alterset_sql
altertable_sql
add_column_sql
droppartition_sql
addconstraint_sql
distinct_sql
ignorenulls_sql
respectnulls_sql
havingmax_sql
intdiv_sql
dpipe_sql
div_sql
overlaps_sql
distance_sql
dot_sql
propertyeq_sql
escape_sql
glob_sql
gt_sql
gte_sql
ilike_sql
ilikeany_sql
is_sql
like_sql
likeany_sql
similarto_sql
lt_sql
lte_sql
mod_sql
mul_sql
nullsafeeq_sql
nullsafeneq_sql
slice_sql
sub_sql
trycast_sql
try_sql
log_sql
use_sql
binary
function_fallback_sql
func
format_args
too_wide
format_time
expressions
op_expressions
naked_property
tag_sql
token_sql
userdefinedfunction_sql
joinhint_sql
kwarg_sql
when_sql
merge_sql
tochar_sql
tonumber_sql
dictproperty_sql
dictrange_sql
dictsubproperty_sql
clusteredbyproperty_sql
anyvalue_sql
querytransform_sql
indexconstraintoption_sql
checkcolumnconstraint_sql
nvl2_sql
comprehension_sql
columnprefix_sql
opclass_sql
predict_sql
forin_sql
refresh_sql
operator_sql
toarray_sql
tsordstotime_sql
tsordstotimestamp_sql
tsordstodate_sql
unixdate_sql
lastday_sql
dateadd_sql
arrayany_sql
generateseries_sql
struct_sql
partitionrange_sql
truncatetable_sql
convert_sql
copyparameter_sql
credentials_sql
copy_sql
semicolon_sql
datadeletionproperty_sql
maskingpolicycolumnconstraint_sql
gapfill_sql
scope_resolution
scoperesolution_sql
parsejson_sql
length_sql
rand_sql
strtodate_sql
strtotime_sql
changes_sql
pad_sql