Edit on GitHub

sqlglot.dialects.clickhouse

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

Determines how function names are going to be normalized.

Possible values:

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

NULL_ORDERING = 'nulls_are_last'

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

SUPPORTS_USER_DEFINED_TYPES = False

Whether user-defined data types are supported.

SAFE_DIVISION = True

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

LOG_BASE_FIRST: Optional[bool] = None

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

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

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

tokenizer_class = <class 'ClickHouse.Tokenizer'>
parser_class = <class 'ClickHouse.Parser'>
generator_class = <class 'ClickHouse.Generator'>
TIME_TRIE: Dict = {}
FORMAT_TRIE: Dict = {}
INVERSE_TIME_MAPPING: Dict[str, str] = {}
INVERSE_TIME_TRIE: Dict = {}
ESCAPED_SEQUENCES: Dict[str, str] = {'\x07': '\\a', '\x08': '\\b', '\x0c': '\\f', '\n': '\\n', '\r': '\\r', '\t': '\\t', '\x0b': '\\v', '\\': '\\\\', '\x00': '\\0'}
QUOTE_START = "'"
QUOTE_END = "'"
IDENTIFIER_START = '"'
IDENTIFIER_END = '"'
BIT_START: Optional[str] = '0b'
BIT_END: Optional[str] = ''
HEX_START: Optional[str] = '0x'
HEX_END: Optional[str] = ''
BYTE_START: Optional[str] = None
BYTE_END: Optional[str] = None
UNICODE_START: Optional[str] = None
UNICODE_END: Optional[str] = None
class ClickHouse.Tokenizer(sqlglot.tokens.Tokenizer):
 58    class Tokenizer(tokens.Tokenizer):
 59        COMMENTS = ["--", "#", "#!", ("/*", "*/")]
 60        IDENTIFIERS = ['"', "`"]
 61        STRING_ESCAPES = ["'", "\\"]
 62        BIT_STRINGS = [("0b", "")]
 63        HEX_STRINGS = [("0x", ""), ("0X", "")]
 64        HEREDOC_STRINGS = ["$"]
 65
 66        KEYWORDS = {
 67            **tokens.Tokenizer.KEYWORDS,
 68            "ATTACH": TokenType.COMMAND,
 69            "DATE32": TokenType.DATE32,
 70            "DATETIME64": TokenType.DATETIME64,
 71            "DICTIONARY": TokenType.DICTIONARY,
 72            "ENUM8": TokenType.ENUM8,
 73            "ENUM16": TokenType.ENUM16,
 74            "FINAL": TokenType.FINAL,
 75            "FIXEDSTRING": TokenType.FIXEDSTRING,
 76            "FLOAT32": TokenType.FLOAT,
 77            "FLOAT64": TokenType.DOUBLE,
 78            "GLOBAL": TokenType.GLOBAL,
 79            "INT256": TokenType.INT256,
 80            "LOWCARDINALITY": TokenType.LOWCARDINALITY,
 81            "MAP": TokenType.MAP,
 82            "NESTED": TokenType.NESTED,
 83            "SAMPLE": TokenType.TABLE_SAMPLE,
 84            "TUPLE": TokenType.STRUCT,
 85            "UINT128": TokenType.UINT128,
 86            "UINT16": TokenType.USMALLINT,
 87            "UINT256": TokenType.UINT256,
 88            "UINT32": TokenType.UINT,
 89            "UINT64": TokenType.UBIGINT,
 90            "UINT8": TokenType.UTINYINT,
 91            "IPV4": TokenType.IPV4,
 92            "IPV6": TokenType.IPV6,
 93            "AGGREGATEFUNCTION": TokenType.AGGREGATEFUNCTION,
 94            "SIMPLEAGGREGATEFUNCTION": TokenType.SIMPLEAGGREGATEFUNCTION,
 95            "SYSTEM": TokenType.COMMAND,
 96            "PREWHERE": TokenType.PREWHERE,
 97        }
 98
 99        SINGLE_TOKENS = {
100            **tokens.Tokenizer.SINGLE_TOKENS,
101            "$": TokenType.HEREDOC_STRING,
102        }
COMMENTS = ['--', '#', '#!', ('/*', '*/')]
IDENTIFIERS = ['"', '`']
STRING_ESCAPES = ["'", '\\']
BIT_STRINGS = [('0b', '')]
HEX_STRINGS = [('0x', ''), ('0X', '')]
HEREDOC_STRINGS = ['$']
KEYWORDS = {'{%': <TokenType.BLOCK_START: 'BLOCK_START'>, '{%+': <TokenType.BLOCK_START: 'BLOCK_START'>, '{%-': <TokenType.BLOCK_START: 'BLOCK_START'>, '%}': <TokenType.BLOCK_END: 'BLOCK_END'>, '+%}': <TokenType.BLOCK_END: 'BLOCK_END'>, '-%}': <TokenType.BLOCK_END: 'BLOCK_END'>, '{{+': <TokenType.BLOCK_START: 'BLOCK_START'>, '{{-': <TokenType.BLOCK_START: 'BLOCK_START'>, '+}}': <TokenType.BLOCK_END: 'BLOCK_END'>, '-}}': <TokenType.BLOCK_END: 'BLOCK_END'>, '/*+': <TokenType.HINT: 'HINT'>, '==': <TokenType.EQ: 'EQ'>, '::': <TokenType.DCOLON: 'DCOLON'>, '||': <TokenType.DPIPE: 'DPIPE'>, '>=': <TokenType.GTE: 'GTE'>, '<=': <TokenType.LTE: 'LTE'>, '<>': <TokenType.NEQ: 'NEQ'>, '!=': <TokenType.NEQ: 'NEQ'>, ':=': <TokenType.COLON_EQ: 'COLON_EQ'>, '<=>': <TokenType.NULLSAFE_EQ: 'NULLSAFE_EQ'>, '->': <TokenType.ARROW: 'ARROW'>, '->>': <TokenType.DARROW: 'DARROW'>, '=>': <TokenType.FARROW: 'FARROW'>, '#>': <TokenType.HASH_ARROW: 'HASH_ARROW'>, '#>>': <TokenType.DHASH_ARROW: 'DHASH_ARROW'>, '<->': <TokenType.LR_ARROW: 'LR_ARROW'>, '&&': <TokenType.DAMP: 'DAMP'>, '??': <TokenType.DQMARK: 'DQMARK'>, 'ALL': <TokenType.ALL: 'ALL'>, 'ALWAYS': <TokenType.ALWAYS: 'ALWAYS'>, 'AND': <TokenType.AND: 'AND'>, 'ANTI': <TokenType.ANTI: 'ANTI'>, 'ANY': <TokenType.ANY: 'ANY'>, 'ASC': <TokenType.ASC: 'ASC'>, 'AS': <TokenType.ALIAS: 'ALIAS'>, 'ASOF': <TokenType.ASOF: 'ASOF'>, 'AUTOINCREMENT': <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, 'AUTO_INCREMENT': <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, 'BEGIN': <TokenType.BEGIN: 'BEGIN'>, 'BETWEEN': <TokenType.BETWEEN: 'BETWEEN'>, 'CACHE': <TokenType.CACHE: 'CACHE'>, 'UNCACHE': <TokenType.UNCACHE: 'UNCACHE'>, 'CASE': <TokenType.CASE: 'CASE'>, 'CHARACTER SET': <TokenType.CHARACTER_SET: 'CHARACTER_SET'>, 'CLUSTER BY': <TokenType.CLUSTER_BY: 'CLUSTER_BY'>, 'COLLATE': <TokenType.COLLATE: 'COLLATE'>, 'COLUMN': <TokenType.COLUMN: 'COLUMN'>, 'COMMIT': <TokenType.COMMIT: 'COMMIT'>, 'CONNECT BY': <TokenType.CONNECT_BY: 'CONNECT_BY'>, 'CONSTRAINT': <TokenType.CONSTRAINT: 'CONSTRAINT'>, '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'>, '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'>, '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'>, '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'>, 'DATE': <TokenType.DATE: 'DATE'>, 'DATETIME': <TokenType.DATETIME: 'DATETIME'>, 'INT4RANGE': <TokenType.INT4RANGE: 'INT4RANGE'>, 'INT4MULTIRANGE': <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, 'INT8RANGE': <TokenType.INT8RANGE: 'INT8RANGE'>, 'INT8MULTIRANGE': <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, 'NUMRANGE': <TokenType.NUMRANGE: 'NUMRANGE'>, 'NUMMULTIRANGE': <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, 'TSRANGE': <TokenType.TSRANGE: 'TSRANGE'>, 'TSMULTIRANGE': <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, 'TSTZRANGE': <TokenType.TSTZRANGE: 'TSTZRANGE'>, 'TSTZMULTIRANGE': <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, 'DATERANGE': <TokenType.DATERANGE: 'DATERANGE'>, 'DATEMULTIRANGE': <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, 'UNIQUE': <TokenType.UNIQUE: 'UNIQUE'>, 'STRUCT': <TokenType.STRUCT: 'STRUCT'>, 'SEQUENCE': <TokenType.SEQUENCE: 'SEQUENCE'>, 'VARIANT': <TokenType.VARIANT: 'VARIANT'>, 'ALTER': <TokenType.ALTER: 'ALTER'>, 'ANALYZE': <TokenType.COMMAND: 'COMMAND'>, 'CALL': <TokenType.COMMAND: 'COMMAND'>, 'COMMENT': <TokenType.COMMENT: 'COMMENT'>, 'COPY': <TokenType.COMMAND: 'COMMAND'>, '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.QUOTE: 'QUOTE'>, '`': <TokenType.IDENTIFIER: 'IDENTIFIER'>, '"': <TokenType.IDENTIFIER: 'IDENTIFIER'>, '#': <TokenType.HASH: 'HASH'>, '$': <TokenType.HEREDOC_STRING: 'HEREDOC_STRING'>}
class ClickHouse.Parser(sqlglot.parser.Parser):
104    class Parser(parser.Parser):
105        # Tested in ClickHouse's playground, it seems that the following two queries do the same thing
106        # * select x from t1 union all select x from t2 limit 1;
107        # * select x from t1 union all (select x from t2 limit 1);
108        MODIFIERS_ATTACHED_TO_UNION = False
109        INTERVAL_SPANS = False
110
111        FUNCTIONS = {
112            **parser.Parser.FUNCTIONS,
113            "ANY": exp.AnyValue.from_arg_list,
114            "ARRAYSUM": exp.ArraySum.from_arg_list,
115            "COUNTIF": _build_count_if,
116            "DATE_ADD": lambda args: exp.DateAdd(
117                this=seq_get(args, 2), expression=seq_get(args, 1), unit=seq_get(args, 0)
118            ),
119            "DATEADD": lambda args: exp.DateAdd(
120                this=seq_get(args, 2), expression=seq_get(args, 1), unit=seq_get(args, 0)
121            ),
122            "DATE_DIFF": lambda args: exp.DateDiff(
123                this=seq_get(args, 2), expression=seq_get(args, 1), unit=seq_get(args, 0)
124            ),
125            "DATEDIFF": lambda args: exp.DateDiff(
126                this=seq_get(args, 2), expression=seq_get(args, 1), unit=seq_get(args, 0)
127            ),
128            "JSONEXTRACTSTRING": build_json_extract_path(
129                exp.JSONExtractScalar, zero_based_indexing=False
130            ),
131            "MAP": parser.build_var_map,
132            "MATCH": exp.RegexpLike.from_arg_list,
133            "RANDCANONICAL": exp.Rand.from_arg_list,
134            "TUPLE": exp.Struct.from_arg_list,
135            "UNIQ": exp.ApproxDistinct.from_arg_list,
136            "XOR": lambda args: exp.Xor(expressions=args),
137        }
138
139        AGG_FUNCTIONS = {
140            "count",
141            "min",
142            "max",
143            "sum",
144            "avg",
145            "any",
146            "stddevPop",
147            "stddevSamp",
148            "varPop",
149            "varSamp",
150            "corr",
151            "covarPop",
152            "covarSamp",
153            "entropy",
154            "exponentialMovingAverage",
155            "intervalLengthSum",
156            "kolmogorovSmirnovTest",
157            "mannWhitneyUTest",
158            "median",
159            "rankCorr",
160            "sumKahan",
161            "studentTTest",
162            "welchTTest",
163            "anyHeavy",
164            "anyLast",
165            "boundingRatio",
166            "first_value",
167            "last_value",
168            "argMin",
169            "argMax",
170            "avgWeighted",
171            "topK",
172            "topKWeighted",
173            "deltaSum",
174            "deltaSumTimestamp",
175            "groupArray",
176            "groupArrayLast",
177            "groupUniqArray",
178            "groupArrayInsertAt",
179            "groupArrayMovingAvg",
180            "groupArrayMovingSum",
181            "groupArraySample",
182            "groupBitAnd",
183            "groupBitOr",
184            "groupBitXor",
185            "groupBitmap",
186            "groupBitmapAnd",
187            "groupBitmapOr",
188            "groupBitmapXor",
189            "sumWithOverflow",
190            "sumMap",
191            "minMap",
192            "maxMap",
193            "skewSamp",
194            "skewPop",
195            "kurtSamp",
196            "kurtPop",
197            "uniq",
198            "uniqExact",
199            "uniqCombined",
200            "uniqCombined64",
201            "uniqHLL12",
202            "uniqTheta",
203            "quantile",
204            "quantiles",
205            "quantileExact",
206            "quantilesExact",
207            "quantileExactLow",
208            "quantilesExactLow",
209            "quantileExactHigh",
210            "quantilesExactHigh",
211            "quantileExactWeighted",
212            "quantilesExactWeighted",
213            "quantileTiming",
214            "quantilesTiming",
215            "quantileTimingWeighted",
216            "quantilesTimingWeighted",
217            "quantileDeterministic",
218            "quantilesDeterministic",
219            "quantileTDigest",
220            "quantilesTDigest",
221            "quantileTDigestWeighted",
222            "quantilesTDigestWeighted",
223            "quantileBFloat16",
224            "quantilesBFloat16",
225            "quantileBFloat16Weighted",
226            "quantilesBFloat16Weighted",
227            "simpleLinearRegression",
228            "stochasticLinearRegression",
229            "stochasticLogisticRegression",
230            "categoricalInformationValue",
231            "contingency",
232            "cramersV",
233            "cramersVBiasCorrected",
234            "theilsU",
235            "maxIntersections",
236            "maxIntersectionsPosition",
237            "meanZTest",
238            "quantileInterpolatedWeighted",
239            "quantilesInterpolatedWeighted",
240            "quantileGK",
241            "quantilesGK",
242            "sparkBar",
243            "sumCount",
244            "largestTriangleThreeBuckets",
245        }
246
247        AGG_FUNCTIONS_SUFFIXES = [
248            "If",
249            "Array",
250            "ArrayIf",
251            "Map",
252            "SimpleState",
253            "State",
254            "Merge",
255            "MergeState",
256            "ForEach",
257            "Distinct",
258            "OrDefault",
259            "OrNull",
260            "Resample",
261            "ArgMin",
262            "ArgMax",
263        ]
264
265        FUNC_TOKENS = {
266            *parser.Parser.FUNC_TOKENS,
267            TokenType.SET,
268        }
269
270        AGG_FUNC_MAPPING = (
271            lambda functions, suffixes: {
272                f"{f}{sfx}": (f, sfx) for sfx in (suffixes + [""]) for f in functions
273            }
274        )(AGG_FUNCTIONS, AGG_FUNCTIONS_SUFFIXES)
275
276        FUNCTIONS_WITH_ALIASED_ARGS = {*parser.Parser.FUNCTIONS_WITH_ALIASED_ARGS, "TUPLE"}
277
278        FUNCTION_PARSERS = {
279            **parser.Parser.FUNCTION_PARSERS,
280            "ARRAYJOIN": lambda self: self.expression(exp.Explode, this=self._parse_expression()),
281            "QUANTILE": lambda self: self._parse_quantile(),
282        }
283
284        FUNCTION_PARSERS.pop("MATCH")
285
286        NO_PAREN_FUNCTION_PARSERS = parser.Parser.NO_PAREN_FUNCTION_PARSERS.copy()
287        NO_PAREN_FUNCTION_PARSERS.pop("ANY")
288
289        RANGE_PARSERS = {
290            **parser.Parser.RANGE_PARSERS,
291            TokenType.GLOBAL: lambda self, this: self._match(TokenType.IN)
292            and self._parse_in(this, is_global=True),
293        }
294
295        # The PLACEHOLDER entry is popped because 1) it doesn't affect Clickhouse (it corresponds to
296        # the postgres-specific JSONBContains parser) and 2) it makes parsing the ternary op simpler.
297        COLUMN_OPERATORS = parser.Parser.COLUMN_OPERATORS.copy()
298        COLUMN_OPERATORS.pop(TokenType.PLACEHOLDER)
299
300        JOIN_KINDS = {
301            *parser.Parser.JOIN_KINDS,
302            TokenType.ANY,
303            TokenType.ASOF,
304            TokenType.ARRAY,
305        }
306
307        TABLE_ALIAS_TOKENS = parser.Parser.TABLE_ALIAS_TOKENS - {
308            TokenType.ANY,
309            TokenType.ARRAY,
310            TokenType.FINAL,
311            TokenType.FORMAT,
312            TokenType.SETTINGS,
313        }
314
315        ALIAS_TOKENS = parser.Parser.ALIAS_TOKENS - {
316            TokenType.FORMAT,
317        }
318
319        LOG_DEFAULTS_TO_LN = True
320
321        QUERY_MODIFIER_PARSERS = {
322            **parser.Parser.QUERY_MODIFIER_PARSERS,
323            TokenType.SETTINGS: lambda self: (
324                "settings",
325                self._advance() or self._parse_csv(self._parse_conjunction),
326            ),
327            TokenType.FORMAT: lambda self: ("format", self._advance() or self._parse_id_var()),
328        }
329
330        CONSTRAINT_PARSERS = {
331            **parser.Parser.CONSTRAINT_PARSERS,
332            "INDEX": lambda self: self._parse_index_constraint(),
333            "CODEC": lambda self: self._parse_compress(),
334        }
335
336        SCHEMA_UNNAMED_CONSTRAINTS = {
337            *parser.Parser.SCHEMA_UNNAMED_CONSTRAINTS,
338            "INDEX",
339        }
340
341        def _parse_conjunction(self) -> t.Optional[exp.Expression]:
342            this = super()._parse_conjunction()
343
344            if self._match(TokenType.PLACEHOLDER):
345                return self.expression(
346                    exp.If,
347                    this=this,
348                    true=self._parse_conjunction(),
349                    false=self._match(TokenType.COLON) and self._parse_conjunction(),
350                )
351
352            return this
353
354        def _parse_placeholder(self) -> t.Optional[exp.Expression]:
355            """
356            Parse a placeholder expression like SELECT {abc: UInt32} or FROM {table: Identifier}
357            https://clickhouse.com/docs/en/sql-reference/syntax#defining-and-using-query-parameters
358            """
359            if not self._match(TokenType.L_BRACE):
360                return None
361
362            this = self._parse_id_var()
363            self._match(TokenType.COLON)
364            kind = self._parse_types(check_func=False, allow_identifiers=False) or (
365                self._match_text_seq("IDENTIFIER") and "Identifier"
366            )
367
368            if not kind:
369                self.raise_error("Expecting a placeholder type or 'Identifier' for tables")
370            elif not self._match(TokenType.R_BRACE):
371                self.raise_error("Expecting }")
372
373            return self.expression(exp.Placeholder, this=this, kind=kind)
374
375        def _parse_in(self, this: t.Optional[exp.Expression], is_global: bool = False) -> exp.In:
376            this = super()._parse_in(this)
377            this.set("is_global", is_global)
378            return this
379
380        def _parse_table(
381            self,
382            schema: bool = False,
383            joins: bool = False,
384            alias_tokens: t.Optional[t.Collection[TokenType]] = None,
385            parse_bracket: bool = False,
386            is_db_reference: bool = False,
387        ) -> t.Optional[exp.Expression]:
388            this = super()._parse_table(
389                schema=schema,
390                joins=joins,
391                alias_tokens=alias_tokens,
392                parse_bracket=parse_bracket,
393                is_db_reference=is_db_reference,
394            )
395
396            if self._match(TokenType.FINAL):
397                this = self.expression(exp.Final, this=this)
398
399            return this
400
401        def _parse_position(self, haystack_first: bool = False) -> exp.StrPosition:
402            return super()._parse_position(haystack_first=True)
403
404        # https://clickhouse.com/docs/en/sql-reference/statements/select/with/
405        def _parse_cte(self) -> exp.CTE:
406            # WITH <identifier> AS <subquery expression>
407            cte: t.Optional[exp.CTE] = self._try_parse(super()._parse_cte)
408
409            if not cte:
410                # WITH <expression> AS <identifier>
411                cte = self.expression(
412                    exp.CTE,
413                    this=self._parse_conjunction(),
414                    alias=self._parse_table_alias(),
415                    scalar=True,
416                )
417
418            return cte
419
420        def _parse_join_parts(
421            self,
422        ) -> t.Tuple[t.Optional[Token], t.Optional[Token], t.Optional[Token]]:
423            is_global = self._match(TokenType.GLOBAL) and self._prev
424            kind_pre = self._match_set(self.JOIN_KINDS, advance=False) and self._prev
425
426            if kind_pre:
427                kind = self._match_set(self.JOIN_KINDS) and self._prev
428                side = self._match_set(self.JOIN_SIDES) and self._prev
429                return is_global, side, kind
430
431            return (
432                is_global,
433                self._match_set(self.JOIN_SIDES) and self._prev,
434                self._match_set(self.JOIN_KINDS) and self._prev,
435            )
436
437        def _parse_join(
438            self, skip_join_token: bool = False, parse_bracket: bool = False
439        ) -> t.Optional[exp.Join]:
440            join = super()._parse_join(skip_join_token=skip_join_token, parse_bracket=True)
441            if join:
442                join.set("global", join.args.pop("method", None))
443
444            return join
445
446        def _parse_function(
447            self,
448            functions: t.Optional[t.Dict[str, t.Callable]] = None,
449            anonymous: bool = False,
450            optional_parens: bool = True,
451        ) -> t.Optional[exp.Expression]:
452            func = super()._parse_function(
453                functions=functions, anonymous=anonymous, optional_parens=optional_parens
454            )
455
456            if isinstance(func, exp.Anonymous):
457                parts = self.AGG_FUNC_MAPPING.get(func.this)
458                params = self._parse_func_params(func)
459
460                if params:
461                    if parts and parts[1]:
462                        return self.expression(
463                            exp.CombinedParameterizedAgg,
464                            this=func.this,
465                            expressions=func.expressions,
466                            params=params,
467                            parts=parts,
468                        )
469                    return self.expression(
470                        exp.ParameterizedAgg,
471                        this=func.this,
472                        expressions=func.expressions,
473                        params=params,
474                    )
475
476                if parts:
477                    if parts[1]:
478                        return self.expression(
479                            exp.CombinedAggFunc,
480                            this=func.this,
481                            expressions=func.expressions,
482                            parts=parts,
483                        )
484                    return self.expression(
485                        exp.AnonymousAggFunc,
486                        this=func.this,
487                        expressions=func.expressions,
488                    )
489
490            return func
491
492        def _parse_func_params(
493            self, this: t.Optional[exp.Func] = None
494        ) -> t.Optional[t.List[exp.Expression]]:
495            if self._match_pair(TokenType.R_PAREN, TokenType.L_PAREN):
496                return self._parse_csv(self._parse_lambda)
497
498            if self._match(TokenType.L_PAREN):
499                params = self._parse_csv(self._parse_lambda)
500                self._match_r_paren(this)
501                return params
502
503            return None
504
505        def _parse_quantile(self) -> exp.Quantile:
506            this = self._parse_lambda()
507            params = self._parse_func_params()
508            if params:
509                return self.expression(exp.Quantile, this=params[0], quantile=this)
510            return self.expression(exp.Quantile, this=this, quantile=exp.Literal.number(0.5))
511
512        def _parse_wrapped_id_vars(self, optional: bool = False) -> t.List[exp.Expression]:
513            return super()._parse_wrapped_id_vars(optional=True)
514
515        def _parse_primary_key(
516            self, wrapped_optional: bool = False, in_props: bool = False
517        ) -> exp.PrimaryKeyColumnConstraint | exp.PrimaryKey:
518            return super()._parse_primary_key(
519                wrapped_optional=wrapped_optional or in_props, in_props=in_props
520            )
521
522        def _parse_on_property(self) -> t.Optional[exp.Expression]:
523            index = self._index
524            if self._match_text_seq("CLUSTER"):
525                this = self._parse_id_var()
526                if this:
527                    return self.expression(exp.OnCluster, this=this)
528                else:
529                    self._retreat(index)
530            return None
531
532        def _parse_index_constraint(
533            self, kind: t.Optional[str] = None
534        ) -> exp.IndexColumnConstraint:
535            # INDEX name1 expr TYPE type1(args) GRANULARITY value
536            this = self._parse_id_var()
537            expression = self._parse_conjunction()
538
539            index_type = self._match_text_seq("TYPE") and (
540                self._parse_function() or self._parse_var()
541            )
542
543            granularity = self._match_text_seq("GRANULARITY") and self._parse_term()
544
545            return self.expression(
546                exp.IndexColumnConstraint,
547                this=this,
548                expression=expression,
549                index_type=index_type,
550                granularity=granularity,
551            )

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_UNION = 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_CONTAINS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayContains'>>, '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 ClickHouse.Parser.<lambda>>, 'DATEDIFF': <function ClickHouse.Parser.<lambda>>, 'DATE_DIFF': <function ClickHouse.Parser.<lambda>>, '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': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateSub'>>, '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_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'>>, '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': <bound method Func.from_arg_list of <class 'sqlglot.expressions.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_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'>>, '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': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Lower'>>, 'LCASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Lower'>>, 'MD5': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MD5'>>, 'MD5_DIGEST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MD5Digest'>>, 'MAP': <function build_var_map>, 'MAP_FROM_ENTRIES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MapFromEntries'>>, 'MATCH_AGAINST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MatchAgainst'>>, 'MAX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Max'>>, 'MIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Min'>>, 'MONTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Month'>>, 'MONTHS_BETWEEN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MonthsBetween'>>, 'NEXT_VALUE_FOR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.NextValueFor'>>, 'NTH_VALUE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.NthValue'>>, 'NULLIF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Nullif'>>, 'NUMBER_TO_STR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.NumberToStr'>>, 'NVL2': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Nvl2'>>, 'OPEN_J_S_O_N': <bound method Func.from_arg_list of <class 'sqlglot.expressions.OpenJSON'>>, 'PARAMETERIZED_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParameterizedAgg'>>, 'PARSE_JSON': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseJSON'>>, 'JSON_PARSE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseJSON'>>, 'PERCENTILE_CONT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.PercentileCont'>>, 'PERCENTILE_DISC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.PercentileDisc'>>, 'POSEXPLODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Posexplode'>>, 'POSEXPLODE_OUTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.PosexplodeOuter'>>, 'POWER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Pow'>>, 'POW': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Pow'>>, 'PREDICT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Predict'>>, 'QUANTILE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Quantile'>>, 'RAND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Rand'>>, 'RANDOM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Rand'>>, 'RANDN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Randn'>>, 'RANGE_N': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RangeN'>>, 'READ_CSV': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ReadCSV'>>, 'REDUCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Reduce'>>, 'REGEXP_EXTRACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpExtract'>>, 'REGEXP_I_LIKE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpILike'>>, 'REGEXP_LIKE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpLike'>>, 'REGEXP_REPLACE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpReplace'>>, 'REGEXP_SPLIT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpSplit'>>, 'REPEAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Repeat'>>, 'RIGHT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Right'>>, 'ROUND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Round'>>, 'ROW_NUMBER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RowNumber'>>, 'SHA': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SHA'>>, 'SHA1': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SHA'>>, 'SHA2': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SHA2'>>, 'SAFE_DIVIDE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SafeDivide'>>, 'SIGN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sign'>>, 'SIGNUM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sign'>>, 'SORT_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SortArray'>>, 'SPLIT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Split'>>, 'SQRT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sqrt'>>, 'STANDARD_HASH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StandardHash'>>, 'STAR_MAP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StarMap'>>, 'STARTS_WITH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StartsWith'>>, 'STARTSWITH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StartsWith'>>, 'STDDEV': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Stddev'>>, 'STDDEV_POP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StddevPop'>>, 'STDDEV_SAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StddevSamp'>>, 'STR_POSITION': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrPosition'>>, 'STR_TO_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrToDate'>>, 'STR_TO_MAP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrToMap'>>, 'STR_TO_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrToTime'>>, 'STR_TO_UNIX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrToUnix'>>, '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_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': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampAdd'>>, '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': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampSub'>>, '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_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'>>, 'UPPER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Upper'>>, 'UCASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Upper'>>, 'VAR_MAP': <function build_var_map>, 'VARIANCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Variance'>>, 'VARIANCE_SAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Variance'>>, 'VAR_SAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Variance'>>, 'VARIANCE_POP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.VariancePop'>>, 'VAR_POP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.VariancePop'>>, 'WEEK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Week'>>, 'WEEK_OF_YEAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.WeekOfYear'>>, 'WEEKOFYEAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.WeekOfYear'>>, 'WHEN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.When'>>, 'X_M_L_TABLE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.XMLTable'>>, 'XOR': <function ClickHouse.Parser.<lambda>>, 'YEAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Year'>>, 'GLOB': <function Parser.<lambda>>, 'JSON_EXTRACT_PATH_TEXT': <function build_extract_json_with_path.<locals>._builder>, 'LIKE': <function build_like>, 'LOG2': <function Parser.<lambda>>, 'LOG10': <function Parser.<lambda>>, 'MOD': <function Parser.<lambda>>, '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 ClickHouse.Parser.<lambda>>, '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'>>, 'UNIQ': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxDistinct'>>}
AGG_FUNCTIONS = {'argMax', 'covarSamp', 'entropy', 'cramersVBiasCorrected', 'topKWeighted', 'maxIntersectionsPosition', 'min', 'groupArrayMovingSum', 'maxMap', 'any', 'deltaSumTimestamp', 'quantilesBFloat16', 'quantileTimingWeighted', 'quantilesExactWeighted', 'groupBitXor', 'quantilesBFloat16Weighted', 'uniqTheta', 'groupArrayMovingAvg', 'kurtPop', 'uniqCombined', 'quantileTDigestWeighted', 'uniqCombined64', 'welchTTest', 'sumWithOverflow', 'cramersV', 'quantilesTDigest', 'varPop', 'contingency', 'groupBitOr', 'groupArray', 'groupBitmapOr', 'quantileBFloat16Weighted', 'quantileGK', 'theilsU', 'anyLast', 'quantilesTiming', 'skewPop', 'sum', 'sumMap', 'median', 'groupBitAnd', 'quantilesExactHigh', 'intervalLengthSum', 'avgWeighted', 'simpleLinearRegression', 'deltaSum', 'quantilesTDigestWeighted', 'sumKahan', 'quantileTDigest', 'quantilesExactLow', 'skewSamp', 'groupBitmap', 'stochasticLinearRegression', 'groupBitmapXor', 'stddevSamp', 'kurtSamp', 'quantileBFloat16', 'sumCount', 'groupArrayInsertAt', 'groupUniqArray', 'groupArraySample', 'uniqExact', 'varSamp', 'quantileDeterministic', 'max', 'quantileExactHigh', 'maxIntersections', 'studentTTest', 'quantilesDeterministic', 'boundingRatio', 'stochasticLogisticRegression', 'argMin', 'topK', 'quantileExact', 'rankCorr', 'quantilesGK', 'exponentialMovingAverage', 'groupArrayLast', 'categoricalInformationValue', 'avg', 'quantileExactLow', 'first_value', 'anyHeavy', 'uniq', 'quantilesInterpolatedWeighted', 'kolmogorovSmirnovTest', 'quantileInterpolatedWeighted', 'count', 'groupBitmapAnd', 'largestTriangleThreeBuckets', 'mannWhitneyUTest', 'quantilesTimingWeighted', 'meanZTest', 'quantiles', 'corr', 'quantileTiming', 'quantileExactWeighted', 'uniqHLL12', 'quantile', 'sparkBar', 'last_value', 'covarPop', 'minMap', 'stddevPop', 'quantilesExact'}
AGG_FUNCTIONS_SUFFIXES = ['If', 'Array', 'ArrayIf', 'Map', 'SimpleState', 'State', 'Merge', 'MergeState', 'ForEach', 'Distinct', 'OrDefault', 'OrNull', 'Resample', 'ArgMin', 'ArgMax']
FUNC_TOKENS = {<TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.ILIKE: 'ILIKE'>, <TokenType.JSON: 'JSON'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.MERGE: 'MERGE'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.UINT128: 'UINT128'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.INT256: 'INT256'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.XML: 'XML'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.NESTED: 'NESTED'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.INDEX: 'INDEX'>, <TokenType.VAR: 'VAR'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.IPV4: 'IPV4'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.TIME: 'TIME'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.MONEY: 'MONEY'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.FILTER: 'FILTER'>, <TokenType.LEFT: 'LEFT'>, <TokenType.UUID: 'UUID'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.INSERT: 'INSERT'>, <TokenType.INET: 'INET'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.DATE32: 'DATE32'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.DATE: 'DATE'>, <TokenType.TEXT: 'TEXT'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.SUPER: 'SUPER'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.MAP: 'MAP'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.IPV6: 'IPV6'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.NAME: 'NAME'>, <TokenType.ENUM: 'ENUM'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.FIRST: 'FIRST'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.NULL: 'NULL'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.RIGHT: 'RIGHT'>, <TokenType.BIT: 'BIT'>, <TokenType.SET: 'SET'>, <TokenType.JSONB: 'JSONB'>, <TokenType.UNIQUEIDENTIFIER: 'UNIQUEIDENTIFIER'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.ROW: 'ROW'>, <TokenType.PRIMARY_KEY: 'PRIMARY_KEY'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.SOME: 'SOME'>, <TokenType.CHAR: 'CHAR'>, <TokenType.XOR: 'XOR'>, <TokenType.FORMAT: 'FORMAT'>, <TokenType.LIKE: 'LIKE'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.WINDOW: 'WINDOW'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.RLIKE: 'RLIKE'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.UINT256: 'UINT256'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.BINARY: 'BINARY'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.INT: 'INT'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.INT128: 'INT128'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.TABLE: 'TABLE'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.YEAR: 'YEAR'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.RANGE: 'RANGE'>, <TokenType.GLOB: 'GLOB'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.UINT: 'UINT'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.ANY: 'ANY'>, <TokenType.ALL: 'ALL'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>}
AGG_FUNC_MAPPING = {'argMaxIf': ('argMax', 'If'), 'covarSampIf': ('covarSamp', 'If'), 'entropyIf': ('entropy', 'If'), 'cramersVBiasCorrectedIf': ('cramersVBiasCorrected', 'If'), 'topKWeightedIf': ('topKWeighted', 'If'), 'maxIntersectionsPositionIf': ('maxIntersectionsPosition', 'If'), 'minIf': ('min', 'If'), 'groupArrayMovingSumIf': ('groupArrayMovingSum', 'If'), 'maxMapIf': ('maxMap', 'If'), 'anyIf': ('any', 'If'), 'deltaSumTimestampIf': ('deltaSumTimestamp', 'If'), 'quantilesBFloat16If': ('quantilesBFloat16', 'If'), 'quantileTimingWeightedIf': ('quantileTimingWeighted', 'If'), 'quantilesExactWeightedIf': ('quantilesExactWeighted', 'If'), 'groupBitXorIf': ('groupBitXor', 'If'), 'quantilesBFloat16WeightedIf': ('quantilesBFloat16Weighted', 'If'), 'uniqThetaIf': ('uniqTheta', 'If'), 'groupArrayMovingAvgIf': ('groupArrayMovingAvg', 'If'), 'kurtPopIf': ('kurtPop', 'If'), 'uniqCombinedIf': ('uniqCombined', 'If'), 'quantileTDigestWeightedIf': ('quantileTDigestWeighted', 'If'), 'uniqCombined64If': ('uniqCombined64', 'If'), 'welchTTestIf': ('welchTTest', 'If'), 'sumWithOverflowIf': ('sumWithOverflow', 'If'), 'cramersVIf': ('cramersV', 'If'), 'quantilesTDigestIf': ('quantilesTDigest', 'If'), 'varPopIf': ('varPop', 'If'), 'contingencyIf': ('contingency', 'If'), 'groupBitOrIf': ('groupBitOr', 'If'), 'groupArrayIf': ('groupArray', 'If'), 'groupBitmapOrIf': ('groupBitmapOr', 'If'), 'quantileBFloat16WeightedIf': ('quantileBFloat16Weighted', 'If'), 'quantileGKIf': ('quantileGK', 'If'), 'theilsUIf': ('theilsU', 'If'), 'anyLastIf': ('anyLast', 'If'), 'quantilesTimingIf': ('quantilesTiming', 'If'), 'skewPopIf': ('skewPop', 'If'), 'sumIf': ('sum', 'If'), 'sumMapIf': ('sumMap', 'If'), 'medianIf': ('median', 'If'), 'groupBitAndIf': ('groupBitAnd', 'If'), 'quantilesExactHighIf': ('quantilesExactHigh', 'If'), 'intervalLengthSumIf': ('intervalLengthSum', 'If'), 'avgWeightedIf': ('avgWeighted', 'If'), 'simpleLinearRegressionIf': ('simpleLinearRegression', 'If'), 'deltaSumIf': ('deltaSum', 'If'), 'quantilesTDigestWeightedIf': ('quantilesTDigestWeighted', 'If'), 'sumKahanIf': ('sumKahan', 'If'), 'quantileTDigestIf': ('quantileTDigest', 'If'), 'quantilesExactLowIf': ('quantilesExactLow', 'If'), 'skewSampIf': ('skewSamp', 'If'), 'groupBitmapIf': ('groupBitmap', 'If'), 'stochasticLinearRegressionIf': ('stochasticLinearRegression', 'If'), 'groupBitmapXorIf': ('groupBitmapXor', 'If'), 'stddevSampIf': ('stddevSamp', 'If'), 'kurtSampIf': ('kurtSamp', 'If'), 'quantileBFloat16If': ('quantileBFloat16', 'If'), 'sumCountIf': ('sumCount', 'If'), 'groupArrayInsertAtIf': ('groupArrayInsertAt', 'If'), 'groupUniqArrayIf': ('groupUniqArray', 'If'), 'groupArraySampleIf': ('groupArraySample', 'If'), 'uniqExactIf': ('uniqExact', 'If'), 'varSampIf': ('varSamp', 'If'), 'quantileDeterministicIf': ('quantileDeterministic', 'If'), 'maxIf': ('max', 'If'), 'quantileExactHighIf': ('quantileExactHigh', 'If'), 'maxIntersectionsIf': ('maxIntersections', 'If'), 'studentTTestIf': ('studentTTest', 'If'), 'quantilesDeterministicIf': ('quantilesDeterministic', 'If'), 'boundingRatioIf': ('boundingRatio', 'If'), 'stochasticLogisticRegressionIf': ('stochasticLogisticRegression', 'If'), 'argMinIf': ('argMin', 'If'), 'topKIf': ('topK', 'If'), 'quantileExactIf': ('quantileExact', 'If'), 'rankCorrIf': ('rankCorr', 'If'), 'quantilesGKIf': ('quantilesGK', 'If'), 'exponentialMovingAverageIf': ('exponentialMovingAverage', 'If'), 'groupArrayLastIf': ('groupArrayLast', 'If'), 'categoricalInformationValueIf': ('categoricalInformationValue', 'If'), 'avgIf': ('avg', 'If'), 'quantileExactLowIf': ('quantileExactLow', 'If'), 'first_valueIf': ('first_value', 'If'), 'anyHeavyIf': ('anyHeavy', 'If'), 'uniqIf': ('uniq', 'If'), 'quantilesInterpolatedWeightedIf': ('quantilesInterpolatedWeighted', 'If'), 'kolmogorovSmirnovTestIf': ('kolmogorovSmirnovTest', 'If'), 'quantileInterpolatedWeightedIf': ('quantileInterpolatedWeighted', 'If'), 'countIf': ('count', 'If'), 'groupBitmapAndIf': ('groupBitmapAnd', 'If'), 'largestTriangleThreeBucketsIf': ('largestTriangleThreeBuckets', 'If'), 'mannWhitneyUTestIf': ('mannWhitneyUTest', 'If'), 'quantilesTimingWeightedIf': ('quantilesTimingWeighted', 'If'), 'meanZTestIf': ('meanZTest', 'If'), 'quantilesIf': ('quantiles', 'If'), 'corrIf': ('corr', 'If'), 'quantileTimingIf': ('quantileTiming', 'If'), 'quantileExactWeightedIf': ('quantileExactWeighted', 'If'), 'uniqHLL12If': ('uniqHLL12', 'If'), 'quantileIf': ('quantile', 'If'), 'sparkBarIf': ('sparkBar', 'If'), 'last_valueIf': ('last_value', 'If'), 'covarPopIf': ('covarPop', 'If'), 'minMapIf': ('minMap', 'If'), 'stddevPopIf': ('stddevPop', 'If'), 'quantilesExactIf': ('quantilesExact', 'If'), 'argMaxArray': ('argMax', 'Array'), 'covarSampArray': ('covarSamp', 'Array'), 'entropyArray': ('entropy', 'Array'), 'cramersVBiasCorrectedArray': ('cramersVBiasCorrected', 'Array'), 'topKWeightedArray': ('topKWeighted', 'Array'), 'maxIntersectionsPositionArray': ('maxIntersectionsPosition', 'Array'), 'minArray': ('min', 'Array'), 'groupArrayMovingSumArray': ('groupArrayMovingSum', 'Array'), 'maxMapArray': ('maxMap', 'Array'), 'anyArray': ('any', 'Array'), 'deltaSumTimestampArray': ('deltaSumTimestamp', 'Array'), 'quantilesBFloat16Array': ('quantilesBFloat16', 'Array'), 'quantileTimingWeightedArray': ('quantileTimingWeighted', 'Array'), 'quantilesExactWeightedArray': ('quantilesExactWeighted', 'Array'), 'groupBitXorArray': ('groupBitXor', 'Array'), 'quantilesBFloat16WeightedArray': ('quantilesBFloat16Weighted', 'Array'), 'uniqThetaArray': ('uniqTheta', 'Array'), 'groupArrayMovingAvgArray': ('groupArrayMovingAvg', 'Array'), 'kurtPopArray': ('kurtPop', 'Array'), 'uniqCombinedArray': ('uniqCombined', 'Array'), 'quantileTDigestWeightedArray': ('quantileTDigestWeighted', 'Array'), 'uniqCombined64Array': ('uniqCombined64', 'Array'), 'welchTTestArray': ('welchTTest', 'Array'), 'sumWithOverflowArray': ('sumWithOverflow', 'Array'), 'cramersVArray': ('cramersV', 'Array'), 'quantilesTDigestArray': ('quantilesTDigest', 'Array'), 'varPopArray': ('varPop', 'Array'), 'contingencyArray': ('contingency', 'Array'), 'groupBitOrArray': ('groupBitOr', 'Array'), 'groupArrayArray': ('groupArray', 'Array'), 'groupBitmapOrArray': ('groupBitmapOr', 'Array'), 'quantileBFloat16WeightedArray': ('quantileBFloat16Weighted', 'Array'), 'quantileGKArray': ('quantileGK', 'Array'), 'theilsUArray': ('theilsU', 'Array'), 'anyLastArray': ('anyLast', 'Array'), 'quantilesTimingArray': ('quantilesTiming', 'Array'), 'skewPopArray': ('skewPop', 'Array'), 'sumArray': ('sum', 'Array'), 'sumMapArray': ('sumMap', 'Array'), 'medianArray': ('median', 'Array'), 'groupBitAndArray': ('groupBitAnd', 'Array'), 'quantilesExactHighArray': ('quantilesExactHigh', 'Array'), 'intervalLengthSumArray': ('intervalLengthSum', 'Array'), 'avgWeightedArray': ('avgWeighted', 'Array'), 'simpleLinearRegressionArray': ('simpleLinearRegression', 'Array'), 'deltaSumArray': ('deltaSum', 'Array'), 'quantilesTDigestWeightedArray': ('quantilesTDigestWeighted', 'Array'), 'sumKahanArray': ('sumKahan', 'Array'), 'quantileTDigestArray': ('quantileTDigest', 'Array'), 'quantilesExactLowArray': ('quantilesExactLow', 'Array'), 'skewSampArray': ('skewSamp', 'Array'), 'groupBitmapArray': ('groupBitmap', 'Array'), 'stochasticLinearRegressionArray': ('stochasticLinearRegression', 'Array'), 'groupBitmapXorArray': ('groupBitmapXor', 'Array'), 'stddevSampArray': ('stddevSamp', 'Array'), 'kurtSampArray': ('kurtSamp', 'Array'), 'quantileBFloat16Array': ('quantileBFloat16', 'Array'), 'sumCountArray': ('sumCount', 'Array'), 'groupArrayInsertAtArray': ('groupArrayInsertAt', 'Array'), 'groupUniqArrayArray': ('groupUniqArray', 'Array'), 'groupArraySampleArray': ('groupArraySample', 'Array'), 'uniqExactArray': ('uniqExact', 'Array'), 'varSampArray': ('varSamp', 'Array'), 'quantileDeterministicArray': ('quantileDeterministic', 'Array'), 'maxArray': ('max', 'Array'), 'quantileExactHighArray': ('quantileExactHigh', 'Array'), 'maxIntersectionsArray': ('maxIntersections', 'Array'), 'studentTTestArray': ('studentTTest', 'Array'), 'quantilesDeterministicArray': ('quantilesDeterministic', 'Array'), 'boundingRatioArray': ('boundingRatio', 'Array'), 'stochasticLogisticRegressionArray': ('stochasticLogisticRegression', 'Array'), 'argMinArray': ('argMin', 'Array'), 'topKArray': ('topK', 'Array'), 'quantileExactArray': ('quantileExact', 'Array'), 'rankCorrArray': ('rankCorr', 'Array'), 'quantilesGKArray': ('quantilesGK', 'Array'), 'exponentialMovingAverageArray': ('exponentialMovingAverage', 'Array'), 'groupArrayLastArray': ('groupArrayLast', 'Array'), 'categoricalInformationValueArray': ('categoricalInformationValue', 'Array'), 'avgArray': ('avg', 'Array'), 'quantileExactLowArray': ('quantileExactLow', 'Array'), 'first_valueArray': ('first_value', 'Array'), 'anyHeavyArray': ('anyHeavy', 'Array'), 'uniqArray': ('uniq', 'Array'), 'quantilesInterpolatedWeightedArray': ('quantilesInterpolatedWeighted', 'Array'), 'kolmogorovSmirnovTestArray': ('kolmogorovSmirnovTest', 'Array'), 'quantileInterpolatedWeightedArray': ('quantileInterpolatedWeighted', 'Array'), 'countArray': ('count', 'Array'), 'groupBitmapAndArray': ('groupBitmapAnd', 'Array'), 'largestTriangleThreeBucketsArray': ('largestTriangleThreeBuckets', 'Array'), 'mannWhitneyUTestArray': ('mannWhitneyUTest', 'Array'), 'quantilesTimingWeightedArray': ('quantilesTimingWeighted', 'Array'), 'meanZTestArray': ('meanZTest', 'Array'), 'quantilesArray': ('quantiles', 'Array'), 'corrArray': ('corr', 'Array'), 'quantileTimingArray': ('quantileTiming', 'Array'), 'quantileExactWeightedArray': ('quantileExactWeighted', 'Array'), 'uniqHLL12Array': ('uniqHLL12', 'Array'), 'quantileArray': ('quantile', 'Array'), 'sparkBarArray': ('sparkBar', 'Array'), 'last_valueArray': ('last_value', 'Array'), 'covarPopArray': ('covarPop', 'Array'), 'minMapArray': ('minMap', 'Array'), 'stddevPopArray': ('stddevPop', 'Array'), 'quantilesExactArray': ('quantilesExact', 'Array'), 'argMaxArrayIf': ('argMax', 'ArrayIf'), 'covarSampArrayIf': ('covarSamp', 'ArrayIf'), 'entropyArrayIf': ('entropy', 'ArrayIf'), 'cramersVBiasCorrectedArrayIf': ('cramersVBiasCorrected', 'ArrayIf'), 'topKWeightedArrayIf': ('topKWeighted', 'ArrayIf'), 'maxIntersectionsPositionArrayIf': ('maxIntersectionsPosition', 'ArrayIf'), 'minArrayIf': ('min', 'ArrayIf'), 'groupArrayMovingSumArrayIf': ('groupArrayMovingSum', 'ArrayIf'), 'maxMapArrayIf': ('maxMap', 'ArrayIf'), 'anyArrayIf': ('any', 'ArrayIf'), 'deltaSumTimestampArrayIf': ('deltaSumTimestamp', 'ArrayIf'), 'quantilesBFloat16ArrayIf': ('quantilesBFloat16', 'ArrayIf'), 'quantileTimingWeightedArrayIf': ('quantileTimingWeighted', 'ArrayIf'), 'quantilesExactWeightedArrayIf': ('quantilesExactWeighted', 'ArrayIf'), 'groupBitXorArrayIf': ('groupBitXor', 'ArrayIf'), 'quantilesBFloat16WeightedArrayIf': ('quantilesBFloat16Weighted', 'ArrayIf'), 'uniqThetaArrayIf': ('uniqTheta', 'ArrayIf'), 'groupArrayMovingAvgArrayIf': ('groupArrayMovingAvg', 'ArrayIf'), 'kurtPopArrayIf': ('kurtPop', 'ArrayIf'), 'uniqCombinedArrayIf': ('uniqCombined', 'ArrayIf'), 'quantileTDigestWeightedArrayIf': ('quantileTDigestWeighted', 'ArrayIf'), 'uniqCombined64ArrayIf': ('uniqCombined64', 'ArrayIf'), 'welchTTestArrayIf': ('welchTTest', 'ArrayIf'), 'sumWithOverflowArrayIf': ('sumWithOverflow', 'ArrayIf'), 'cramersVArrayIf': ('cramersV', 'ArrayIf'), 'quantilesTDigestArrayIf': ('quantilesTDigest', 'ArrayIf'), 'varPopArrayIf': ('varPop', 'ArrayIf'), 'contingencyArrayIf': ('contingency', 'ArrayIf'), 'groupBitOrArrayIf': ('groupBitOr', 'ArrayIf'), 'groupArrayArrayIf': ('groupArray', 'ArrayIf'), 'groupBitmapOrArrayIf': ('groupBitmapOr', 'ArrayIf'), 'quantileBFloat16WeightedArrayIf': ('quantileBFloat16Weighted', 'ArrayIf'), 'quantileGKArrayIf': ('quantileGK', 'ArrayIf'), 'theilsUArrayIf': ('theilsU', 'ArrayIf'), 'anyLastArrayIf': ('anyLast', 'ArrayIf'), 'quantilesTimingArrayIf': ('quantilesTiming', 'ArrayIf'), 'skewPopArrayIf': ('skewPop', 'ArrayIf'), 'sumArrayIf': ('sum', 'ArrayIf'), 'sumMapArrayIf': ('sumMap', 'ArrayIf'), 'medianArrayIf': ('median', 'ArrayIf'), 'groupBitAndArrayIf': ('groupBitAnd', 'ArrayIf'), 'quantilesExactHighArrayIf': ('quantilesExactHigh', 'ArrayIf'), 'intervalLengthSumArrayIf': ('intervalLengthSum', 'ArrayIf'), 'avgWeightedArrayIf': ('avgWeighted', 'ArrayIf'), 'simpleLinearRegressionArrayIf': ('simpleLinearRegression', 'ArrayIf'), 'deltaSumArrayIf': ('deltaSum', 'ArrayIf'), 'quantilesTDigestWeightedArrayIf': ('quantilesTDigestWeighted', 'ArrayIf'), 'sumKahanArrayIf': ('sumKahan', 'ArrayIf'), 'quantileTDigestArrayIf': ('quantileTDigest', 'ArrayIf'), 'quantilesExactLowArrayIf': ('quantilesExactLow', 'ArrayIf'), 'skewSampArrayIf': ('skewSamp', 'ArrayIf'), 'groupBitmapArrayIf': ('groupBitmap', 'ArrayIf'), 'stochasticLinearRegressionArrayIf': ('stochasticLinearRegression', 'ArrayIf'), 'groupBitmapXorArrayIf': ('groupBitmapXor', 'ArrayIf'), 'stddevSampArrayIf': ('stddevSamp', 'ArrayIf'), 'kurtSampArrayIf': ('kurtSamp', 'ArrayIf'), 'quantileBFloat16ArrayIf': ('quantileBFloat16', 'ArrayIf'), 'sumCountArrayIf': ('sumCount', 'ArrayIf'), 'groupArrayInsertAtArrayIf': ('groupArrayInsertAt', 'ArrayIf'), 'groupUniqArrayArrayIf': ('groupUniqArray', 'ArrayIf'), 'groupArraySampleArrayIf': ('groupArraySample', 'ArrayIf'), 'uniqExactArrayIf': ('uniqExact', 'ArrayIf'), 'varSampArrayIf': ('varSamp', 'ArrayIf'), 'quantileDeterministicArrayIf': ('quantileDeterministic', 'ArrayIf'), 'maxArrayIf': ('max', 'ArrayIf'), 'quantileExactHighArrayIf': ('quantileExactHigh', 'ArrayIf'), 'maxIntersectionsArrayIf': ('maxIntersections', 'ArrayIf'), 'studentTTestArrayIf': ('studentTTest', 'ArrayIf'), 'quantilesDeterministicArrayIf': ('quantilesDeterministic', 'ArrayIf'), 'boundingRatioArrayIf': ('boundingRatio', 'ArrayIf'), 'stochasticLogisticRegressionArrayIf': ('stochasticLogisticRegression', 'ArrayIf'), 'argMinArrayIf': ('argMin', 'ArrayIf'), 'topKArrayIf': ('topK', 'ArrayIf'), 'quantileExactArrayIf': ('quantileExact', 'ArrayIf'), 'rankCorrArrayIf': ('rankCorr', 'ArrayIf'), 'quantilesGKArrayIf': ('quantilesGK', 'ArrayIf'), 'exponentialMovingAverageArrayIf': ('exponentialMovingAverage', 'ArrayIf'), 'groupArrayLastArrayIf': ('groupArrayLast', 'ArrayIf'), 'categoricalInformationValueArrayIf': ('categoricalInformationValue', 'ArrayIf'), 'avgArrayIf': ('avg', 'ArrayIf'), 'quantileExactLowArrayIf': ('quantileExactLow', 'ArrayIf'), 'first_valueArrayIf': ('first_value', 'ArrayIf'), 'anyHeavyArrayIf': ('anyHeavy', 'ArrayIf'), 'uniqArrayIf': ('uniq', 'ArrayIf'), 'quantilesInterpolatedWeightedArrayIf': ('quantilesInterpolatedWeighted', 'ArrayIf'), 'kolmogorovSmirnovTestArrayIf': ('kolmogorovSmirnovTest', 'ArrayIf'), 'quantileInterpolatedWeightedArrayIf': ('quantileInterpolatedWeighted', 'ArrayIf'), 'countArrayIf': ('count', 'ArrayIf'), 'groupBitmapAndArrayIf': ('groupBitmapAnd', 'ArrayIf'), 'largestTriangleThreeBucketsArrayIf': ('largestTriangleThreeBuckets', 'ArrayIf'), 'mannWhitneyUTestArrayIf': ('mannWhitneyUTest', 'ArrayIf'), 'quantilesTimingWeightedArrayIf': ('quantilesTimingWeighted', 'ArrayIf'), 'meanZTestArrayIf': ('meanZTest', 'ArrayIf'), 'quantilesArrayIf': ('quantiles', 'ArrayIf'), 'corrArrayIf': ('corr', 'ArrayIf'), 'quantileTimingArrayIf': ('quantileTiming', 'ArrayIf'), 'quantileExactWeightedArrayIf': ('quantileExactWeighted', 'ArrayIf'), 'uniqHLL12ArrayIf': ('uniqHLL12', 'ArrayIf'), 'quantileArrayIf': ('quantile', 'ArrayIf'), 'sparkBarArrayIf': ('sparkBar', 'ArrayIf'), 'last_valueArrayIf': ('last_value', 'ArrayIf'), 'covarPopArrayIf': ('covarPop', 'ArrayIf'), 'minMapArrayIf': ('minMap', 'ArrayIf'), 'stddevPopArrayIf': ('stddevPop', 'ArrayIf'), 'quantilesExactArrayIf': ('quantilesExact', 'ArrayIf'), 'argMaxMap': ('argMax', 'Map'), 'covarSampMap': ('covarSamp', 'Map'), 'entropyMap': ('entropy', 'Map'), 'cramersVBiasCorrectedMap': ('cramersVBiasCorrected', 'Map'), 'topKWeightedMap': ('topKWeighted', 'Map'), 'maxIntersectionsPositionMap': ('maxIntersectionsPosition', 'Map'), 'minMap': ('minMap', ''), 'groupArrayMovingSumMap': ('groupArrayMovingSum', 'Map'), 'maxMapMap': ('maxMap', 'Map'), 'anyMap': ('any', 'Map'), 'deltaSumTimestampMap': ('deltaSumTimestamp', 'Map'), 'quantilesBFloat16Map': ('quantilesBFloat16', 'Map'), 'quantileTimingWeightedMap': ('quantileTimingWeighted', 'Map'), 'quantilesExactWeightedMap': ('quantilesExactWeighted', 'Map'), 'groupBitXorMap': ('groupBitXor', 'Map'), 'quantilesBFloat16WeightedMap': ('quantilesBFloat16Weighted', 'Map'), 'uniqThetaMap': ('uniqTheta', 'Map'), 'groupArrayMovingAvgMap': ('groupArrayMovingAvg', 'Map'), 'kurtPopMap': ('kurtPop', 'Map'), 'uniqCombinedMap': ('uniqCombined', 'Map'), 'quantileTDigestWeightedMap': ('quantileTDigestWeighted', 'Map'), 'uniqCombined64Map': ('uniqCombined64', 'Map'), 'welchTTestMap': ('welchTTest', 'Map'), 'sumWithOverflowMap': ('sumWithOverflow', 'Map'), 'cramersVMap': ('cramersV', 'Map'), 'quantilesTDigestMap': ('quantilesTDigest', 'Map'), 'varPopMap': ('varPop', 'Map'), 'contingencyMap': ('contingency', 'Map'), 'groupBitOrMap': ('groupBitOr', 'Map'), 'groupArrayMap': ('groupArray', 'Map'), 'groupBitmapOrMap': ('groupBitmapOr', 'Map'), 'quantileBFloat16WeightedMap': ('quantileBFloat16Weighted', 'Map'), 'quantileGKMap': ('quantileGK', 'Map'), 'theilsUMap': ('theilsU', 'Map'), 'anyLastMap': ('anyLast', 'Map'), 'quantilesTimingMap': ('quantilesTiming', 'Map'), 'skewPopMap': ('skewPop', 'Map'), 'sumMap': ('sumMap', ''), 'sumMapMap': ('sumMap', 'Map'), 'medianMap': ('median', 'Map'), 'groupBitAndMap': ('groupBitAnd', 'Map'), 'quantilesExactHighMap': ('quantilesExactHigh', 'Map'), 'intervalLengthSumMap': ('intervalLengthSum', 'Map'), 'avgWeightedMap': ('avgWeighted', 'Map'), 'simpleLinearRegressionMap': ('simpleLinearRegression', 'Map'), 'deltaSumMap': ('deltaSum', 'Map'), 'quantilesTDigestWeightedMap': ('quantilesTDigestWeighted', 'Map'), 'sumKahanMap': ('sumKahan', 'Map'), 'quantileTDigestMap': ('quantileTDigest', 'Map'), 'quantilesExactLowMap': ('quantilesExactLow', 'Map'), 'skewSampMap': ('skewSamp', 'Map'), 'groupBitmapMap': ('groupBitmap', 'Map'), 'stochasticLinearRegressionMap': ('stochasticLinearRegression', 'Map'), 'groupBitmapXorMap': ('groupBitmapXor', 'Map'), 'stddevSampMap': ('stddevSamp', 'Map'), 'kurtSampMap': ('kurtSamp', 'Map'), 'quantileBFloat16Map': ('quantileBFloat16', 'Map'), 'sumCountMap': ('sumCount', 'Map'), 'groupArrayInsertAtMap': ('groupArrayInsertAt', 'Map'), 'groupUniqArrayMap': ('groupUniqArray', 'Map'), 'groupArraySampleMap': ('groupArraySample', 'Map'), 'uniqExactMap': ('uniqExact', 'Map'), 'varSampMap': ('varSamp', 'Map'), 'quantileDeterministicMap': ('quantileDeterministic', 'Map'), 'maxMap': ('maxMap', ''), 'quantileExactHighMap': ('quantileExactHigh', 'Map'), 'maxIntersectionsMap': ('maxIntersections', 'Map'), 'studentTTestMap': ('studentTTest', 'Map'), 'quantilesDeterministicMap': ('quantilesDeterministic', 'Map'), 'boundingRatioMap': ('boundingRatio', 'Map'), 'stochasticLogisticRegressionMap': ('stochasticLogisticRegression', 'Map'), 'argMinMap': ('argMin', 'Map'), 'topKMap': ('topK', 'Map'), 'quantileExactMap': ('quantileExact', 'Map'), 'rankCorrMap': ('rankCorr', 'Map'), 'quantilesGKMap': ('quantilesGK', 'Map'), 'exponentialMovingAverageMap': ('exponentialMovingAverage', 'Map'), 'groupArrayLastMap': ('groupArrayLast', 'Map'), 'categoricalInformationValueMap': ('categoricalInformationValue', 'Map'), 'avgMap': ('avg', 'Map'), 'quantileExactLowMap': ('quantileExactLow', 'Map'), 'first_valueMap': ('first_value', 'Map'), 'anyHeavyMap': ('anyHeavy', 'Map'), 'uniqMap': ('uniq', 'Map'), 'quantilesInterpolatedWeightedMap': ('quantilesInterpolatedWeighted', 'Map'), 'kolmogorovSmirnovTestMap': ('kolmogorovSmirnovTest', 'Map'), 'quantileInterpolatedWeightedMap': ('quantileInterpolatedWeighted', 'Map'), 'countMap': ('count', 'Map'), 'groupBitmapAndMap': ('groupBitmapAnd', 'Map'), 'largestTriangleThreeBucketsMap': ('largestTriangleThreeBuckets', 'Map'), 'mannWhitneyUTestMap': ('mannWhitneyUTest', 'Map'), 'quantilesTimingWeightedMap': ('quantilesTimingWeighted', 'Map'), 'meanZTestMap': ('meanZTest', 'Map'), 'quantilesMap': ('quantiles', 'Map'), 'corrMap': ('corr', 'Map'), 'quantileTimingMap': ('quantileTiming', 'Map'), 'quantileExactWeightedMap': ('quantileExactWeighted', 'Map'), 'uniqHLL12Map': ('uniqHLL12', 'Map'), 'quantileMap': ('quantile', 'Map'), 'sparkBarMap': ('sparkBar', 'Map'), 'last_valueMap': ('last_value', 'Map'), 'covarPopMap': ('covarPop', 'Map'), 'minMapMap': ('minMap', 'Map'), 'stddevPopMap': ('stddevPop', 'Map'), 'quantilesExactMap': ('quantilesExact', 'Map'), 'argMaxSimpleState': ('argMax', 'SimpleState'), 'covarSampSimpleState': ('covarSamp', 'SimpleState'), 'entropySimpleState': ('entropy', 'SimpleState'), 'cramersVBiasCorrectedSimpleState': ('cramersVBiasCorrected', 'SimpleState'), 'topKWeightedSimpleState': ('topKWeighted', 'SimpleState'), 'maxIntersectionsPositionSimpleState': ('maxIntersectionsPosition', 'SimpleState'), 'minSimpleState': ('min', 'SimpleState'), 'groupArrayMovingSumSimpleState': ('groupArrayMovingSum', 'SimpleState'), 'maxMapSimpleState': ('maxMap', 'SimpleState'), 'anySimpleState': ('any', 'SimpleState'), 'deltaSumTimestampSimpleState': ('deltaSumTimestamp', 'SimpleState'), 'quantilesBFloat16SimpleState': ('quantilesBFloat16', 'SimpleState'), 'quantileTimingWeightedSimpleState': ('quantileTimingWeighted', 'SimpleState'), 'quantilesExactWeightedSimpleState': ('quantilesExactWeighted', 'SimpleState'), 'groupBitXorSimpleState': ('groupBitXor', 'SimpleState'), 'quantilesBFloat16WeightedSimpleState': ('quantilesBFloat16Weighted', 'SimpleState'), 'uniqThetaSimpleState': ('uniqTheta', 'SimpleState'), 'groupArrayMovingAvgSimpleState': ('groupArrayMovingAvg', 'SimpleState'), 'kurtPopSimpleState': ('kurtPop', 'SimpleState'), 'uniqCombinedSimpleState': ('uniqCombined', 'SimpleState'), 'quantileTDigestWeightedSimpleState': ('quantileTDigestWeighted', 'SimpleState'), 'uniqCombined64SimpleState': ('uniqCombined64', 'SimpleState'), 'welchTTestSimpleState': ('welchTTest', 'SimpleState'), 'sumWithOverflowSimpleState': ('sumWithOverflow', 'SimpleState'), 'cramersVSimpleState': ('cramersV', 'SimpleState'), 'quantilesTDigestSimpleState': ('quantilesTDigest', 'SimpleState'), 'varPopSimpleState': ('varPop', 'SimpleState'), 'contingencySimpleState': ('contingency', 'SimpleState'), 'groupBitOrSimpleState': ('groupBitOr', 'SimpleState'), 'groupArraySimpleState': ('groupArray', 'SimpleState'), 'groupBitmapOrSimpleState': ('groupBitmapOr', 'SimpleState'), 'quantileBFloat16WeightedSimpleState': ('quantileBFloat16Weighted', 'SimpleState'), 'quantileGKSimpleState': ('quantileGK', 'SimpleState'), 'theilsUSimpleState': ('theilsU', 'SimpleState'), 'anyLastSimpleState': ('anyLast', 'SimpleState'), 'quantilesTimingSimpleState': ('quantilesTiming', 'SimpleState'), 'skewPopSimpleState': ('skewPop', 'SimpleState'), 'sumSimpleState': ('sum', 'SimpleState'), 'sumMapSimpleState': ('sumMap', 'SimpleState'), 'medianSimpleState': ('median', 'SimpleState'), 'groupBitAndSimpleState': ('groupBitAnd', 'SimpleState'), 'quantilesExactHighSimpleState': ('quantilesExactHigh', 'SimpleState'), 'intervalLengthSumSimpleState': ('intervalLengthSum', 'SimpleState'), 'avgWeightedSimpleState': ('avgWeighted', 'SimpleState'), 'simpleLinearRegressionSimpleState': ('simpleLinearRegression', 'SimpleState'), 'deltaSumSimpleState': ('deltaSum', 'SimpleState'), 'quantilesTDigestWeightedSimpleState': ('quantilesTDigestWeighted', 'SimpleState'), 'sumKahanSimpleState': ('sumKahan', 'SimpleState'), 'quantileTDigestSimpleState': ('quantileTDigest', 'SimpleState'), 'quantilesExactLowSimpleState': ('quantilesExactLow', 'SimpleState'), 'skewSampSimpleState': ('skewSamp', 'SimpleState'), 'groupBitmapSimpleState': ('groupBitmap', 'SimpleState'), 'stochasticLinearRegressionSimpleState': ('stochasticLinearRegression', 'SimpleState'), 'groupBitmapXorSimpleState': ('groupBitmapXor', 'SimpleState'), 'stddevSampSimpleState': ('stddevSamp', 'SimpleState'), 'kurtSampSimpleState': ('kurtSamp', 'SimpleState'), 'quantileBFloat16SimpleState': ('quantileBFloat16', 'SimpleState'), 'sumCountSimpleState': ('sumCount', 'SimpleState'), 'groupArrayInsertAtSimpleState': ('groupArrayInsertAt', 'SimpleState'), 'groupUniqArraySimpleState': ('groupUniqArray', 'SimpleState'), 'groupArraySampleSimpleState': ('groupArraySample', 'SimpleState'), 'uniqExactSimpleState': ('uniqExact', 'SimpleState'), 'varSampSimpleState': ('varSamp', 'SimpleState'), 'quantileDeterministicSimpleState': ('quantileDeterministic', 'SimpleState'), 'maxSimpleState': ('max', 'SimpleState'), 'quantileExactHighSimpleState': ('quantileExactHigh', 'SimpleState'), 'maxIntersectionsSimpleState': ('maxIntersections', 'SimpleState'), 'studentTTestSimpleState': ('studentTTest', 'SimpleState'), 'quantilesDeterministicSimpleState': ('quantilesDeterministic', 'SimpleState'), 'boundingRatioSimpleState': ('boundingRatio', 'SimpleState'), 'stochasticLogisticRegressionSimpleState': ('stochasticLogisticRegression', 'SimpleState'), 'argMinSimpleState': ('argMin', 'SimpleState'), 'topKSimpleState': ('topK', 'SimpleState'), 'quantileExactSimpleState': ('quantileExact', 'SimpleState'), 'rankCorrSimpleState': ('rankCorr', 'SimpleState'), 'quantilesGKSimpleState': ('quantilesGK', 'SimpleState'), 'exponentialMovingAverageSimpleState': ('exponentialMovingAverage', 'SimpleState'), 'groupArrayLastSimpleState': ('groupArrayLast', 'SimpleState'), 'categoricalInformationValueSimpleState': ('categoricalInformationValue', 'SimpleState'), 'avgSimpleState': ('avg', 'SimpleState'), 'quantileExactLowSimpleState': ('quantileExactLow', 'SimpleState'), 'first_valueSimpleState': ('first_value', 'SimpleState'), 'anyHeavySimpleState': ('anyHeavy', 'SimpleState'), 'uniqSimpleState': ('uniq', 'SimpleState'), 'quantilesInterpolatedWeightedSimpleState': ('quantilesInterpolatedWeighted', 'SimpleState'), 'kolmogorovSmirnovTestSimpleState': ('kolmogorovSmirnovTest', 'SimpleState'), 'quantileInterpolatedWeightedSimpleState': ('quantileInterpolatedWeighted', 'SimpleState'), 'countSimpleState': ('count', 'SimpleState'), 'groupBitmapAndSimpleState': ('groupBitmapAnd', 'SimpleState'), 'largestTriangleThreeBucketsSimpleState': ('largestTriangleThreeBuckets', 'SimpleState'), 'mannWhitneyUTestSimpleState': ('mannWhitneyUTest', 'SimpleState'), 'quantilesTimingWeightedSimpleState': ('quantilesTimingWeighted', 'SimpleState'), 'meanZTestSimpleState': ('meanZTest', 'SimpleState'), 'quantilesSimpleState': ('quantiles', 'SimpleState'), 'corrSimpleState': ('corr', 'SimpleState'), 'quantileTimingSimpleState': ('quantileTiming', 'SimpleState'), 'quantileExactWeightedSimpleState': ('quantileExactWeighted', 'SimpleState'), 'uniqHLL12SimpleState': ('uniqHLL12', 'SimpleState'), 'quantileSimpleState': ('quantile', 'SimpleState'), 'sparkBarSimpleState': ('sparkBar', 'SimpleState'), 'last_valueSimpleState': ('last_value', 'SimpleState'), 'covarPopSimpleState': ('covarPop', 'SimpleState'), 'minMapSimpleState': ('minMap', 'SimpleState'), 'stddevPopSimpleState': ('stddevPop', 'SimpleState'), 'quantilesExactSimpleState': ('quantilesExact', 'SimpleState'), 'argMaxState': ('argMax', 'State'), 'covarSampState': ('covarSamp', 'State'), 'entropyState': ('entropy', 'State'), 'cramersVBiasCorrectedState': ('cramersVBiasCorrected', 'State'), 'topKWeightedState': ('topKWeighted', 'State'), 'maxIntersectionsPositionState': ('maxIntersectionsPosition', 'State'), 'minState': ('min', 'State'), 'groupArrayMovingSumState': ('groupArrayMovingSum', 'State'), 'maxMapState': ('maxMap', 'State'), 'anyState': ('any', 'State'), 'deltaSumTimestampState': ('deltaSumTimestamp', 'State'), 'quantilesBFloat16State': ('quantilesBFloat16', 'State'), 'quantileTimingWeightedState': ('quantileTimingWeighted', 'State'), 'quantilesExactWeightedState': ('quantilesExactWeighted', 'State'), 'groupBitXorState': ('groupBitXor', 'State'), 'quantilesBFloat16WeightedState': ('quantilesBFloat16Weighted', 'State'), 'uniqThetaState': ('uniqTheta', 'State'), 'groupArrayMovingAvgState': ('groupArrayMovingAvg', 'State'), 'kurtPopState': ('kurtPop', 'State'), 'uniqCombinedState': ('uniqCombined', 'State'), 'quantileTDigestWeightedState': ('quantileTDigestWeighted', 'State'), 'uniqCombined64State': ('uniqCombined64', 'State'), 'welchTTestState': ('welchTTest', 'State'), 'sumWithOverflowState': ('sumWithOverflow', 'State'), 'cramersVState': ('cramersV', 'State'), 'quantilesTDigestState': ('quantilesTDigest', 'State'), 'varPopState': ('varPop', 'State'), 'contingencyState': ('contingency', 'State'), 'groupBitOrState': ('groupBitOr', 'State'), 'groupArrayState': ('groupArray', 'State'), 'groupBitmapOrState': ('groupBitmapOr', 'State'), 'quantileBFloat16WeightedState': ('quantileBFloat16Weighted', 'State'), 'quantileGKState': ('quantileGK', 'State'), 'theilsUState': ('theilsU', 'State'), 'anyLastState': ('anyLast', 'State'), 'quantilesTimingState': ('quantilesTiming', 'State'), 'skewPopState': ('skewPop', 'State'), 'sumState': ('sum', 'State'), 'sumMapState': ('sumMap', 'State'), 'medianState': ('median', 'State'), 'groupBitAndState': ('groupBitAnd', 'State'), 'quantilesExactHighState': ('quantilesExactHigh', 'State'), 'intervalLengthSumState': ('intervalLengthSum', 'State'), 'avgWeightedState': ('avgWeighted', 'State'), 'simpleLinearRegressionState': ('simpleLinearRegression', 'State'), 'deltaSumState': ('deltaSum', 'State'), 'quantilesTDigestWeightedState': ('quantilesTDigestWeighted', 'State'), 'sumKahanState': ('sumKahan', 'State'), 'quantileTDigestState': ('quantileTDigest', 'State'), 'quantilesExactLowState': ('quantilesExactLow', 'State'), 'skewSampState': ('skewSamp', 'State'), 'groupBitmapState': ('groupBitmap', 'State'), 'stochasticLinearRegressionState': ('stochasticLinearRegression', 'State'), 'groupBitmapXorState': ('groupBitmapXor', 'State'), 'stddevSampState': ('stddevSamp', 'State'), 'kurtSampState': ('kurtSamp', 'State'), 'quantileBFloat16State': ('quantileBFloat16', 'State'), 'sumCountState': ('sumCount', 'State'), 'groupArrayInsertAtState': ('groupArrayInsertAt', 'State'), 'groupUniqArrayState': ('groupUniqArray', 'State'), 'groupArraySampleState': ('groupArraySample', 'State'), 'uniqExactState': ('uniqExact', 'State'), 'varSampState': ('varSamp', 'State'), 'quantileDeterministicState': ('quantileDeterministic', 'State'), 'maxState': ('max', 'State'), 'quantileExactHighState': ('quantileExactHigh', 'State'), 'maxIntersectionsState': ('maxIntersections', 'State'), 'studentTTestState': ('studentTTest', 'State'), 'quantilesDeterministicState': ('quantilesDeterministic', 'State'), 'boundingRatioState': ('boundingRatio', 'State'), 'stochasticLogisticRegressionState': ('stochasticLogisticRegression', 'State'), 'argMinState': ('argMin', 'State'), 'topKState': ('topK', 'State'), 'quantileExactState': ('quantileExact', 'State'), 'rankCorrState': ('rankCorr', 'State'), 'quantilesGKState': ('quantilesGK', 'State'), 'exponentialMovingAverageState': ('exponentialMovingAverage', 'State'), 'groupArrayLastState': ('groupArrayLast', 'State'), 'categoricalInformationValueState': ('categoricalInformationValue', 'State'), 'avgState': ('avg', 'State'), 'quantileExactLowState': ('quantileExactLow', 'State'), 'first_valueState': ('first_value', 'State'), 'anyHeavyState': ('anyHeavy', 'State'), 'uniqState': ('uniq', 'State'), 'quantilesInterpolatedWeightedState': ('quantilesInterpolatedWeighted', 'State'), 'kolmogorovSmirnovTestState': ('kolmogorovSmirnovTest', 'State'), 'quantileInterpolatedWeightedState': ('quantileInterpolatedWeighted', 'State'), 'countState': ('count', 'State'), 'groupBitmapAndState': ('groupBitmapAnd', 'State'), 'largestTriangleThreeBucketsState': ('largestTriangleThreeBuckets', 'State'), 'mannWhitneyUTestState': ('mannWhitneyUTest', 'State'), 'quantilesTimingWeightedState': ('quantilesTimingWeighted', 'State'), 'meanZTestState': ('meanZTest', 'State'), 'quantilesState': ('quantiles', 'State'), 'corrState': ('corr', 'State'), 'quantileTimingState': ('quantileTiming', 'State'), 'quantileExactWeightedState': ('quantileExactWeighted', 'State'), 'uniqHLL12State': ('uniqHLL12', 'State'), 'quantileState': ('quantile', 'State'), 'sparkBarState': ('sparkBar', 'State'), 'last_valueState': ('last_value', 'State'), 'covarPopState': ('covarPop', 'State'), 'minMapState': ('minMap', 'State'), 'stddevPopState': ('stddevPop', 'State'), 'quantilesExactState': ('quantilesExact', 'State'), 'argMaxMerge': ('argMax', 'Merge'), 'covarSampMerge': ('covarSamp', 'Merge'), 'entropyMerge': ('entropy', 'Merge'), 'cramersVBiasCorrectedMerge': ('cramersVBiasCorrected', 'Merge'), 'topKWeightedMerge': ('topKWeighted', 'Merge'), 'maxIntersectionsPositionMerge': ('maxIntersectionsPosition', 'Merge'), 'minMerge': ('min', 'Merge'), 'groupArrayMovingSumMerge': ('groupArrayMovingSum', 'Merge'), 'maxMapMerge': ('maxMap', 'Merge'), 'anyMerge': ('any', 'Merge'), 'deltaSumTimestampMerge': ('deltaSumTimestamp', 'Merge'), 'quantilesBFloat16Merge': ('quantilesBFloat16', 'Merge'), 'quantileTimingWeightedMerge': ('quantileTimingWeighted', 'Merge'), 'quantilesExactWeightedMerge': ('quantilesExactWeighted', 'Merge'), 'groupBitXorMerge': ('groupBitXor', 'Merge'), 'quantilesBFloat16WeightedMerge': ('quantilesBFloat16Weighted', 'Merge'), 'uniqThetaMerge': ('uniqTheta', 'Merge'), 'groupArrayMovingAvgMerge': ('groupArrayMovingAvg', 'Merge'), 'kurtPopMerge': ('kurtPop', 'Merge'), 'uniqCombinedMerge': ('uniqCombined', 'Merge'), 'quantileTDigestWeightedMerge': ('quantileTDigestWeighted', 'Merge'), 'uniqCombined64Merge': ('uniqCombined64', 'Merge'), 'welchTTestMerge': ('welchTTest', 'Merge'), 'sumWithOverflowMerge': ('sumWithOverflow', 'Merge'), 'cramersVMerge': ('cramersV', 'Merge'), 'quantilesTDigestMerge': ('quantilesTDigest', 'Merge'), 'varPopMerge': ('varPop', 'Merge'), 'contingencyMerge': ('contingency', 'Merge'), 'groupBitOrMerge': ('groupBitOr', 'Merge'), 'groupArrayMerge': ('groupArray', 'Merge'), 'groupBitmapOrMerge': ('groupBitmapOr', 'Merge'), 'quantileBFloat16WeightedMerge': ('quantileBFloat16Weighted', 'Merge'), 'quantileGKMerge': ('quantileGK', 'Merge'), 'theilsUMerge': ('theilsU', 'Merge'), 'anyLastMerge': ('anyLast', 'Merge'), 'quantilesTimingMerge': ('quantilesTiming', 'Merge'), 'skewPopMerge': ('skewPop', 'Merge'), 'sumMerge': ('sum', 'Merge'), 'sumMapMerge': ('sumMap', 'Merge'), 'medianMerge': ('median', 'Merge'), 'groupBitAndMerge': ('groupBitAnd', 'Merge'), 'quantilesExactHighMerge': ('quantilesExactHigh', 'Merge'), 'intervalLengthSumMerge': ('intervalLengthSum', 'Merge'), 'avgWeightedMerge': ('avgWeighted', 'Merge'), 'simpleLinearRegressionMerge': ('simpleLinearRegression', 'Merge'), 'deltaSumMerge': ('deltaSum', 'Merge'), 'quantilesTDigestWeightedMerge': ('quantilesTDigestWeighted', 'Merge'), 'sumKahanMerge': ('sumKahan', 'Merge'), 'quantileTDigestMerge': ('quantileTDigest', 'Merge'), 'quantilesExactLowMerge': ('quantilesExactLow', 'Merge'), 'skewSampMerge': ('skewSamp', 'Merge'), 'groupBitmapMerge': ('groupBitmap', 'Merge'), 'stochasticLinearRegressionMerge': ('stochasticLinearRegression', 'Merge'), 'groupBitmapXorMerge': ('groupBitmapXor', 'Merge'), 'stddevSampMerge': ('stddevSamp', 'Merge'), 'kurtSampMerge': ('kurtSamp', 'Merge'), 'quantileBFloat16Merge': ('quantileBFloat16', 'Merge'), 'sumCountMerge': ('sumCount', 'Merge'), 'groupArrayInsertAtMerge': ('groupArrayInsertAt', 'Merge'), 'groupUniqArrayMerge': ('groupUniqArray', 'Merge'), 'groupArraySampleMerge': ('groupArraySample', 'Merge'), 'uniqExactMerge': ('uniqExact', 'Merge'), 'varSampMerge': ('varSamp', 'Merge'), 'quantileDeterministicMerge': ('quantileDeterministic', 'Merge'), 'maxMerge': ('max', 'Merge'), 'quantileExactHighMerge': ('quantileExactHigh', 'Merge'), 'maxIntersectionsMerge': ('maxIntersections', 'Merge'), 'studentTTestMerge': ('studentTTest', 'Merge'), 'quantilesDeterministicMerge': ('quantilesDeterministic', 'Merge'), 'boundingRatioMerge': ('boundingRatio', 'Merge'), 'stochasticLogisticRegressionMerge': ('stochasticLogisticRegression', 'Merge'), 'argMinMerge': ('argMin', 'Merge'), 'topKMerge': ('topK', 'Merge'), 'quantileExactMerge': ('quantileExact', 'Merge'), 'rankCorrMerge': ('rankCorr', 'Merge'), 'quantilesGKMerge': ('quantilesGK', 'Merge'), 'exponentialMovingAverageMerge': ('exponentialMovingAverage', 'Merge'), 'groupArrayLastMerge': ('groupArrayLast', 'Merge'), 'categoricalInformationValueMerge': ('categoricalInformationValue', 'Merge'), 'avgMerge': ('avg', 'Merge'), 'quantileExactLowMerge': ('quantileExactLow', 'Merge'), 'first_valueMerge': ('first_value', 'Merge'), 'anyHeavyMerge': ('anyHeavy', 'Merge'), 'uniqMerge': ('uniq', 'Merge'), 'quantilesInterpolatedWeightedMerge': ('quantilesInterpolatedWeighted', 'Merge'), 'kolmogorovSmirnovTestMerge': ('kolmogorovSmirnovTest', 'Merge'), 'quantileInterpolatedWeightedMerge': ('quantileInterpolatedWeighted', 'Merge'), 'countMerge': ('count', 'Merge'), 'groupBitmapAndMerge': ('groupBitmapAnd', 'Merge'), 'largestTriangleThreeBucketsMerge': ('largestTriangleThreeBuckets', 'Merge'), 'mannWhitneyUTestMerge': ('mannWhitneyUTest', 'Merge'), 'quantilesTimingWeightedMerge': ('quantilesTimingWeighted', 'Merge'), 'meanZTestMerge': ('meanZTest', 'Merge'), 'quantilesMerge': ('quantiles', 'Merge'), 'corrMerge': ('corr', 'Merge'), 'quantileTimingMerge': ('quantileTiming', 'Merge'), 'quantileExactWeightedMerge': ('quantileExactWeighted', 'Merge'), 'uniqHLL12Merge': ('uniqHLL12', 'Merge'), 'quantileMerge': ('quantile', 'Merge'), 'sparkBarMerge': ('sparkBar', 'Merge'), 'last_valueMerge': ('last_value', 'Merge'), 'covarPopMerge': ('covarPop', 'Merge'), 'minMapMerge': ('minMap', 'Merge'), 'stddevPopMerge': ('stddevPop', 'Merge'), 'quantilesExactMerge': ('quantilesExact', 'Merge'), 'argMaxMergeState': ('argMax', 'MergeState'), 'covarSampMergeState': ('covarSamp', 'MergeState'), 'entropyMergeState': ('entropy', 'MergeState'), 'cramersVBiasCorrectedMergeState': ('cramersVBiasCorrected', 'MergeState'), 'topKWeightedMergeState': ('topKWeighted', 'MergeState'), 'maxIntersectionsPositionMergeState': ('maxIntersectionsPosition', 'MergeState'), 'minMergeState': ('min', 'MergeState'), 'groupArrayMovingSumMergeState': ('groupArrayMovingSum', 'MergeState'), 'maxMapMergeState': ('maxMap', 'MergeState'), 'anyMergeState': ('any', 'MergeState'), 'deltaSumTimestampMergeState': ('deltaSumTimestamp', 'MergeState'), 'quantilesBFloat16MergeState': ('quantilesBFloat16', 'MergeState'), 'quantileTimingWeightedMergeState': ('quantileTimingWeighted', 'MergeState'), 'quantilesExactWeightedMergeState': ('quantilesExactWeighted', 'MergeState'), 'groupBitXorMergeState': ('groupBitXor', 'MergeState'), 'quantilesBFloat16WeightedMergeState': ('quantilesBFloat16Weighted', 'MergeState'), 'uniqThetaMergeState': ('uniqTheta', 'MergeState'), 'groupArrayMovingAvgMergeState': ('groupArrayMovingAvg', 'MergeState'), 'kurtPopMergeState': ('kurtPop', 'MergeState'), 'uniqCombinedMergeState': ('uniqCombined', 'MergeState'), 'quantileTDigestWeightedMergeState': ('quantileTDigestWeighted', 'MergeState'), 'uniqCombined64MergeState': ('uniqCombined64', 'MergeState'), 'welchTTestMergeState': ('welchTTest', 'MergeState'), 'sumWithOverflowMergeState': ('sumWithOverflow', 'MergeState'), 'cramersVMergeState': ('cramersV', 'MergeState'), 'quantilesTDigestMergeState': ('quantilesTDigest', 'MergeState'), 'varPopMergeState': ('varPop', 'MergeState'), 'contingencyMergeState': ('contingency', 'MergeState'), 'groupBitOrMergeState': ('groupBitOr', 'MergeState'), 'groupArrayMergeState': ('groupArray', 'MergeState'), 'groupBitmapOrMergeState': ('groupBitmapOr', 'MergeState'), 'quantileBFloat16WeightedMergeState': ('quantileBFloat16Weighted', 'MergeState'), 'quantileGKMergeState': ('quantileGK', 'MergeState'), 'theilsUMergeState': ('theilsU', 'MergeState'), 'anyLastMergeState': ('anyLast', 'MergeState'), 'quantilesTimingMergeState': ('quantilesTiming', 'MergeState'), 'skewPopMergeState': ('skewPop', 'MergeState'), 'sumMergeState': ('sum', 'MergeState'), 'sumMapMergeState': ('sumMap', 'MergeState'), 'medianMergeState': ('median', 'MergeState'), 'groupBitAndMergeState': ('groupBitAnd', 'MergeState'), 'quantilesExactHighMergeState': ('quantilesExactHigh', 'MergeState'), 'intervalLengthSumMergeState': ('intervalLengthSum', 'MergeState'), 'avgWeightedMergeState': ('avgWeighted', 'MergeState'), 'simpleLinearRegressionMergeState': ('simpleLinearRegression', 'MergeState'), 'deltaSumMergeState': ('deltaSum', 'MergeState'), 'quantilesTDigestWeightedMergeState': ('quantilesTDigestWeighted', 'MergeState'), 'sumKahanMergeState': ('sumKahan', 'MergeState'), 'quantileTDigestMergeState': ('quantileTDigest', 'MergeState'), 'quantilesExactLowMergeState': ('quantilesExactLow', 'MergeState'), 'skewSampMergeState': ('skewSamp', 'MergeState'), 'groupBitmapMergeState': ('groupBitmap', 'MergeState'), 'stochasticLinearRegressionMergeState': ('stochasticLinearRegression', 'MergeState'), 'groupBitmapXorMergeState': ('groupBitmapXor', 'MergeState'), 'stddevSampMergeState': ('stddevSamp', 'MergeState'), 'kurtSampMergeState': ('kurtSamp', 'MergeState'), 'quantileBFloat16MergeState': ('quantileBFloat16', 'MergeState'), 'sumCountMergeState': ('sumCount', 'MergeState'), 'groupArrayInsertAtMergeState': ('groupArrayInsertAt', 'MergeState'), 'groupUniqArrayMergeState': ('groupUniqArray', 'MergeState'), 'groupArraySampleMergeState': ('groupArraySample', 'MergeState'), 'uniqExactMergeState': ('uniqExact', 'MergeState'), 'varSampMergeState': ('varSamp', 'MergeState'), 'quantileDeterministicMergeState': ('quantileDeterministic', 'MergeState'), 'maxMergeState': ('max', 'MergeState'), 'quantileExactHighMergeState': ('quantileExactHigh', 'MergeState'), 'maxIntersectionsMergeState': ('maxIntersections', 'MergeState'), 'studentTTestMergeState': ('studentTTest', 'MergeState'), 'quantilesDeterministicMergeState': ('quantilesDeterministic', 'MergeState'), 'boundingRatioMergeState': ('boundingRatio', 'MergeState'), 'stochasticLogisticRegressionMergeState': ('stochasticLogisticRegression', 'MergeState'), 'argMinMergeState': ('argMin', 'MergeState'), 'topKMergeState': ('topK', 'MergeState'), 'quantileExactMergeState': ('quantileExact', 'MergeState'), 'rankCorrMergeState': ('rankCorr', 'MergeState'), 'quantilesGKMergeState': ('quantilesGK', 'MergeState'), 'exponentialMovingAverageMergeState': ('exponentialMovingAverage', 'MergeState'), 'groupArrayLastMergeState': ('groupArrayLast', 'MergeState'), 'categoricalInformationValueMergeState': ('categoricalInformationValue', 'MergeState'), 'avgMergeState': ('avg', 'MergeState'), 'quantileExactLowMergeState': ('quantileExactLow', 'MergeState'), 'first_valueMergeState': ('first_value', 'MergeState'), 'anyHeavyMergeState': ('anyHeavy', 'MergeState'), 'uniqMergeState': ('uniq', 'MergeState'), 'quantilesInterpolatedWeightedMergeState': ('quantilesInterpolatedWeighted', 'MergeState'), 'kolmogorovSmirnovTestMergeState': ('kolmogorovSmirnovTest', 'MergeState'), 'quantileInterpolatedWeightedMergeState': ('quantileInterpolatedWeighted', 'MergeState'), 'countMergeState': ('count', 'MergeState'), 'groupBitmapAndMergeState': ('groupBitmapAnd', 'MergeState'), 'largestTriangleThreeBucketsMergeState': ('largestTriangleThreeBuckets', 'MergeState'), 'mannWhitneyUTestMergeState': ('mannWhitneyUTest', 'MergeState'), 'quantilesTimingWeightedMergeState': ('quantilesTimingWeighted', 'MergeState'), 'meanZTestMergeState': ('meanZTest', 'MergeState'), 'quantilesMergeState': ('quantiles', 'MergeState'), 'corrMergeState': ('corr', 'MergeState'), 'quantileTimingMergeState': ('quantileTiming', 'MergeState'), 'quantileExactWeightedMergeState': ('quantileExactWeighted', 'MergeState'), 'uniqHLL12MergeState': ('uniqHLL12', 'MergeState'), 'quantileMergeState': ('quantile', 'MergeState'), 'sparkBarMergeState': ('sparkBar', 'MergeState'), 'last_valueMergeState': ('last_value', 'MergeState'), 'covarPopMergeState': ('covarPop', 'MergeState'), 'minMapMergeState': ('minMap', 'MergeState'), 'stddevPopMergeState': ('stddevPop', 'MergeState'), 'quantilesExactMergeState': ('quantilesExact', 'MergeState'), 'argMaxForEach': ('argMax', 'ForEach'), 'covarSampForEach': ('covarSamp', 'ForEach'), 'entropyForEach': ('entropy', 'ForEach'), 'cramersVBiasCorrectedForEach': ('cramersVBiasCorrected', 'ForEach'), 'topKWeightedForEach': ('topKWeighted', 'ForEach'), 'maxIntersectionsPositionForEach': ('maxIntersectionsPosition', 'ForEach'), 'minForEach': ('min', 'ForEach'), 'groupArrayMovingSumForEach': ('groupArrayMovingSum', 'ForEach'), 'maxMapForEach': ('maxMap', 'ForEach'), 'anyForEach': ('any', 'ForEach'), 'deltaSumTimestampForEach': ('deltaSumTimestamp', 'ForEach'), 'quantilesBFloat16ForEach': ('quantilesBFloat16', 'ForEach'), 'quantileTimingWeightedForEach': ('quantileTimingWeighted', 'ForEach'), 'quantilesExactWeightedForEach': ('quantilesExactWeighted', 'ForEach'), 'groupBitXorForEach': ('groupBitXor', 'ForEach'), 'quantilesBFloat16WeightedForEach': ('quantilesBFloat16Weighted', 'ForEach'), 'uniqThetaForEach': ('uniqTheta', 'ForEach'), 'groupArrayMovingAvgForEach': ('groupArrayMovingAvg', 'ForEach'), 'kurtPopForEach': ('kurtPop', 'ForEach'), 'uniqCombinedForEach': ('uniqCombined', 'ForEach'), 'quantileTDigestWeightedForEach': ('quantileTDigestWeighted', 'ForEach'), 'uniqCombined64ForEach': ('uniqCombined64', 'ForEach'), 'welchTTestForEach': ('welchTTest', 'ForEach'), 'sumWithOverflowForEach': ('sumWithOverflow', 'ForEach'), 'cramersVForEach': ('cramersV', 'ForEach'), 'quantilesTDigestForEach': ('quantilesTDigest', 'ForEach'), 'varPopForEach': ('varPop', 'ForEach'), 'contingencyForEach': ('contingency', 'ForEach'), 'groupBitOrForEach': ('groupBitOr', 'ForEach'), 'groupArrayForEach': ('groupArray', 'ForEach'), 'groupBitmapOrForEach': ('groupBitmapOr', 'ForEach'), 'quantileBFloat16WeightedForEach': ('quantileBFloat16Weighted', 'ForEach'), 'quantileGKForEach': ('quantileGK', 'ForEach'), 'theilsUForEach': ('theilsU', 'ForEach'), 'anyLastForEach': ('anyLast', 'ForEach'), 'quantilesTimingForEach': ('quantilesTiming', 'ForEach'), 'skewPopForEach': ('skewPop', 'ForEach'), 'sumForEach': ('sum', 'ForEach'), 'sumMapForEach': ('sumMap', 'ForEach'), 'medianForEach': ('median', 'ForEach'), 'groupBitAndForEach': ('groupBitAnd', 'ForEach'), 'quantilesExactHighForEach': ('quantilesExactHigh', 'ForEach'), 'intervalLengthSumForEach': ('intervalLengthSum', 'ForEach'), 'avgWeightedForEach': ('avgWeighted', 'ForEach'), 'simpleLinearRegressionForEach': ('simpleLinearRegression', 'ForEach'), 'deltaSumForEach': ('deltaSum', 'ForEach'), 'quantilesTDigestWeightedForEach': ('quantilesTDigestWeighted', 'ForEach'), 'sumKahanForEach': ('sumKahan', 'ForEach'), 'quantileTDigestForEach': ('quantileTDigest', 'ForEach'), 'quantilesExactLowForEach': ('quantilesExactLow', 'ForEach'), 'skewSampForEach': ('skewSamp', 'ForEach'), 'groupBitmapForEach': ('groupBitmap', 'ForEach'), 'stochasticLinearRegressionForEach': ('stochasticLinearRegression', 'ForEach'), 'groupBitmapXorForEach': ('groupBitmapXor', 'ForEach'), 'stddevSampForEach': ('stddevSamp', 'ForEach'), 'kurtSampForEach': ('kurtSamp', 'ForEach'), 'quantileBFloat16ForEach': ('quantileBFloat16', 'ForEach'), 'sumCountForEach': ('sumCount', 'ForEach'), 'groupArrayInsertAtForEach': ('groupArrayInsertAt', 'ForEach'), 'groupUniqArrayForEach': ('groupUniqArray', 'ForEach'), 'groupArraySampleForEach': ('groupArraySample', 'ForEach'), 'uniqExactForEach': ('uniqExact', 'ForEach'), 'varSampForEach': ('varSamp', 'ForEach'), 'quantileDeterministicForEach': ('quantileDeterministic', 'ForEach'), 'maxForEach': ('max', 'ForEach'), 'quantileExactHighForEach': ('quantileExactHigh', 'ForEach'), 'maxIntersectionsForEach': ('maxIntersections', 'ForEach'), 'studentTTestForEach': ('studentTTest', 'ForEach'), 'quantilesDeterministicForEach': ('quantilesDeterministic', 'ForEach'), 'boundingRatioForEach': ('boundingRatio', 'ForEach'), 'stochasticLogisticRegressionForEach': ('stochasticLogisticRegression', 'ForEach'), 'argMinForEach': ('argMin', 'ForEach'), 'topKForEach': ('topK', 'ForEach'), 'quantileExactForEach': ('quantileExact', 'ForEach'), 'rankCorrForEach': ('rankCorr', 'ForEach'), 'quantilesGKForEach': ('quantilesGK', 'ForEach'), 'exponentialMovingAverageForEach': ('exponentialMovingAverage', 'ForEach'), 'groupArrayLastForEach': ('groupArrayLast', 'ForEach'), 'categoricalInformationValueForEach': ('categoricalInformationValue', 'ForEach'), 'avgForEach': ('avg', 'ForEach'), 'quantileExactLowForEach': ('quantileExactLow', 'ForEach'), 'first_valueForEach': ('first_value', 'ForEach'), 'anyHeavyForEach': ('anyHeavy', 'ForEach'), 'uniqForEach': ('uniq', 'ForEach'), 'quantilesInterpolatedWeightedForEach': ('quantilesInterpolatedWeighted', 'ForEach'), 'kolmogorovSmirnovTestForEach': ('kolmogorovSmirnovTest', 'ForEach'), 'quantileInterpolatedWeightedForEach': ('quantileInterpolatedWeighted', 'ForEach'), 'countForEach': ('count', 'ForEach'), 'groupBitmapAndForEach': ('groupBitmapAnd', 'ForEach'), 'largestTriangleThreeBucketsForEach': ('largestTriangleThreeBuckets', 'ForEach'), 'mannWhitneyUTestForEach': ('mannWhitneyUTest', 'ForEach'), 'quantilesTimingWeightedForEach': ('quantilesTimingWeighted', 'ForEach'), 'meanZTestForEach': ('meanZTest', 'ForEach'), 'quantilesForEach': ('quantiles', 'ForEach'), 'corrForEach': ('corr', 'ForEach'), 'quantileTimingForEach': ('quantileTiming', 'ForEach'), 'quantileExactWeightedForEach': ('quantileExactWeighted', 'ForEach'), 'uniqHLL12ForEach': ('uniqHLL12', 'ForEach'), 'quantileForEach': ('quantile', 'ForEach'), 'sparkBarForEach': ('sparkBar', 'ForEach'), 'last_valueForEach': ('last_value', 'ForEach'), 'covarPopForEach': ('covarPop', 'ForEach'), 'minMapForEach': ('minMap', 'ForEach'), 'stddevPopForEach': ('stddevPop', 'ForEach'), 'quantilesExactForEach': ('quantilesExact', 'ForEach'), 'argMaxDistinct': ('argMax', 'Distinct'), 'covarSampDistinct': ('covarSamp', 'Distinct'), 'entropyDistinct': ('entropy', 'Distinct'), 'cramersVBiasCorrectedDistinct': ('cramersVBiasCorrected', 'Distinct'), 'topKWeightedDistinct': ('topKWeighted', 'Distinct'), 'maxIntersectionsPositionDistinct': ('maxIntersectionsPosition', 'Distinct'), 'minDistinct': ('min', 'Distinct'), 'groupArrayMovingSumDistinct': ('groupArrayMovingSum', 'Distinct'), 'maxMapDistinct': ('maxMap', 'Distinct'), 'anyDistinct': ('any', 'Distinct'), 'deltaSumTimestampDistinct': ('deltaSumTimestamp', 'Distinct'), 'quantilesBFloat16Distinct': ('quantilesBFloat16', 'Distinct'), 'quantileTimingWeightedDistinct': ('quantileTimingWeighted', 'Distinct'), 'quantilesExactWeightedDistinct': ('quantilesExactWeighted', 'Distinct'), 'groupBitXorDistinct': ('groupBitXor', 'Distinct'), 'quantilesBFloat16WeightedDistinct': ('quantilesBFloat16Weighted', 'Distinct'), 'uniqThetaDistinct': ('uniqTheta', 'Distinct'), 'groupArrayMovingAvgDistinct': ('groupArrayMovingAvg', 'Distinct'), 'kurtPopDistinct': ('kurtPop', 'Distinct'), 'uniqCombinedDistinct': ('uniqCombined', 'Distinct'), 'quantileTDigestWeightedDistinct': ('quantileTDigestWeighted', 'Distinct'), 'uniqCombined64Distinct': ('uniqCombined64', 'Distinct'), 'welchTTestDistinct': ('welchTTest', 'Distinct'), 'sumWithOverflowDistinct': ('sumWithOverflow', 'Distinct'), 'cramersVDistinct': ('cramersV', 'Distinct'), 'quantilesTDigestDistinct': ('quantilesTDigest', 'Distinct'), 'varPopDistinct': ('varPop', 'Distinct'), 'contingencyDistinct': ('contingency', 'Distinct'), 'groupBitOrDistinct': ('groupBitOr', 'Distinct'), 'groupArrayDistinct': ('groupArray', 'Distinct'), 'groupBitmapOrDistinct': ('groupBitmapOr', 'Distinct'), 'quantileBFloat16WeightedDistinct': ('quantileBFloat16Weighted', 'Distinct'), 'quantileGKDistinct': ('quantileGK', 'Distinct'), 'theilsUDistinct': ('theilsU', 'Distinct'), 'anyLastDistinct': ('anyLast', 'Distinct'), 'quantilesTimingDistinct': ('quantilesTiming', 'Distinct'), 'skewPopDistinct': ('skewPop', 'Distinct'), 'sumDistinct': ('sum', 'Distinct'), 'sumMapDistinct': ('sumMap', 'Distinct'), 'medianDistinct': ('median', 'Distinct'), 'groupBitAndDistinct': ('groupBitAnd', 'Distinct'), 'quantilesExactHighDistinct': ('quantilesExactHigh', 'Distinct'), 'intervalLengthSumDistinct': ('intervalLengthSum', 'Distinct'), 'avgWeightedDistinct': ('avgWeighted', 'Distinct'), 'simpleLinearRegressionDistinct': ('simpleLinearRegression', 'Distinct'), 'deltaSumDistinct': ('deltaSum', 'Distinct'), 'quantilesTDigestWeightedDistinct': ('quantilesTDigestWeighted', 'Distinct'), 'sumKahanDistinct': ('sumKahan', 'Distinct'), 'quantileTDigestDistinct': ('quantileTDigest', 'Distinct'), 'quantilesExactLowDistinct': ('quantilesExactLow', 'Distinct'), 'skewSampDistinct': ('skewSamp', 'Distinct'), 'groupBitmapDistinct': ('groupBitmap', 'Distinct'), 'stochasticLinearRegressionDistinct': ('stochasticLinearRegression', 'Distinct'), 'groupBitmapXorDistinct': ('groupBitmapXor', 'Distinct'), 'stddevSampDistinct': ('stddevSamp', 'Distinct'), 'kurtSampDistinct': ('kurtSamp', 'Distinct'), 'quantileBFloat16Distinct': ('quantileBFloat16', 'Distinct'), 'sumCountDistinct': ('sumCount', 'Distinct'), 'groupArrayInsertAtDistinct': ('groupArrayInsertAt', 'Distinct'), 'groupUniqArrayDistinct': ('groupUniqArray', 'Distinct'), 'groupArraySampleDistinct': ('groupArraySample', 'Distinct'), 'uniqExactDistinct': ('uniqExact', 'Distinct'), 'varSampDistinct': ('varSamp', 'Distinct'), 'quantileDeterministicDistinct': ('quantileDeterministic', 'Distinct'), 'maxDistinct': ('max', 'Distinct'), 'quantileExactHighDistinct': ('quantileExactHigh', 'Distinct'), 'maxIntersectionsDistinct': ('maxIntersections', 'Distinct'), 'studentTTestDistinct': ('studentTTest', 'Distinct'), 'quantilesDeterministicDistinct': ('quantilesDeterministic', 'Distinct'), 'boundingRatioDistinct': ('boundingRatio', 'Distinct'), 'stochasticLogisticRegressionDistinct': ('stochasticLogisticRegression', 'Distinct'), 'argMinDistinct': ('argMin', 'Distinct'), 'topKDistinct': ('topK', 'Distinct'), 'quantileExactDistinct': ('quantileExact', 'Distinct'), 'rankCorrDistinct': ('rankCorr', 'Distinct'), 'quantilesGKDistinct': ('quantilesGK', 'Distinct'), 'exponentialMovingAverageDistinct': ('exponentialMovingAverage', 'Distinct'), 'groupArrayLastDistinct': ('groupArrayLast', 'Distinct'), 'categoricalInformationValueDistinct': ('categoricalInformationValue', 'Distinct'), 'avgDistinct': ('avg', 'Distinct'), 'quantileExactLowDistinct': ('quantileExactLow', 'Distinct'), 'first_valueDistinct': ('first_value', 'Distinct'), 'anyHeavyDistinct': ('anyHeavy', 'Distinct'), 'uniqDistinct': ('uniq', 'Distinct'), 'quantilesInterpolatedWeightedDistinct': ('quantilesInterpolatedWeighted', 'Distinct'), 'kolmogorovSmirnovTestDistinct': ('kolmogorovSmirnovTest', 'Distinct'), 'quantileInterpolatedWeightedDistinct': ('quantileInterpolatedWeighted', 'Distinct'), 'countDistinct': ('count', 'Distinct'), 'groupBitmapAndDistinct': ('groupBitmapAnd', 'Distinct'), 'largestTriangleThreeBucketsDistinct': ('largestTriangleThreeBuckets', 'Distinct'), 'mannWhitneyUTestDistinct': ('mannWhitneyUTest', 'Distinct'), 'quantilesTimingWeightedDistinct': ('quantilesTimingWeighted', 'Distinct'), 'meanZTestDistinct': ('meanZTest', 'Distinct'), 'quantilesDistinct': ('quantiles', 'Distinct'), 'corrDistinct': ('corr', 'Distinct'), 'quantileTimingDistinct': ('quantileTiming', 'Distinct'), 'quantileExactWeightedDistinct': ('quantileExactWeighted', 'Distinct'), 'uniqHLL12Distinct': ('uniqHLL12', 'Distinct'), 'quantileDistinct': ('quantile', 'Distinct'), 'sparkBarDistinct': ('sparkBar', 'Distinct'), 'last_valueDistinct': ('last_value', 'Distinct'), 'covarPopDistinct': ('covarPop', 'Distinct'), 'minMapDistinct': ('minMap', 'Distinct'), 'stddevPopDistinct': ('stddevPop', 'Distinct'), 'quantilesExactDistinct': ('quantilesExact', 'Distinct'), 'argMaxOrDefault': ('argMax', 'OrDefault'), 'covarSampOrDefault': ('covarSamp', 'OrDefault'), 'entropyOrDefault': ('entropy', 'OrDefault'), 'cramersVBiasCorrectedOrDefault': ('cramersVBiasCorrected', 'OrDefault'), 'topKWeightedOrDefault': ('topKWeighted', 'OrDefault'), 'maxIntersectionsPositionOrDefault': ('maxIntersectionsPosition', 'OrDefault'), 'minOrDefault': ('min', 'OrDefault'), 'groupArrayMovingSumOrDefault': ('groupArrayMovingSum', 'OrDefault'), 'maxMapOrDefault': ('maxMap', 'OrDefault'), 'anyOrDefault': ('any', 'OrDefault'), 'deltaSumTimestampOrDefault': ('deltaSumTimestamp', 'OrDefault'), 'quantilesBFloat16OrDefault': ('quantilesBFloat16', 'OrDefault'), 'quantileTimingWeightedOrDefault': ('quantileTimingWeighted', 'OrDefault'), 'quantilesExactWeightedOrDefault': ('quantilesExactWeighted', 'OrDefault'), 'groupBitXorOrDefault': ('groupBitXor', 'OrDefault'), 'quantilesBFloat16WeightedOrDefault': ('quantilesBFloat16Weighted', 'OrDefault'), 'uniqThetaOrDefault': ('uniqTheta', 'OrDefault'), 'groupArrayMovingAvgOrDefault': ('groupArrayMovingAvg', 'OrDefault'), 'kurtPopOrDefault': ('kurtPop', 'OrDefault'), 'uniqCombinedOrDefault': ('uniqCombined', 'OrDefault'), 'quantileTDigestWeightedOrDefault': ('quantileTDigestWeighted', 'OrDefault'), 'uniqCombined64OrDefault': ('uniqCombined64', 'OrDefault'), 'welchTTestOrDefault': ('welchTTest', 'OrDefault'), 'sumWithOverflowOrDefault': ('sumWithOverflow', 'OrDefault'), 'cramersVOrDefault': ('cramersV', 'OrDefault'), 'quantilesTDigestOrDefault': ('quantilesTDigest', 'OrDefault'), 'varPopOrDefault': ('varPop', 'OrDefault'), 'contingencyOrDefault': ('contingency', 'OrDefault'), 'groupBitOrOrDefault': ('groupBitOr', 'OrDefault'), 'groupArrayOrDefault': ('groupArray', 'OrDefault'), 'groupBitmapOrOrDefault': ('groupBitmapOr', 'OrDefault'), 'quantileBFloat16WeightedOrDefault': ('quantileBFloat16Weighted', 'OrDefault'), 'quantileGKOrDefault': ('quantileGK', 'OrDefault'), 'theilsUOrDefault': ('theilsU', 'OrDefault'), 'anyLastOrDefault': ('anyLast', 'OrDefault'), 'quantilesTimingOrDefault': ('quantilesTiming', 'OrDefault'), 'skewPopOrDefault': ('skewPop', 'OrDefault'), 'sumOrDefault': ('sum', 'OrDefault'), 'sumMapOrDefault': ('sumMap', 'OrDefault'), 'medianOrDefault': ('median', 'OrDefault'), 'groupBitAndOrDefault': ('groupBitAnd', 'OrDefault'), 'quantilesExactHighOrDefault': ('quantilesExactHigh', 'OrDefault'), 'intervalLengthSumOrDefault': ('intervalLengthSum', 'OrDefault'), 'avgWeightedOrDefault': ('avgWeighted', 'OrDefault'), 'simpleLinearRegressionOrDefault': ('simpleLinearRegression', 'OrDefault'), 'deltaSumOrDefault': ('deltaSum', 'OrDefault'), 'quantilesTDigestWeightedOrDefault': ('quantilesTDigestWeighted', 'OrDefault'), 'sumKahanOrDefault': ('sumKahan', 'OrDefault'), 'quantileTDigestOrDefault': ('quantileTDigest', 'OrDefault'), 'quantilesExactLowOrDefault': ('quantilesExactLow', 'OrDefault'), 'skewSampOrDefault': ('skewSamp', 'OrDefault'), 'groupBitmapOrDefault': ('groupBitmap', 'OrDefault'), 'stochasticLinearRegressionOrDefault': ('stochasticLinearRegression', 'OrDefault'), 'groupBitmapXorOrDefault': ('groupBitmapXor', 'OrDefault'), 'stddevSampOrDefault': ('stddevSamp', 'OrDefault'), 'kurtSampOrDefault': ('kurtSamp', 'OrDefault'), 'quantileBFloat16OrDefault': ('quantileBFloat16', 'OrDefault'), 'sumCountOrDefault': ('sumCount', 'OrDefault'), 'groupArrayInsertAtOrDefault': ('groupArrayInsertAt', 'OrDefault'), 'groupUniqArrayOrDefault': ('groupUniqArray', 'OrDefault'), 'groupArraySampleOrDefault': ('groupArraySample', 'OrDefault'), 'uniqExactOrDefault': ('uniqExact', 'OrDefault'), 'varSampOrDefault': ('varSamp', 'OrDefault'), 'quantileDeterministicOrDefault': ('quantileDeterministic', 'OrDefault'), 'maxOrDefault': ('max', 'OrDefault'), 'quantileExactHighOrDefault': ('quantileExactHigh', 'OrDefault'), 'maxIntersectionsOrDefault': ('maxIntersections', 'OrDefault'), 'studentTTestOrDefault': ('studentTTest', 'OrDefault'), 'quantilesDeterministicOrDefault': ('quantilesDeterministic', 'OrDefault'), 'boundingRatioOrDefault': ('boundingRatio', 'OrDefault'), 'stochasticLogisticRegressionOrDefault': ('stochasticLogisticRegression', 'OrDefault'), 'argMinOrDefault': ('argMin', 'OrDefault'), 'topKOrDefault': ('topK', 'OrDefault'), 'quantileExactOrDefault': ('quantileExact', 'OrDefault'), 'rankCorrOrDefault': ('rankCorr', 'OrDefault'), 'quantilesGKOrDefault': ('quantilesGK', 'OrDefault'), 'exponentialMovingAverageOrDefault': ('exponentialMovingAverage', 'OrDefault'), 'groupArrayLastOrDefault': ('groupArrayLast', 'OrDefault'), 'categoricalInformationValueOrDefault': ('categoricalInformationValue', 'OrDefault'), 'avgOrDefault': ('avg', 'OrDefault'), 'quantileExactLowOrDefault': ('quantileExactLow', 'OrDefault'), 'first_valueOrDefault': ('first_value', 'OrDefault'), 'anyHeavyOrDefault': ('anyHeavy', 'OrDefault'), 'uniqOrDefault': ('uniq', 'OrDefault'), 'quantilesInterpolatedWeightedOrDefault': ('quantilesInterpolatedWeighted', 'OrDefault'), 'kolmogorovSmirnovTestOrDefault': ('kolmogorovSmirnovTest', 'OrDefault'), 'quantileInterpolatedWeightedOrDefault': ('quantileInterpolatedWeighted', 'OrDefault'), 'countOrDefault': ('count', 'OrDefault'), 'groupBitmapAndOrDefault': ('groupBitmapAnd', 'OrDefault'), 'largestTriangleThreeBucketsOrDefault': ('largestTriangleThreeBuckets', 'OrDefault'), 'mannWhitneyUTestOrDefault': ('mannWhitneyUTest', 'OrDefault'), 'quantilesTimingWeightedOrDefault': ('quantilesTimingWeighted', 'OrDefault'), 'meanZTestOrDefault': ('meanZTest', 'OrDefault'), 'quantilesOrDefault': ('quantiles', 'OrDefault'), 'corrOrDefault': ('corr', 'OrDefault'), 'quantileTimingOrDefault': ('quantileTiming', 'OrDefault'), 'quantileExactWeightedOrDefault': ('quantileExactWeighted', 'OrDefault'), 'uniqHLL12OrDefault': ('uniqHLL12', 'OrDefault'), 'quantileOrDefault': ('quantile', 'OrDefault'), 'sparkBarOrDefault': ('sparkBar', 'OrDefault'), 'last_valueOrDefault': ('last_value', 'OrDefault'), 'covarPopOrDefault': ('covarPop', 'OrDefault'), 'minMapOrDefault': ('minMap', 'OrDefault'), 'stddevPopOrDefault': ('stddevPop', 'OrDefault'), 'quantilesExactOrDefault': ('quantilesExact', 'OrDefault'), 'argMaxOrNull': ('argMax', 'OrNull'), 'covarSampOrNull': ('covarSamp', 'OrNull'), 'entropyOrNull': ('entropy', 'OrNull'), 'cramersVBiasCorrectedOrNull': ('cramersVBiasCorrected', 'OrNull'), 'topKWeightedOrNull': ('topKWeighted', 'OrNull'), 'maxIntersectionsPositionOrNull': ('maxIntersectionsPosition', 'OrNull'), 'minOrNull': ('min', 'OrNull'), 'groupArrayMovingSumOrNull': ('groupArrayMovingSum', 'OrNull'), 'maxMapOrNull': ('maxMap', 'OrNull'), 'anyOrNull': ('any', 'OrNull'), 'deltaSumTimestampOrNull': ('deltaSumTimestamp', 'OrNull'), 'quantilesBFloat16OrNull': ('quantilesBFloat16', 'OrNull'), 'quantileTimingWeightedOrNull': ('quantileTimingWeighted', 'OrNull'), 'quantilesExactWeightedOrNull': ('quantilesExactWeighted', 'OrNull'), 'groupBitXorOrNull': ('groupBitXor', 'OrNull'), 'quantilesBFloat16WeightedOrNull': ('quantilesBFloat16Weighted', 'OrNull'), 'uniqThetaOrNull': ('uniqTheta', 'OrNull'), 'groupArrayMovingAvgOrNull': ('groupArrayMovingAvg', 'OrNull'), 'kurtPopOrNull': ('kurtPop', 'OrNull'), 'uniqCombinedOrNull': ('uniqCombined', 'OrNull'), 'quantileTDigestWeightedOrNull': ('quantileTDigestWeighted', 'OrNull'), 'uniqCombined64OrNull': ('uniqCombined64', 'OrNull'), 'welchTTestOrNull': ('welchTTest', 'OrNull'), 'sumWithOverflowOrNull': ('sumWithOverflow', 'OrNull'), 'cramersVOrNull': ('cramersV', 'OrNull'), 'quantilesTDigestOrNull': ('quantilesTDigest', 'OrNull'), 'varPopOrNull': ('varPop', 'OrNull'), 'contingencyOrNull': ('contingency', 'OrNull'), 'groupBitOrOrNull': ('groupBitOr', 'OrNull'), 'groupArrayOrNull': ('groupArray', 'OrNull'), 'groupBitmapOrOrNull': ('groupBitmapOr', 'OrNull'), 'quantileBFloat16WeightedOrNull': ('quantileBFloat16Weighted', 'OrNull'), 'quantileGKOrNull': ('quantileGK', 'OrNull'), 'theilsUOrNull': ('theilsU', 'OrNull'), 'anyLastOrNull': ('anyLast', 'OrNull'), 'quantilesTimingOrNull': ('quantilesTiming', 'OrNull'), 'skewPopOrNull': ('skewPop', 'OrNull'), 'sumOrNull': ('sum', 'OrNull'), 'sumMapOrNull': ('sumMap', 'OrNull'), 'medianOrNull': ('median', 'OrNull'), 'groupBitAndOrNull': ('groupBitAnd', 'OrNull'), 'quantilesExactHighOrNull': ('quantilesExactHigh', 'OrNull'), 'intervalLengthSumOrNull': ('intervalLengthSum', 'OrNull'), 'avgWeightedOrNull': ('avgWeighted', 'OrNull'), 'simpleLinearRegressionOrNull': ('simpleLinearRegression', 'OrNull'), 'deltaSumOrNull': ('deltaSum', 'OrNull'), 'quantilesTDigestWeightedOrNull': ('quantilesTDigestWeighted', 'OrNull'), 'sumKahanOrNull': ('sumKahan', 'OrNull'), 'quantileTDigestOrNull': ('quantileTDigest', 'OrNull'), 'quantilesExactLowOrNull': ('quantilesExactLow', 'OrNull'), 'skewSampOrNull': ('skewSamp', 'OrNull'), 'groupBitmapOrNull': ('groupBitmap', 'OrNull'), 'stochasticLinearRegressionOrNull': ('stochasticLinearRegression', 'OrNull'), 'groupBitmapXorOrNull': ('groupBitmapXor', 'OrNull'), 'stddevSampOrNull': ('stddevSamp', 'OrNull'), 'kurtSampOrNull': ('kurtSamp', 'OrNull'), 'quantileBFloat16OrNull': ('quantileBFloat16', 'OrNull'), 'sumCountOrNull': ('sumCount', 'OrNull'), 'groupArrayInsertAtOrNull': ('groupArrayInsertAt', 'OrNull'), 'groupUniqArrayOrNull': ('groupUniqArray', 'OrNull'), 'groupArraySampleOrNull': ('groupArraySample', 'OrNull'), 'uniqExactOrNull': ('uniqExact', 'OrNull'), 'varSampOrNull': ('varSamp', 'OrNull'), 'quantileDeterministicOrNull': ('quantileDeterministic', 'OrNull'), 'maxOrNull': ('max', 'OrNull'), 'quantileExactHighOrNull': ('quantileExactHigh', 'OrNull'), 'maxIntersectionsOrNull': ('maxIntersections', 'OrNull'), 'studentTTestOrNull': ('studentTTest', 'OrNull'), 'quantilesDeterministicOrNull': ('quantilesDeterministic', 'OrNull'), 'boundingRatioOrNull': ('boundingRatio', 'OrNull'), 'stochasticLogisticRegressionOrNull': ('stochasticLogisticRegression', 'OrNull'), 'argMinOrNull': ('argMin', 'OrNull'), 'topKOrNull': ('topK', 'OrNull'), 'quantileExactOrNull': ('quantileExact', 'OrNull'), 'rankCorrOrNull': ('rankCorr', 'OrNull'), 'quantilesGKOrNull': ('quantilesGK', 'OrNull'), 'exponentialMovingAverageOrNull': ('exponentialMovingAverage', 'OrNull'), 'groupArrayLastOrNull': ('groupArrayLast', 'OrNull'), 'categoricalInformationValueOrNull': ('categoricalInformationValue', 'OrNull'), 'avgOrNull': ('avg', 'OrNull'), 'quantileExactLowOrNull': ('quantileExactLow', 'OrNull'), 'first_valueOrNull': ('first_value', 'OrNull'), 'anyHeavyOrNull': ('anyHeavy', 'OrNull'), 'uniqOrNull': ('uniq', 'OrNull'), 'quantilesInterpolatedWeightedOrNull': ('quantilesInterpolatedWeighted', 'OrNull'), 'kolmogorovSmirnovTestOrNull': ('kolmogorovSmirnovTest', 'OrNull'), 'quantileInterpolatedWeightedOrNull': ('quantileInterpolatedWeighted', 'OrNull'), 'countOrNull': ('count', 'OrNull'), 'groupBitmapAndOrNull': ('groupBitmapAnd', 'OrNull'), 'largestTriangleThreeBucketsOrNull': ('largestTriangleThreeBuckets', 'OrNull'), 'mannWhitneyUTestOrNull': ('mannWhitneyUTest', 'OrNull'), 'quantilesTimingWeightedOrNull': ('quantilesTimingWeighted', 'OrNull'), 'meanZTestOrNull': ('meanZTest', 'OrNull'), 'quantilesOrNull': ('quantiles', 'OrNull'), 'corrOrNull': ('corr', 'OrNull'), 'quantileTimingOrNull': ('quantileTiming', 'OrNull'), 'quantileExactWeightedOrNull': ('quantileExactWeighted', 'OrNull'), 'uniqHLL12OrNull': ('uniqHLL12', 'OrNull'), 'quantileOrNull': ('quantile', 'OrNull'), 'sparkBarOrNull': ('sparkBar', 'OrNull'), 'last_valueOrNull': ('last_value', 'OrNull'), 'covarPopOrNull': ('covarPop', 'OrNull'), 'minMapOrNull': ('minMap', 'OrNull'), 'stddevPopOrNull': ('stddevPop', 'OrNull'), 'quantilesExactOrNull': ('quantilesExact', 'OrNull'), 'argMaxResample': ('argMax', 'Resample'), 'covarSampResample': ('covarSamp', 'Resample'), 'entropyResample': ('entropy', 'Resample'), 'cramersVBiasCorrectedResample': ('cramersVBiasCorrected', 'Resample'), 'topKWeightedResample': ('topKWeighted', 'Resample'), 'maxIntersectionsPositionResample': ('maxIntersectionsPosition', 'Resample'), 'minResample': ('min', 'Resample'), 'groupArrayMovingSumResample': ('groupArrayMovingSum', 'Resample'), 'maxMapResample': ('maxMap', 'Resample'), 'anyResample': ('any', 'Resample'), 'deltaSumTimestampResample': ('deltaSumTimestamp', 'Resample'), 'quantilesBFloat16Resample': ('quantilesBFloat16', 'Resample'), 'quantileTimingWeightedResample': ('quantileTimingWeighted', 'Resample'), 'quantilesExactWeightedResample': ('quantilesExactWeighted', 'Resample'), 'groupBitXorResample': ('groupBitXor', 'Resample'), 'quantilesBFloat16WeightedResample': ('quantilesBFloat16Weighted', 'Resample'), 'uniqThetaResample': ('uniqTheta', 'Resample'), 'groupArrayMovingAvgResample': ('groupArrayMovingAvg', 'Resample'), 'kurtPopResample': ('kurtPop', 'Resample'), 'uniqCombinedResample': ('uniqCombined', 'Resample'), 'quantileTDigestWeightedResample': ('quantileTDigestWeighted', 'Resample'), 'uniqCombined64Resample': ('uniqCombined64', 'Resample'), 'welchTTestResample': ('welchTTest', 'Resample'), 'sumWithOverflowResample': ('sumWithOverflow', 'Resample'), 'cramersVResample': ('cramersV', 'Resample'), 'quantilesTDigestResample': ('quantilesTDigest', 'Resample'), 'varPopResample': ('varPop', 'Resample'), 'contingencyResample': ('contingency', 'Resample'), 'groupBitOrResample': ('groupBitOr', 'Resample'), 'groupArrayResample': ('groupArray', 'Resample'), 'groupBitmapOrResample': ('groupBitmapOr', 'Resample'), 'quantileBFloat16WeightedResample': ('quantileBFloat16Weighted', 'Resample'), 'quantileGKResample': ('quantileGK', 'Resample'), 'theilsUResample': ('theilsU', 'Resample'), 'anyLastResample': ('anyLast', 'Resample'), 'quantilesTimingResample': ('quantilesTiming', 'Resample'), 'skewPopResample': ('skewPop', 'Resample'), 'sumResample': ('sum', 'Resample'), 'sumMapResample': ('sumMap', 'Resample'), 'medianResample': ('median', 'Resample'), 'groupBitAndResample': ('groupBitAnd', 'Resample'), 'quantilesExactHighResample': ('quantilesExactHigh', 'Resample'), 'intervalLengthSumResample': ('intervalLengthSum', 'Resample'), 'avgWeightedResample': ('avgWeighted', 'Resample'), 'simpleLinearRegressionResample': ('simpleLinearRegression', 'Resample'), 'deltaSumResample': ('deltaSum', 'Resample'), 'quantilesTDigestWeightedResample': ('quantilesTDigestWeighted', 'Resample'), 'sumKahanResample': ('sumKahan', 'Resample'), 'quantileTDigestResample': ('quantileTDigest', 'Resample'), 'quantilesExactLowResample': ('quantilesExactLow', 'Resample'), 'skewSampResample': ('skewSamp', 'Resample'), 'groupBitmapResample': ('groupBitmap', 'Resample'), 'stochasticLinearRegressionResample': ('stochasticLinearRegression', 'Resample'), 'groupBitmapXorResample': ('groupBitmapXor', 'Resample'), 'stddevSampResample': ('stddevSamp', 'Resample'), 'kurtSampResample': ('kurtSamp', 'Resample'), 'quantileBFloat16Resample': ('quantileBFloat16', 'Resample'), 'sumCountResample': ('sumCount', 'Resample'), 'groupArrayInsertAtResample': ('groupArrayInsertAt', 'Resample'), 'groupUniqArrayResample': ('groupUniqArray', 'Resample'), 'groupArraySampleResample': ('groupArraySample', 'Resample'), 'uniqExactResample': ('uniqExact', 'Resample'), 'varSampResample': ('varSamp', 'Resample'), 'quantileDeterministicResample': ('quantileDeterministic', 'Resample'), 'maxResample': ('max', 'Resample'), 'quantileExactHighResample': ('quantileExactHigh', 'Resample'), 'maxIntersectionsResample': ('maxIntersections', 'Resample'), 'studentTTestResample': ('studentTTest', 'Resample'), 'quantilesDeterministicResample': ('quantilesDeterministic', 'Resample'), 'boundingRatioResample': ('boundingRatio', 'Resample'), 'stochasticLogisticRegressionResample': ('stochasticLogisticRegression', 'Resample'), 'argMinResample': ('argMin', 'Resample'), 'topKResample': ('topK', 'Resample'), 'quantileExactResample': ('quantileExact', 'Resample'), 'rankCorrResample': ('rankCorr', 'Resample'), 'quantilesGKResample': ('quantilesGK', 'Resample'), 'exponentialMovingAverageResample': ('exponentialMovingAverage', 'Resample'), 'groupArrayLastResample': ('groupArrayLast', 'Resample'), 'categoricalInformationValueResample': ('categoricalInformationValue', 'Resample'), 'avgResample': ('avg', 'Resample'), 'quantileExactLowResample': ('quantileExactLow', 'Resample'), 'first_valueResample': ('first_value', 'Resample'), 'anyHeavyResample': ('anyHeavy', 'Resample'), 'uniqResample': ('uniq', 'Resample'), 'quantilesInterpolatedWeightedResample': ('quantilesInterpolatedWeighted', 'Resample'), 'kolmogorovSmirnovTestResample': ('kolmogorovSmirnovTest', 'Resample'), 'quantileInterpolatedWeightedResample': ('quantileInterpolatedWeighted', 'Resample'), 'countResample': ('count', 'Resample'), 'groupBitmapAndResample': ('groupBitmapAnd', 'Resample'), 'largestTriangleThreeBucketsResample': ('largestTriangleThreeBuckets', 'Resample'), 'mannWhitneyUTestResample': ('mannWhitneyUTest', 'Resample'), 'quantilesTimingWeightedResample': ('quantilesTimingWeighted', 'Resample'), 'meanZTestResample': ('meanZTest', 'Resample'), 'quantilesResample': ('quantiles', 'Resample'), 'corrResample': ('corr', 'Resample'), 'quantileTimingResample': ('quantileTiming', 'Resample'), 'quantileExactWeightedResample': ('quantileExactWeighted', 'Resample'), 'uniqHLL12Resample': ('uniqHLL12', 'Resample'), 'quantileResample': ('quantile', 'Resample'), 'sparkBarResample': ('sparkBar', 'Resample'), 'last_valueResample': ('last_value', 'Resample'), 'covarPopResample': ('covarPop', 'Resample'), 'minMapResample': ('minMap', 'Resample'), 'stddevPopResample': ('stddevPop', 'Resample'), 'quantilesExactResample': ('quantilesExact', 'Resample'), 'argMaxArgMin': ('argMax', 'ArgMin'), 'covarSampArgMin': ('covarSamp', 'ArgMin'), 'entropyArgMin': ('entropy', 'ArgMin'), 'cramersVBiasCorrectedArgMin': ('cramersVBiasCorrected', 'ArgMin'), 'topKWeightedArgMin': ('topKWeighted', 'ArgMin'), 'maxIntersectionsPositionArgMin': ('maxIntersectionsPosition', 'ArgMin'), 'minArgMin': ('min', 'ArgMin'), 'groupArrayMovingSumArgMin': ('groupArrayMovingSum', 'ArgMin'), 'maxMapArgMin': ('maxMap', 'ArgMin'), 'anyArgMin': ('any', 'ArgMin'), 'deltaSumTimestampArgMin': ('deltaSumTimestamp', 'ArgMin'), 'quantilesBFloat16ArgMin': ('quantilesBFloat16', 'ArgMin'), 'quantileTimingWeightedArgMin': ('quantileTimingWeighted', 'ArgMin'), 'quantilesExactWeightedArgMin': ('quantilesExactWeighted', 'ArgMin'), 'groupBitXorArgMin': ('groupBitXor', 'ArgMin'), 'quantilesBFloat16WeightedArgMin': ('quantilesBFloat16Weighted', 'ArgMin'), 'uniqThetaArgMin': ('uniqTheta', 'ArgMin'), 'groupArrayMovingAvgArgMin': ('groupArrayMovingAvg', 'ArgMin'), 'kurtPopArgMin': ('kurtPop', 'ArgMin'), 'uniqCombinedArgMin': ('uniqCombined', 'ArgMin'), 'quantileTDigestWeightedArgMin': ('quantileTDigestWeighted', 'ArgMin'), 'uniqCombined64ArgMin': ('uniqCombined64', 'ArgMin'), 'welchTTestArgMin': ('welchTTest', 'ArgMin'), 'sumWithOverflowArgMin': ('sumWithOverflow', 'ArgMin'), 'cramersVArgMin': ('cramersV', 'ArgMin'), 'quantilesTDigestArgMin': ('quantilesTDigest', 'ArgMin'), 'varPopArgMin': ('varPop', 'ArgMin'), 'contingencyArgMin': ('contingency', 'ArgMin'), 'groupBitOrArgMin': ('groupBitOr', 'ArgMin'), 'groupArrayArgMin': ('groupArray', 'ArgMin'), 'groupBitmapOrArgMin': ('groupBitmapOr', 'ArgMin'), 'quantileBFloat16WeightedArgMin': ('quantileBFloat16Weighted', 'ArgMin'), 'quantileGKArgMin': ('quantileGK', 'ArgMin'), 'theilsUArgMin': ('theilsU', 'ArgMin'), 'anyLastArgMin': ('anyLast', 'ArgMin'), 'quantilesTimingArgMin': ('quantilesTiming', 'ArgMin'), 'skewPopArgMin': ('skewPop', 'ArgMin'), 'sumArgMin': ('sum', 'ArgMin'), 'sumMapArgMin': ('sumMap', 'ArgMin'), 'medianArgMin': ('median', 'ArgMin'), 'groupBitAndArgMin': ('groupBitAnd', 'ArgMin'), 'quantilesExactHighArgMin': ('quantilesExactHigh', 'ArgMin'), 'intervalLengthSumArgMin': ('intervalLengthSum', 'ArgMin'), 'avgWeightedArgMin': ('avgWeighted', 'ArgMin'), 'simpleLinearRegressionArgMin': ('simpleLinearRegression', 'ArgMin'), 'deltaSumArgMin': ('deltaSum', 'ArgMin'), 'quantilesTDigestWeightedArgMin': ('quantilesTDigestWeighted', 'ArgMin'), 'sumKahanArgMin': ('sumKahan', 'ArgMin'), 'quantileTDigestArgMin': ('quantileTDigest', 'ArgMin'), 'quantilesExactLowArgMin': ('quantilesExactLow', 'ArgMin'), 'skewSampArgMin': ('skewSamp', 'ArgMin'), 'groupBitmapArgMin': ('groupBitmap', 'ArgMin'), 'stochasticLinearRegressionArgMin': ('stochasticLinearRegression', 'ArgMin'), 'groupBitmapXorArgMin': ('groupBitmapXor', 'ArgMin'), 'stddevSampArgMin': ('stddevSamp', 'ArgMin'), 'kurtSampArgMin': ('kurtSamp', 'ArgMin'), 'quantileBFloat16ArgMin': ('quantileBFloat16', 'ArgMin'), 'sumCountArgMin': ('sumCount', 'ArgMin'), 'groupArrayInsertAtArgMin': ('groupArrayInsertAt', 'ArgMin'), 'groupUniqArrayArgMin': ('groupUniqArray', 'ArgMin'), 'groupArraySampleArgMin': ('groupArraySample', 'ArgMin'), 'uniqExactArgMin': ('uniqExact', 'ArgMin'), 'varSampArgMin': ('varSamp', 'ArgMin'), 'quantileDeterministicArgMin': ('quantileDeterministic', 'ArgMin'), 'maxArgMin': ('max', 'ArgMin'), 'quantileExactHighArgMin': ('quantileExactHigh', 'ArgMin'), 'maxIntersectionsArgMin': ('maxIntersections', 'ArgMin'), 'studentTTestArgMin': ('studentTTest', 'ArgMin'), 'quantilesDeterministicArgMin': ('quantilesDeterministic', 'ArgMin'), 'boundingRatioArgMin': ('boundingRatio', 'ArgMin'), 'stochasticLogisticRegressionArgMin': ('stochasticLogisticRegression', 'ArgMin'), 'argMinArgMin': ('argMin', 'ArgMin'), 'topKArgMin': ('topK', 'ArgMin'), 'quantileExactArgMin': ('quantileExact', 'ArgMin'), 'rankCorrArgMin': ('rankCorr', 'ArgMin'), 'quantilesGKArgMin': ('quantilesGK', 'ArgMin'), 'exponentialMovingAverageArgMin': ('exponentialMovingAverage', 'ArgMin'), 'groupArrayLastArgMin': ('groupArrayLast', 'ArgMin'), 'categoricalInformationValueArgMin': ('categoricalInformationValue', 'ArgMin'), 'avgArgMin': ('avg', 'ArgMin'), 'quantileExactLowArgMin': ('quantileExactLow', 'ArgMin'), 'first_valueArgMin': ('first_value', 'ArgMin'), 'anyHeavyArgMin': ('anyHeavy', 'ArgMin'), 'uniqArgMin': ('uniq', 'ArgMin'), 'quantilesInterpolatedWeightedArgMin': ('quantilesInterpolatedWeighted', 'ArgMin'), 'kolmogorovSmirnovTestArgMin': ('kolmogorovSmirnovTest', 'ArgMin'), 'quantileInterpolatedWeightedArgMin': ('quantileInterpolatedWeighted', 'ArgMin'), 'countArgMin': ('count', 'ArgMin'), 'groupBitmapAndArgMin': ('groupBitmapAnd', 'ArgMin'), 'largestTriangleThreeBucketsArgMin': ('largestTriangleThreeBuckets', 'ArgMin'), 'mannWhitneyUTestArgMin': ('mannWhitneyUTest', 'ArgMin'), 'quantilesTimingWeightedArgMin': ('quantilesTimingWeighted', 'ArgMin'), 'meanZTestArgMin': ('meanZTest', 'ArgMin'), 'quantilesArgMin': ('quantiles', 'ArgMin'), 'corrArgMin': ('corr', 'ArgMin'), 'quantileTimingArgMin': ('quantileTiming', 'ArgMin'), 'quantileExactWeightedArgMin': ('quantileExactWeighted', 'ArgMin'), 'uniqHLL12ArgMin': ('uniqHLL12', 'ArgMin'), 'quantileArgMin': ('quantile', 'ArgMin'), 'sparkBarArgMin': ('sparkBar', 'ArgMin'), 'last_valueArgMin': ('last_value', 'ArgMin'), 'covarPopArgMin': ('covarPop', 'ArgMin'), 'minMapArgMin': ('minMap', 'ArgMin'), 'stddevPopArgMin': ('stddevPop', 'ArgMin'), 'quantilesExactArgMin': ('quantilesExact', 'ArgMin'), 'argMaxArgMax': ('argMax', 'ArgMax'), 'covarSampArgMax': ('covarSamp', 'ArgMax'), 'entropyArgMax': ('entropy', 'ArgMax'), 'cramersVBiasCorrectedArgMax': ('cramersVBiasCorrected', 'ArgMax'), 'topKWeightedArgMax': ('topKWeighted', 'ArgMax'), 'maxIntersectionsPositionArgMax': ('maxIntersectionsPosition', 'ArgMax'), 'minArgMax': ('min', 'ArgMax'), 'groupArrayMovingSumArgMax': ('groupArrayMovingSum', 'ArgMax'), 'maxMapArgMax': ('maxMap', 'ArgMax'), 'anyArgMax': ('any', 'ArgMax'), 'deltaSumTimestampArgMax': ('deltaSumTimestamp', 'ArgMax'), 'quantilesBFloat16ArgMax': ('quantilesBFloat16', 'ArgMax'), 'quantileTimingWeightedArgMax': ('quantileTimingWeighted', 'ArgMax'), 'quantilesExactWeightedArgMax': ('quantilesExactWeighted', 'ArgMax'), 'groupBitXorArgMax': ('groupBitXor', 'ArgMax'), 'quantilesBFloat16WeightedArgMax': ('quantilesBFloat16Weighted', 'ArgMax'), 'uniqThetaArgMax': ('uniqTheta', 'ArgMax'), 'groupArrayMovingAvgArgMax': ('groupArrayMovingAvg', 'ArgMax'), 'kurtPopArgMax': ('kurtPop', 'ArgMax'), 'uniqCombinedArgMax': ('uniqCombined', 'ArgMax'), 'quantileTDigestWeightedArgMax': ('quantileTDigestWeighted', 'ArgMax'), 'uniqCombined64ArgMax': ('uniqCombined64', 'ArgMax'), 'welchTTestArgMax': ('welchTTest', 'ArgMax'), 'sumWithOverflowArgMax': ('sumWithOverflow', 'ArgMax'), 'cramersVArgMax': ('cramersV', 'ArgMax'), 'quantilesTDigestArgMax': ('quantilesTDigest', 'ArgMax'), 'varPopArgMax': ('varPop', 'ArgMax'), 'contingencyArgMax': ('contingency', 'ArgMax'), 'groupBitOrArgMax': ('groupBitOr', 'ArgMax'), 'groupArrayArgMax': ('groupArray', 'ArgMax'), 'groupBitmapOrArgMax': ('groupBitmapOr', 'ArgMax'), 'quantileBFloat16WeightedArgMax': ('quantileBFloat16Weighted', 'ArgMax'), 'quantileGKArgMax': ('quantileGK', 'ArgMax'), 'theilsUArgMax': ('theilsU', 'ArgMax'), 'anyLastArgMax': ('anyLast', 'ArgMax'), 'quantilesTimingArgMax': ('quantilesTiming', 'ArgMax'), 'skewPopArgMax': ('skewPop', 'ArgMax'), 'sumArgMax': ('sum', 'ArgMax'), 'sumMapArgMax': ('sumMap', 'ArgMax'), 'medianArgMax': ('median', 'ArgMax'), 'groupBitAndArgMax': ('groupBitAnd', 'ArgMax'), 'quantilesExactHighArgMax': ('quantilesExactHigh', 'ArgMax'), 'intervalLengthSumArgMax': ('intervalLengthSum', 'ArgMax'), 'avgWeightedArgMax': ('avgWeighted', 'ArgMax'), 'simpleLinearRegressionArgMax': ('simpleLinearRegression', 'ArgMax'), 'deltaSumArgMax': ('deltaSum', 'ArgMax'), 'quantilesTDigestWeightedArgMax': ('quantilesTDigestWeighted', 'ArgMax'), 'sumKahanArgMax': ('sumKahan', 'ArgMax'), 'quantileTDigestArgMax': ('quantileTDigest', 'ArgMax'), 'quantilesExactLowArgMax': ('quantilesExactLow', 'ArgMax'), 'skewSampArgMax': ('skewSamp', 'ArgMax'), 'groupBitmapArgMax': ('groupBitmap', 'ArgMax'), 'stochasticLinearRegressionArgMax': ('stochasticLinearRegression', 'ArgMax'), 'groupBitmapXorArgMax': ('groupBitmapXor', 'ArgMax'), 'stddevSampArgMax': ('stddevSamp', 'ArgMax'), 'kurtSampArgMax': ('kurtSamp', 'ArgMax'), 'quantileBFloat16ArgMax': ('quantileBFloat16', 'ArgMax'), 'sumCountArgMax': ('sumCount', 'ArgMax'), 'groupArrayInsertAtArgMax': ('groupArrayInsertAt', 'ArgMax'), 'groupUniqArrayArgMax': ('groupUniqArray', 'ArgMax'), 'groupArraySampleArgMax': ('groupArraySample', 'ArgMax'), 'uniqExactArgMax': ('uniqExact', 'ArgMax'), 'varSampArgMax': ('varSamp', 'ArgMax'), 'quantileDeterministicArgMax': ('quantileDeterministic', 'ArgMax'), 'maxArgMax': ('max', 'ArgMax'), 'quantileExactHighArgMax': ('quantileExactHigh', 'ArgMax'), 'maxIntersectionsArgMax': ('maxIntersections', 'ArgMax'), 'studentTTestArgMax': ('studentTTest', 'ArgMax'), 'quantilesDeterministicArgMax': ('quantilesDeterministic', 'ArgMax'), 'boundingRatioArgMax': ('boundingRatio', 'ArgMax'), 'stochasticLogisticRegressionArgMax': ('stochasticLogisticRegression', 'ArgMax'), 'argMinArgMax': ('argMin', 'ArgMax'), 'topKArgMax': ('topK', 'ArgMax'), 'quantileExactArgMax': ('quantileExact', 'ArgMax'), 'rankCorrArgMax': ('rankCorr', 'ArgMax'), 'quantilesGKArgMax': ('quantilesGK', 'ArgMax'), 'exponentialMovingAverageArgMax': ('exponentialMovingAverage', 'ArgMax'), 'groupArrayLastArgMax': ('groupArrayLast', 'ArgMax'), 'categoricalInformationValueArgMax': ('categoricalInformationValue', 'ArgMax'), 'avgArgMax': ('avg', 'ArgMax'), 'quantileExactLowArgMax': ('quantileExactLow', 'ArgMax'), 'first_valueArgMax': ('first_value', 'ArgMax'), 'anyHeavyArgMax': ('anyHeavy', 'ArgMax'), 'uniqArgMax': ('uniq', 'ArgMax'), 'quantilesInterpolatedWeightedArgMax': ('quantilesInterpolatedWeighted', 'ArgMax'), 'kolmogorovSmirnovTestArgMax': ('kolmogorovSmirnovTest', 'ArgMax'), 'quantileInterpolatedWeightedArgMax': ('quantileInterpolatedWeighted', 'ArgMax'), 'countArgMax': ('count', 'ArgMax'), 'groupBitmapAndArgMax': ('groupBitmapAnd', 'ArgMax'), 'largestTriangleThreeBucketsArgMax': ('largestTriangleThreeBuckets', 'ArgMax'), 'mannWhitneyUTestArgMax': ('mannWhitneyUTest', 'ArgMax'), 'quantilesTimingWeightedArgMax': ('quantilesTimingWeighted', 'ArgMax'), 'meanZTestArgMax': ('meanZTest', 'ArgMax'), 'quantilesArgMax': ('quantiles', 'ArgMax'), 'corrArgMax': ('corr', 'ArgMax'), 'quantileTimingArgMax': ('quantileTiming', 'ArgMax'), 'quantileExactWeightedArgMax': ('quantileExactWeighted', 'ArgMax'), 'uniqHLL12ArgMax': ('uniqHLL12', 'ArgMax'), 'quantileArgMax': ('quantile', 'ArgMax'), 'sparkBarArgMax': ('sparkBar', 'ArgMax'), 'last_valueArgMax': ('last_value', 'ArgMax'), 'covarPopArgMax': ('covarPop', 'ArgMax'), 'minMapArgMax': ('minMap', 'ArgMax'), 'stddevPopArgMax': ('stddevPop', 'ArgMax'), 'quantilesExactArgMax': ('quantilesExact', 'ArgMax'), 'argMax': ('argMax', ''), 'covarSamp': ('covarSamp', ''), 'entropy': ('entropy', ''), 'cramersVBiasCorrected': ('cramersVBiasCorrected', ''), 'topKWeighted': ('topKWeighted', ''), 'maxIntersectionsPosition': ('maxIntersectionsPosition', ''), 'min': ('min', ''), 'groupArrayMovingSum': ('groupArrayMovingSum', ''), 'any': ('any', ''), 'deltaSumTimestamp': ('deltaSumTimestamp', ''), 'quantilesBFloat16': ('quantilesBFloat16', ''), 'quantileTimingWeighted': ('quantileTimingWeighted', ''), 'quantilesExactWeighted': ('quantilesExactWeighted', ''), 'groupBitXor': ('groupBitXor', ''), 'quantilesBFloat16Weighted': ('quantilesBFloat16Weighted', ''), 'uniqTheta': ('uniqTheta', ''), 'groupArrayMovingAvg': ('groupArrayMovingAvg', ''), 'kurtPop': ('kurtPop', ''), 'uniqCombined': ('uniqCombined', ''), 'quantileTDigestWeighted': ('quantileTDigestWeighted', ''), 'uniqCombined64': ('uniqCombined64', ''), 'welchTTest': ('welchTTest', ''), 'sumWithOverflow': ('sumWithOverflow', ''), 'cramersV': ('cramersV', ''), 'quantilesTDigest': ('quantilesTDigest', ''), 'varPop': ('varPop', ''), 'contingency': ('contingency', ''), 'groupBitOr': ('groupBitOr', ''), 'groupArray': ('groupArray', ''), 'groupBitmapOr': ('groupBitmapOr', ''), 'quantileBFloat16Weighted': ('quantileBFloat16Weighted', ''), 'quantileGK': ('quantileGK', ''), 'theilsU': ('theilsU', ''), 'anyLast': ('anyLast', ''), 'quantilesTiming': ('quantilesTiming', ''), 'skewPop': ('skewPop', ''), 'sum': ('sum', ''), 'median': ('median', ''), 'groupBitAnd': ('groupBitAnd', ''), 'quantilesExactHigh': ('quantilesExactHigh', ''), 'intervalLengthSum': ('intervalLengthSum', ''), 'avgWeighted': ('avgWeighted', ''), 'simpleLinearRegression': ('simpleLinearRegression', ''), 'deltaSum': ('deltaSum', ''), 'quantilesTDigestWeighted': ('quantilesTDigestWeighted', ''), 'sumKahan': ('sumKahan', ''), 'quantileTDigest': ('quantileTDigest', ''), 'quantilesExactLow': ('quantilesExactLow', ''), 'skewSamp': ('skewSamp', ''), 'groupBitmap': ('groupBitmap', ''), 'stochasticLinearRegression': ('stochasticLinearRegression', ''), 'groupBitmapXor': ('groupBitmapXor', ''), 'stddevSamp': ('stddevSamp', ''), 'kurtSamp': ('kurtSamp', ''), 'quantileBFloat16': ('quantileBFloat16', ''), 'sumCount': ('sumCount', ''), 'groupArrayInsertAt': ('groupArrayInsertAt', ''), 'groupUniqArray': ('groupUniqArray', ''), 'groupArraySample': ('groupArraySample', ''), 'uniqExact': ('uniqExact', ''), 'varSamp': ('varSamp', ''), 'quantileDeterministic': ('quantileDeterministic', ''), 'max': ('max', ''), 'quantileExactHigh': ('quantileExactHigh', ''), 'maxIntersections': ('maxIntersections', ''), 'studentTTest': ('studentTTest', ''), 'quantilesDeterministic': ('quantilesDeterministic', ''), 'boundingRatio': ('boundingRatio', ''), 'stochasticLogisticRegression': ('stochasticLogisticRegression', ''), 'argMin': ('argMin', ''), 'topK': ('topK', ''), 'quantileExact': ('quantileExact', ''), 'rankCorr': ('rankCorr', ''), 'quantilesGK': ('quantilesGK', ''), 'exponentialMovingAverage': ('exponentialMovingAverage', ''), 'groupArrayLast': ('groupArrayLast', ''), 'categoricalInformationValue': ('categoricalInformationValue', ''), 'avg': ('avg', ''), 'quantileExactLow': ('quantileExactLow', ''), 'first_value': ('first_value', ''), 'anyHeavy': ('anyHeavy', ''), 'uniq': ('uniq', ''), 'quantilesInterpolatedWeighted': ('quantilesInterpolatedWeighted', ''), 'kolmogorovSmirnovTest': ('kolmogorovSmirnovTest', ''), 'quantileInterpolatedWeighted': ('quantileInterpolatedWeighted', ''), 'count': ('count', ''), 'groupBitmapAnd': ('groupBitmapAnd', ''), 'largestTriangleThreeBuckets': ('largestTriangleThreeBuckets', ''), 'mannWhitneyUTest': ('mannWhitneyUTest', ''), 'quantilesTimingWeighted': ('quantilesTimingWeighted', ''), 'meanZTest': ('meanZTest', ''), 'quantiles': ('quantiles', ''), 'corr': ('corr', ''), 'quantileTiming': ('quantileTiming', ''), 'quantileExactWeighted': ('quantileExactWeighted', ''), 'uniqHLL12': ('uniqHLL12', ''), 'quantile': ('quantile', ''), 'sparkBar': ('sparkBar', ''), 'last_value': ('last_value', ''), 'covarPop': ('covarPop', ''), 'stddevPop': ('stddevPop', ''), 'quantilesExact': ('quantilesExact', '')}
FUNCTIONS_WITH_ALIASED_ARGS = {'TUPLE', 'STRUCT'}
FUNCTION_PARSERS = {'CAST': <function Parser.<lambda>>, 'CONVERT': <function Parser.<lambda>>, 'DECODE': <function Parser.<lambda>>, 'EXTRACT': <function Parser.<lambda>>, 'JSON_OBJECT': <function Parser.<lambda>>, 'JSON_OBJECTAGG': <function Parser.<lambda>>, 'JSON_TABLE': <function Parser.<lambda>>, 'OPENJSON': <function Parser.<lambda>>, 'POSITION': <function Parser.<lambda>>, 'PREDICT': <function Parser.<lambda>>, 'SAFE_CAST': <function Parser.<lambda>>, 'STRING_AGG': <function Parser.<lambda>>, 'SUBSTRING': <function Parser.<lambda>>, 'TRIM': <function Parser.<lambda>>, 'TRY_CAST': <function Parser.<lambda>>, 'TRY_CONVERT': <function Parser.<lambda>>, 'ARRAYJOIN': <function ClickHouse.Parser.<lambda>>, 'QUANTILE': <function ClickHouse.Parser.<lambda>>}
NO_PAREN_FUNCTION_PARSERS = {'CASE': <function Parser.<lambda>>, 'IF': <function Parser.<lambda>>, 'NEXT': <function Parser.<lambda>>}
RANGE_PARSERS = {<TokenType.BETWEEN: 'BETWEEN'>: <function Parser.<lambda>>, <TokenType.GLOB: 'GLOB'>: <function binary_range_parser.<locals>.<lambda>>, <TokenType.ILIKE: 'ILIKE'>: <function binary_range_parser.<locals>.<lambda>>, <TokenType.IN: 'IN'>: <function Parser.<lambda>>, <TokenType.IRLIKE: 'IRLIKE'>: <function binary_range_parser.<locals>.<lambda>>, <TokenType.IS: 'IS'>: <function Parser.<lambda>>, <TokenType.LIKE: 'LIKE'>: <function binary_range_parser.<locals>.<lambda>>, <TokenType.OVERLAPS: 'OVERLAPS'>: <function binary_range_parser.<locals>.<lambda>>, <TokenType.RLIKE: 'RLIKE'>: <function binary_range_parser.<locals>.<lambda>>, <TokenType.SIMILAR_TO: 'SIMILAR_TO'>: <function binary_range_parser.<locals>.<lambda>>, <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.ARRAY: 'ARRAY'>, <TokenType.SEMI: 'SEMI'>, <TokenType.INNER: 'INNER'>, <TokenType.ANY: 'ANY'>, <TokenType.CROSS: 'CROSS'>, <TokenType.OUTER: 'OUTER'>, <TokenType.ASOF: 'ASOF'>, <TokenType.ANTI: 'ANTI'>}
TABLE_ALIAS_TOKENS = {<TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.JSON: 'JSON'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.MERGE: 'MERGE'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.UINT128: 'UINT128'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.CASE: 'CASE'>, <TokenType.DESC: 'DESC'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.INT256: 'INT256'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.CACHE: 'CACHE'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.XML: 'XML'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.NESTED: 'NESTED'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.INDEX: 'INDEX'>, <TokenType.VAR: 'VAR'>, <TokenType.END: 'END'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.IPV4: 'IPV4'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.TIME: 'TIME'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.NEXT: 'NEXT'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.DELETE: 'DELETE'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.FALSE: 'FALSE'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.ROWS: 'ROWS'>, <TokenType.MONEY: 'MONEY'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.FILTER: 'FILTER'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.USE: 'USE'>, <TokenType.UUID: 'UUID'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.INET: 'INET'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.DATE32: 'DATE32'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.DATE: 'DATE'>, <TokenType.TEXT: 'TEXT'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.SUPER: 'SUPER'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.VIEW: 'VIEW'>, <TokenType.ORDINALITY: 'ORDINALITY'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.MAP: 'MAP'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.IPV6: 'IPV6'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.NAME: 'NAME'>, <TokenType.ENUM: 'ENUM'>, <TokenType.SHOW: 'SHOW'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.FIRST: 'FIRST'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.NULL: 'NULL'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.BIT: 'BIT'>, <TokenType.KILL: 'KILL'>, <TokenType.MODEL: 'MODEL'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.SET: 'SET'>, <TokenType.REFERENCES: 'REFERENCES'>, <TokenType.PROCEDURE: 'PROCEDURE'>, <TokenType.ASC: 'ASC'>, <TokenType.JSONB: 'JSONB'>, <TokenType.UNIQUEIDENTIFIER: 'UNIQUEIDENTIFIER'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.ROW: 'ROW'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.SOME: 'SOME'>, <TokenType.CHAR: 'CHAR'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.TRUE: 'TRUE'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.TOP: 'TOP'>, <TokenType.LOAD: 'LOAD'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.UNIQUE: 'UNIQUE'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.UINT256: 'UINT256'>, <TokenType.STORAGE_INTEGRATION: 'STORAGE_INTEGRATION'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.BINARY: 'BINARY'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.INT: 'INT'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.INT128: 'INT128'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.IS: 'IS'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.KEEP: 'KEEP'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.TABLE: 'TABLE'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.YEAR: 'YEAR'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.RANGE: 'RANGE'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.UINT: 'UINT'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.DIV: 'DIV'>, <TokenType.ALL: 'ALL'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>}
ALIAS_TOKENS = {<TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.JSON: 'JSON'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.MERGE: 'MERGE'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.ASOF: 'ASOF'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.UINT128: 'UINT128'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.CASE: 'CASE'>, <TokenType.DESC: 'DESC'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.INT256: 'INT256'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.CACHE: 'CACHE'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.XML: 'XML'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.FINAL: 'FINAL'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.NESTED: 'NESTED'>, <TokenType.SEMI: 'SEMI'>, <TokenType.INDEX: 'INDEX'>, <TokenType.VAR: 'VAR'>, <TokenType.END: 'END'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.IPV4: 'IPV4'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.TIME: 'TIME'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.NEXT: 'NEXT'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.DELETE: 'DELETE'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.SETTINGS: 'SETTINGS'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.FALSE: 'FALSE'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.ROWS: 'ROWS'>, <TokenType.MONEY: 'MONEY'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.FILTER: 'FILTER'>, <TokenType.LEFT: 'LEFT'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.USE: 'USE'>, <TokenType.UUID: 'UUID'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.INET: 'INET'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.DATE32: 'DATE32'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.DATE: 'DATE'>, <TokenType.TEXT: 'TEXT'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.SUPER: 'SUPER'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.VIEW: 'VIEW'>, <TokenType.ORDINALITY: 'ORDINALITY'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.MAP: 'MAP'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.IPV6: 'IPV6'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.NAME: 'NAME'>, <TokenType.ENUM: 'ENUM'>, <TokenType.SHOW: 'SHOW'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.FIRST: 'FIRST'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.NULL: 'NULL'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.RIGHT: 'RIGHT'>, <TokenType.BIT: 'BIT'>, <TokenType.KILL: 'KILL'>, <TokenType.MODEL: 'MODEL'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.ANTI: 'ANTI'>, <TokenType.SET: 'SET'>, <TokenType.REFERENCES: 'REFERENCES'>, <TokenType.PROCEDURE: 'PROCEDURE'>, <TokenType.ASC: 'ASC'>, <TokenType.JSONB: 'JSONB'>, <TokenType.UNIQUEIDENTIFIER: 'UNIQUEIDENTIFIER'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.ROW: 'ROW'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.NATURAL: 'NATURAL'>, <TokenType.APPLY: 'APPLY'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.SOME: 'SOME'>, <TokenType.CHAR: 'CHAR'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.TRUE: 'TRUE'>, <TokenType.WINDOW: 'WINDOW'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.TOP: 'TOP'>, <TokenType.LOAD: 'LOAD'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.UNIQUE: 'UNIQUE'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.UINT256: 'UINT256'>, <TokenType.STORAGE_INTEGRATION: 'STORAGE_INTEGRATION'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.BINARY: 'BINARY'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.INT: 'INT'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.INT128: 'INT128'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.IS: 'IS'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.KEEP: 'KEEP'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.TABLE: 'TABLE'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.YEAR: 'YEAR'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.RANGE: 'RANGE'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.UINT: 'UINT'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.ANY: 'ANY'>, <TokenType.DIV: 'DIV'>, <TokenType.ALL: 'ALL'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.FULL: 'FULL'>}
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>>, '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>>}
SCHEMA_UNNAMED_CONSTRAINTS = {'FOREIGN KEY', 'EXCLUDE', 'CHECK', 'INDEX', 'LIKE', 'PRIMARY KEY', 'PERIOD', 'UNIQUE'}
SHOW_TRIE: Dict = {}
SET_TRIE: Dict = {'GLOBAL': {0: True}, 'LOCAL': {0: True}, 'SESSION': {0: True}, 'TRANSACTION': {0: True}}
Inherited Members
sqlglot.parser.Parser
Parser
NO_PAREN_FUNCTIONS
STRUCT_TYPE_TOKENS
NESTED_TYPE_TOKENS
ENUM_TYPE_TOKENS
AGGREGATE_TYPE_TOKENS
TYPE_TOKENS
SIGNED_TO_UNSIGNED_TYPE_TOKEN
SUBQUERY_PREDICATES
RESERVED_TOKENS
DB_CREATABLES
CREATABLES
ID_VAR_TOKENS
INTERVAL_VARS
COMMENT_TABLE_ALIAS_TOKENS
UPDATE_ALIAS_TOKENS
TRIM_TYPES
CONJUNCTION
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_PARSERS
INVALID_FUNC_NAME_TOKENS
KEY_VALUE_DEFINITIONS
SET_PARSERS
SHOW_PARSERS
TYPE_LITERAL_PARSERS
DDL_SELECT_TOKENS
PRE_VOLATILE_TOKENS
TRANSACTION_KIND
TRANSACTION_CHARACTERISTICS
CONFLICT_ACTIONS
CREATE_SEQUENCE
ISOLATED_LOADING_OPTIONS
USABLES
CAST_ACTIONS
INSERT_ALTERNATIVES
CLONE_KEYWORDS
HISTORICAL_DATA_KIND
OPCLASS_FOLLOW_KEYWORDS
OPTYPE_FOLLOW_TOKENS
TABLE_INDEX_HINT_TOKENS
VIEW_ATTRIBUTES
WINDOW_ALIAS_TOKENS
WINDOW_BEFORE_PAREN_TOKENS
WINDOW_SIDES
JSON_KEY_VALUE_SEPARATOR_TOKENS
FETCH_TOKENS
ADD_CONSTRAINT_TOKENS
DISTINCT_TOKENS
NULL_TOKENS
UNNEST_OFFSET_ALIAS_TOKENS
SELECT_START_TOKENS
STRICT_CAST
PREFIXED_PIVOT_COLUMNS
IDENTIFY_PIVOT_STRINGS
ALTER_TABLE_ADD_REQUIRED_FOR_EACH_COLUMN
TABLESAMPLE_CSV
SET_REQUIRES_ASSIGNMENT_DELIMITER
TRIM_PATTERN_FIRST
STRING_ALIASES
UNION_MODIFIERS
NO_PAREN_IF_COMMANDS
JSON_ARROWS_REQUIRE_JSON_TYPE
VALUES_FOLLOWED_BY_PAREN
SUPPORTS_IMPLICIT_UNNEST
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):
553    class Generator(generator.Generator):
554        QUERY_HINTS = False
555        STRUCT_DELIMITER = ("(", ")")
556        NVL2_SUPPORTED = False
557        TABLESAMPLE_REQUIRES_PARENS = False
558        TABLESAMPLE_SIZE_IS_ROWS = False
559        TABLESAMPLE_KEYWORDS = "SAMPLE"
560        LAST_DAY_SUPPORTS_DATE_PART = False
561        CAN_IMPLEMENT_ARRAY_ANY = True
562        SUPPORTS_TO_NUMBER = False
563
564        STRING_TYPE_MAPPING = {
565            exp.DataType.Type.CHAR: "String",
566            exp.DataType.Type.LONGBLOB: "String",
567            exp.DataType.Type.LONGTEXT: "String",
568            exp.DataType.Type.MEDIUMBLOB: "String",
569            exp.DataType.Type.MEDIUMTEXT: "String",
570            exp.DataType.Type.TINYBLOB: "String",
571            exp.DataType.Type.TINYTEXT: "String",
572            exp.DataType.Type.TEXT: "String",
573            exp.DataType.Type.VARBINARY: "String",
574            exp.DataType.Type.VARCHAR: "String",
575        }
576
577        SUPPORTED_JSON_PATH_PARTS = {
578            exp.JSONPathKey,
579            exp.JSONPathRoot,
580            exp.JSONPathSubscript,
581        }
582
583        TYPE_MAPPING = {
584            **generator.Generator.TYPE_MAPPING,
585            **STRING_TYPE_MAPPING,
586            exp.DataType.Type.ARRAY: "Array",
587            exp.DataType.Type.BIGINT: "Int64",
588            exp.DataType.Type.DATE32: "Date32",
589            exp.DataType.Type.DATETIME64: "DateTime64",
590            exp.DataType.Type.DOUBLE: "Float64",
591            exp.DataType.Type.ENUM: "Enum",
592            exp.DataType.Type.ENUM8: "Enum8",
593            exp.DataType.Type.ENUM16: "Enum16",
594            exp.DataType.Type.FIXEDSTRING: "FixedString",
595            exp.DataType.Type.FLOAT: "Float32",
596            exp.DataType.Type.INT: "Int32",
597            exp.DataType.Type.MEDIUMINT: "Int32",
598            exp.DataType.Type.INT128: "Int128",
599            exp.DataType.Type.INT256: "Int256",
600            exp.DataType.Type.LOWCARDINALITY: "LowCardinality",
601            exp.DataType.Type.MAP: "Map",
602            exp.DataType.Type.NESTED: "Nested",
603            exp.DataType.Type.NULLABLE: "Nullable",
604            exp.DataType.Type.SMALLINT: "Int16",
605            exp.DataType.Type.STRUCT: "Tuple",
606            exp.DataType.Type.TINYINT: "Int8",
607            exp.DataType.Type.UBIGINT: "UInt64",
608            exp.DataType.Type.UINT: "UInt32",
609            exp.DataType.Type.UINT128: "UInt128",
610            exp.DataType.Type.UINT256: "UInt256",
611            exp.DataType.Type.USMALLINT: "UInt16",
612            exp.DataType.Type.UTINYINT: "UInt8",
613            exp.DataType.Type.IPV4: "IPv4",
614            exp.DataType.Type.IPV6: "IPv6",
615            exp.DataType.Type.AGGREGATEFUNCTION: "AggregateFunction",
616            exp.DataType.Type.SIMPLEAGGREGATEFUNCTION: "SimpleAggregateFunction",
617        }
618
619        TRANSFORMS = {
620            **generator.Generator.TRANSFORMS,
621            exp.AnyValue: rename_func("any"),
622            exp.ApproxDistinct: rename_func("uniq"),
623            exp.ArrayFilter: lambda self, e: self.func("arrayFilter", e.expression, e.this),
624            exp.ArraySize: rename_func("LENGTH"),
625            exp.ArraySum: rename_func("arraySum"),
626            exp.ArgMax: arg_max_or_min_no_count("argMax"),
627            exp.ArgMin: arg_max_or_min_no_count("argMin"),
628            exp.Array: inline_array_sql,
629            exp.CastToStrType: rename_func("CAST"),
630            exp.CountIf: rename_func("countIf"),
631            exp.CompressColumnConstraint: lambda self,
632            e: f"CODEC({self.expressions(e, key='this', flat=True)})",
633            exp.ComputedColumnConstraint: lambda self, e: f"ALIAS {self.sql(e, 'this')}",
634            exp.CurrentDate: lambda self, e: self.func("CURRENT_DATE"),
635            exp.DateAdd: date_delta_sql("DATE_ADD"),
636            exp.DateDiff: date_delta_sql("DATE_DIFF"),
637            exp.Explode: rename_func("arrayJoin"),
638            exp.Final: lambda self, e: f"{self.sql(e, 'this')} FINAL",
639            exp.IsNan: rename_func("isNaN"),
640            exp.JSONExtract: json_extract_segments("JSONExtractString", quoted_index=False),
641            exp.JSONExtractScalar: json_extract_segments("JSONExtractString", quoted_index=False),
642            exp.JSONPathKey: json_path_key_only_name,
643            exp.JSONPathRoot: lambda *_: "",
644            exp.Map: lambda self, e: _lower_func(var_map_sql(self, e)),
645            exp.Nullif: rename_func("nullIf"),
646            exp.PartitionedByProperty: lambda self, e: f"PARTITION BY {self.sql(e, 'this')}",
647            exp.Pivot: no_pivot_sql,
648            exp.Quantile: _quantile_sql,
649            exp.RegexpLike: lambda self, e: self.func("match", e.this, e.expression),
650            exp.Rand: rename_func("randCanonical"),
651            exp.Select: transforms.preprocess([transforms.eliminate_qualify]),
652            exp.StartsWith: rename_func("startsWith"),
653            exp.StrPosition: lambda self, e: self.func(
654                "position", e.this, e.args.get("substr"), e.args.get("position")
655            ),
656            exp.VarMap: lambda self, e: _lower_func(var_map_sql(self, e)),
657            exp.Xor: lambda self, e: self.func("xor", e.this, e.expression, *e.expressions),
658        }
659
660        PROPERTIES_LOCATION = {
661            **generator.Generator.PROPERTIES_LOCATION,
662            exp.VolatileProperty: exp.Properties.Location.UNSUPPORTED,
663            exp.PartitionedByProperty: exp.Properties.Location.POST_SCHEMA,
664            exp.OnCluster: exp.Properties.Location.POST_NAME,
665        }
666
667        JOIN_HINTS = False
668        TABLE_HINTS = False
669        EXPLICIT_UNION = True
670        GROUPINGS_SEP = ""
671
672        # there's no list in docs, but it can be found in Clickhouse code
673        # see `ClickHouse/src/Parsers/ParserCreate*.cpp`
674        ON_CLUSTER_TARGETS = {
675            "DATABASE",
676            "TABLE",
677            "VIEW",
678            "DICTIONARY",
679            "INDEX",
680            "FUNCTION",
681            "NAMED COLLECTION",
682        }
683
684        def _jsonpathsubscript_sql(self, expression: exp.JSONPathSubscript) -> str:
685            this = self.json_path_part(expression.this)
686            return str(int(this) + 1) if is_int(this) else this
687
688        def likeproperty_sql(self, expression: exp.LikeProperty) -> str:
689            return f"AS {self.sql(expression, 'this')}"
690
691        def _any_to_has(
692            self,
693            expression: exp.EQ | exp.NEQ,
694            default: t.Callable[[t.Any], str],
695            prefix: str = "",
696        ) -> str:
697            if isinstance(expression.left, exp.Any):
698                arr = expression.left
699                this = expression.right
700            elif isinstance(expression.right, exp.Any):
701                arr = expression.right
702                this = expression.left
703            else:
704                return default(expression)
705
706            return prefix + self.func("has", arr.this.unnest(), this)
707
708        def eq_sql(self, expression: exp.EQ) -> str:
709            return self._any_to_has(expression, super().eq_sql)
710
711        def neq_sql(self, expression: exp.NEQ) -> str:
712            return self._any_to_has(expression, super().neq_sql, "NOT ")
713
714        def regexpilike_sql(self, expression: exp.RegexpILike) -> str:
715            # Manually add a flag to make the search case-insensitive
716            regex = self.func("CONCAT", "'(?i)'", expression.expression)
717            return self.func("match", expression.this, regex)
718
719        def datatype_sql(self, expression: exp.DataType) -> str:
720            # String is the standard ClickHouse type, every other variant is just an alias.
721            # Additionally, any supplied length parameter will be ignored.
722            #
723            # https://clickhouse.com/docs/en/sql-reference/data-types/string
724            if expression.this in self.STRING_TYPE_MAPPING:
725                return "String"
726
727            return super().datatype_sql(expression)
728
729        def cte_sql(self, expression: exp.CTE) -> str:
730            if expression.args.get("scalar"):
731                this = self.sql(expression, "this")
732                alias = self.sql(expression, "alias")
733                return f"{this} AS {alias}"
734
735            return super().cte_sql(expression)
736
737        def after_limit_modifiers(self, expression: exp.Expression) -> t.List[str]:
738            return super().after_limit_modifiers(expression) + [
739                (
740                    self.seg("SETTINGS ") + self.expressions(expression, key="settings", flat=True)
741                    if expression.args.get("settings")
742                    else ""
743                ),
744                (
745                    self.seg("FORMAT ") + self.sql(expression, "format")
746                    if expression.args.get("format")
747                    else ""
748                ),
749            ]
750
751        def parameterizedagg_sql(self, expression: exp.ParameterizedAgg) -> str:
752            params = self.expressions(expression, key="params", flat=True)
753            return self.func(expression.name, *expression.expressions) + f"({params})"
754
755        def anonymousaggfunc_sql(self, expression: exp.AnonymousAggFunc) -> str:
756            return self.func(expression.name, *expression.expressions)
757
758        def combinedaggfunc_sql(self, expression: exp.CombinedAggFunc) -> str:
759            return self.anonymousaggfunc_sql(expression)
760
761        def combinedparameterizedagg_sql(self, expression: exp.CombinedParameterizedAgg) -> str:
762            return self.parameterizedagg_sql(expression)
763
764        def placeholder_sql(self, expression: exp.Placeholder) -> str:
765            return f"{{{expression.name}: {self.sql(expression, 'kind')}}}"
766
767        def oncluster_sql(self, expression: exp.OnCluster) -> str:
768            return f"ON CLUSTER {self.sql(expression, 'this')}"
769
770        def createable_sql(self, expression: exp.Create, locations: t.DefaultDict) -> str:
771            if expression.kind in self.ON_CLUSTER_TARGETS and locations.get(
772                exp.Properties.Location.POST_NAME
773            ):
774                this_name = self.sql(expression.this, "this")
775                this_properties = " ".join(
776                    [self.sql(prop) for prop in locations[exp.Properties.Location.POST_NAME]]
777                )
778                this_schema = self.schema_columns_sql(expression.this)
779                return f"{this_name}{self.sep()}{this_properties}{self.sep()}{this_schema}"
780
781            return super().createable_sql(expression, locations)
782
783        def prewhere_sql(self, expression: exp.PreWhere) -> str:
784            this = self.indent(self.sql(expression, "this"))
785            return f"{self.seg('PREWHERE')}{self.sep()}{this}"
786
787        def indexcolumnconstraint_sql(self, expression: exp.IndexColumnConstraint) -> str:
788            this = self.sql(expression, "this")
789            this = f" {this}" if this else ""
790            expr = self.sql(expression, "expression")
791            expr = f" {expr}" if expr else ""
792            index_type = self.sql(expression, "index_type")
793            index_type = f" TYPE {index_type}" if index_type else ""
794            granularity = self.sql(expression, "granularity")
795            granularity = f" GRANULARITY {granularity}" if granularity else ""
796
797            return f"INDEX{this}{expr}{index_type}{granularity}"

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
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.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.AutoRefreshProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.BackupProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CaseSpecificColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CharacterSetColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CharacterSetProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ClusteredColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CollateColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CommentColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CopyGrantsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.DateFormatColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.DefaultColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.EncodeColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.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.RemoteWithConnectionModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ReturnsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SampleProperty'>: <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.TemporaryProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TitleColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Timestamp'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ToMap'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ToTableProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TransformModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TransientProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.UppercaseColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.UnloggedProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.VarMap'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.ViewAttributeProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.VolatileProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WithJournalTableProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WithOperator'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.AnyValue'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.ApproxDistinct'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.ArrayFilter'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.ArraySize'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.ArraySum'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.ArgMax'>: <function arg_max_or_min_no_count.<locals>._arg_max_or_min_sql>, <class 'sqlglot.expressions.ArgMin'>: <function arg_max_or_min_no_count.<locals>._arg_max_or_min_sql>, <class 'sqlglot.expressions.Array'>: <function inline_array_sql>, <class 'sqlglot.expressions.CastToStrType'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.CountIf'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.CompressColumnConstraint'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.ComputedColumnConstraint'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.CurrentDate'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.DateAdd'>: <function date_delta_sql.<locals>._delta_sql>, <class 'sqlglot.expressions.DateDiff'>: <function date_delta_sql.<locals>._delta_sql>, <class 'sqlglot.expressions.Explode'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.Final'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.IsNan'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.Map'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.Nullif'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.PartitionedByProperty'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.Pivot'>: <function no_pivot_sql>, <class 'sqlglot.expressions.Quantile'>: <function _quantile_sql>, <class 'sqlglot.expressions.RegexpLike'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.Rand'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.Select'>: <function preprocess.<locals>._to_sql>, <class 'sqlglot.expressions.StartsWith'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.StrPosition'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.Xor'>: <function ClickHouse.Generator.<lambda>>}
PROPERTIES_LOCATION = {<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.DefinerProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.DictRange'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DictProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DistKeyProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DistStyleProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.EngineProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ExecuteAsProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ExternalProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.FallbackProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.FileFormatProperty'>: <Location.POST_WITH: 'POST_WITH'>, <class 'sqlglot.expressions.FreespaceProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.GlobalProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.HeapProperty'>: <Location.POST_WITH: 'POST_WITH'>, <class 'sqlglot.expressions.InheritsProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.IcebergProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.InputModelProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.IsolatedLoadingProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.JournalProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.LanguageProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.LikeProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.LocationProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.LockProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.LockingProperty'>: <Location.POST_ALIAS: 'POST_ALIAS'>, <class 'sqlglot.expressions.LogProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.MaterializedProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.MergeBlockRatioProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.NoPrimaryIndexProperty'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.OnProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.OnCommitProperty'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.Order'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.OutputModelProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.PartitionedByProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.PartitionedOfProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.PrimaryKey'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.Property'>: <Location.POST_WITH: 'POST_WITH'>, <class 'sqlglot.expressions.RemoteWithConnectionModelProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ReturnsProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.RowFormatProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.RowFormatDelimitedProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.RowFormatSerdeProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SampleProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SchemaCommentProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.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.TemporaryProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.ToTableProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.TransientProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.TransformModelProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.MergeTreeTTL'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.UnloggedProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.ViewAttributeProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.VolatileProperty'>: <Location.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.WithDataProperty'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.WithJournalTableProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.WithSystemVersioningProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.OnCluster'>: <Location.POST_NAME: 'POST_NAME'>}
JOIN_HINTS = False
TABLE_HINTS = False
EXPLICIT_UNION = True
GROUPINGS_SEP = ''
ON_CLUSTER_TARGETS = {'DATABASE', 'VIEW', 'NAMED COLLECTION', 'TABLE', 'INDEX', 'FUNCTION', 'DICTIONARY'}
def likeproperty_sql(self, expression: sqlglot.expressions.LikeProperty) -> str:
688        def likeproperty_sql(self, expression: exp.LikeProperty) -> str:
689            return f"AS {self.sql(expression, 'this')}"
def eq_sql(self, expression: sqlglot.expressions.EQ) -> str:
708        def eq_sql(self, expression: exp.EQ) -> str:
709            return self._any_to_has(expression, super().eq_sql)
def neq_sql(self, expression: sqlglot.expressions.NEQ) -> str:
711        def neq_sql(self, expression: exp.NEQ) -> str:
712            return self._any_to_has(expression, super().neq_sql, "NOT ")
def regexpilike_sql(self, expression: sqlglot.expressions.RegexpILike) -> str:
714        def regexpilike_sql(self, expression: exp.RegexpILike) -> str:
715            # Manually add a flag to make the search case-insensitive
716            regex = self.func("CONCAT", "'(?i)'", expression.expression)
717            return self.func("match", expression.this, regex)
def datatype_sql(self, expression: sqlglot.expressions.DataType) -> str:
719        def datatype_sql(self, expression: exp.DataType) -> str:
720            # String is the standard ClickHouse type, every other variant is just an alias.
721            # Additionally, any supplied length parameter will be ignored.
722            #
723            # https://clickhouse.com/docs/en/sql-reference/data-types/string
724            if expression.this in self.STRING_TYPE_MAPPING:
725                return "String"
726
727            return super().datatype_sql(expression)
def cte_sql(self, expression: sqlglot.expressions.CTE) -> str:
729        def cte_sql(self, expression: exp.CTE) -> str:
730            if expression.args.get("scalar"):
731                this = self.sql(expression, "this")
732                alias = self.sql(expression, "alias")
733                return f"{this} AS {alias}"
734
735            return super().cte_sql(expression)
def after_limit_modifiers(self, expression: sqlglot.expressions.Expression) -> List[str]:
737        def after_limit_modifiers(self, expression: exp.Expression) -> t.List[str]:
738            return super().after_limit_modifiers(expression) + [
739                (
740                    self.seg("SETTINGS ") + self.expressions(expression, key="settings", flat=True)
741                    if expression.args.get("settings")
742                    else ""
743                ),
744                (
745                    self.seg("FORMAT ") + self.sql(expression, "format")
746                    if expression.args.get("format")
747                    else ""
748                ),
749            ]
def parameterizedagg_sql(self, expression: sqlglot.expressions.ParameterizedAgg) -> str:
751        def parameterizedagg_sql(self, expression: exp.ParameterizedAgg) -> str:
752            params = self.expressions(expression, key="params", flat=True)
753            return self.func(expression.name, *expression.expressions) + f"({params})"
def anonymousaggfunc_sql(self, expression: sqlglot.expressions.AnonymousAggFunc) -> str:
755        def anonymousaggfunc_sql(self, expression: exp.AnonymousAggFunc) -> str:
756            return self.func(expression.name, *expression.expressions)
def combinedaggfunc_sql(self, expression: sqlglot.expressions.CombinedAggFunc) -> str:
758        def combinedaggfunc_sql(self, expression: exp.CombinedAggFunc) -> str:
759            return self.anonymousaggfunc_sql(expression)
def combinedparameterizedagg_sql(self, expression: sqlglot.expressions.CombinedParameterizedAgg) -> str:
761        def combinedparameterizedagg_sql(self, expression: exp.CombinedParameterizedAgg) -> str:
762            return self.parameterizedagg_sql(expression)
def placeholder_sql(self, expression: sqlglot.expressions.Placeholder) -> str:
764        def placeholder_sql(self, expression: exp.Placeholder) -> str:
765            return f"{{{expression.name}: {self.sql(expression, 'kind')}}}"
def oncluster_sql(self, expression: sqlglot.expressions.OnCluster) -> str:
767        def oncluster_sql(self, expression: exp.OnCluster) -> str:
768            return f"ON CLUSTER {self.sql(expression, 'this')}"
def createable_sql( self, expression: sqlglot.expressions.Create, locations: DefaultDict) -> str:
770        def createable_sql(self, expression: exp.Create, locations: t.DefaultDict) -> str:
771            if expression.kind in self.ON_CLUSTER_TARGETS and locations.get(
772                exp.Properties.Location.POST_NAME
773            ):
774                this_name = self.sql(expression.this, "this")
775                this_properties = " ".join(
776                    [self.sql(prop) for prop in locations[exp.Properties.Location.POST_NAME]]
777                )
778                this_schema = self.schema_columns_sql(expression.this)
779                return f"{this_name}{self.sep()}{this_properties}{self.sep()}{this_schema}"
780
781            return super().createable_sql(expression, locations)
def prewhere_sql(self, expression: sqlglot.expressions.PreWhere) -> str:
783        def prewhere_sql(self, expression: exp.PreWhere) -> str:
784            this = self.indent(self.sql(expression, "this"))
785            return f"{self.seg('PREWHERE')}{self.sep()}{this}"
def indexcolumnconstraint_sql(self, expression: sqlglot.expressions.IndexColumnConstraint) -> str:
787        def indexcolumnconstraint_sql(self, expression: exp.IndexColumnConstraint) -> str:
788            this = self.sql(expression, "this")
789            this = f" {this}" if this else ""
790            expr = self.sql(expression, "expression")
791            expr = f" {expr}" if expr else ""
792            index_type = self.sql(expression, "index_type")
793            index_type = f" TYPE {index_type}" if index_type else ""
794            granularity = self.sql(expression, "granularity")
795            granularity = f" GRANULARITY {granularity}" if granularity else ""
796
797            return f"INDEX{this}{expr}{index_type}{granularity}"
SELECT_KINDS: Tuple[str, ...] = ()
AFTER_HAVING_MODIFIER_TRANSFORMS = {'qualify': <function Generator.<lambda>>, 'windows': <function Generator.<lambda>>}
Inherited Members
sqlglot.generator.Generator
Generator
NULL_ORDERING_SUPPORTED
IGNORE_NULLS_IN_FUNC
LOCKING_READS_SUPPORTED
WRAP_DERIVED_VALUES
CREATE_FUNCTION_RETURN_AS
MATCHED_BY_SOURCE
SINGLE_STRING_INTERVAL
INTERVAL_ALLOWS_PLURAL_FORM
LIMIT_FETCH
LIMIT_ONLY_LITERALS
RENAME_TABLE_WITH_DB
INDEX_ON
QUERY_HINT_SEP
IS_BOOL_ALLOWED
DUPLICATE_KEY_UPDATE_WITH_SET
LIMIT_IS_TOP
RETURNING_END
COLUMN_JOIN_MARKS_SUPPORTED
EXTRACT_ALLOWS_QUOTES
TZ_TO_WITH_TIME_ZONE
VALUES_AS_TABLE
ALTER_TABLE_INCLUDE_COLUMN_KEYWORD
UNNEST_WITH_ORDINALITY
AGGREGATE_FILTER_SUPPORTED
SEMI_ANTI_JOIN_WITH_SIDE
COMPUTED_COLUMN_WITH_TYPE
SUPPORTS_TABLE_COPY
TABLESAMPLE_WITH_METHOD
TABLESAMPLE_SEED_KEYWORD
COLLATE_IS_FUNC
DATA_TYPE_SPECIFIERS_ALLOWED
ENSURE_BOOLS
CTE_RECURSIVE_KEYWORD_REQUIRED
SUPPORTS_SINGLE_ARG_CONCAT
SUPPORTS_TABLE_ALIAS_COLUMNS
UNPIVOT_ALIASES_ARE_IDENTIFIERS
JSON_KEY_VALUE_PAIR_SEP
INSERT_OVERWRITE
SUPPORTS_SELECT_INTO
SUPPORTS_UNLOGGED_TABLES
SUPPORTS_CREATE_TABLE_LIKE
LIKE_PROPERTY_INSIDE_SCHEMA
MULTI_ARG_DISTINCT
JSON_TYPE_REQUIRED_FOR_EXTRACTION
JSON_PATH_BRACKETED_KEY_SUPPORTED
JSON_PATH_SINGLE_QUOTE_ESCAPE
STAR_MAPPING
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_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
inputoutputformat_sql
national_sql
partition_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
matchrecognize_sql
query_modifiers
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_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
renametable_sql
renamecolumn_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
log_sql
use_sql
binary
function_fallback_sql
func
format_args
text_width
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