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

ESCAPE_SEQUENCES = {'\\0': '\x00'}

Mapping of an unescaped escape sequence to the corresponding character.

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 = {}
INVERSE_ESCAPE_SEQUENCES: Dict[str, str] = {'\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'>, '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
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        AGG_FUNC_MAPPING = (
265            lambda functions, suffixes: {
266                f"{f}{sfx}": (f, sfx) for sfx in (suffixes + [""]) for f in functions
267            }
268        )(AGG_FUNCTIONS, AGG_FUNCTIONS_SUFFIXES)
269
270        FUNCTIONS_WITH_ALIASED_ARGS = {*parser.Parser.FUNCTIONS_WITH_ALIASED_ARGS, "TUPLE"}
271
272        FUNCTION_PARSERS = {
273            **parser.Parser.FUNCTION_PARSERS,
274            "ARRAYJOIN": lambda self: self.expression(exp.Explode, this=self._parse_expression()),
275            "QUANTILE": lambda self: self._parse_quantile(),
276        }
277
278        FUNCTION_PARSERS.pop("MATCH")
279
280        NO_PAREN_FUNCTION_PARSERS = parser.Parser.NO_PAREN_FUNCTION_PARSERS.copy()
281        NO_PAREN_FUNCTION_PARSERS.pop("ANY")
282
283        RANGE_PARSERS = {
284            **parser.Parser.RANGE_PARSERS,
285            TokenType.GLOBAL: lambda self, this: self._match(TokenType.IN)
286            and self._parse_in(this, is_global=True),
287        }
288
289        # The PLACEHOLDER entry is popped because 1) it doesn't affect Clickhouse (it corresponds to
290        # the postgres-specific JSONBContains parser) and 2) it makes parsing the ternary op simpler.
291        COLUMN_OPERATORS = parser.Parser.COLUMN_OPERATORS.copy()
292        COLUMN_OPERATORS.pop(TokenType.PLACEHOLDER)
293
294        JOIN_KINDS = {
295            *parser.Parser.JOIN_KINDS,
296            TokenType.ANY,
297            TokenType.ASOF,
298            TokenType.ARRAY,
299        }
300
301        TABLE_ALIAS_TOKENS = parser.Parser.TABLE_ALIAS_TOKENS - {
302            TokenType.ANY,
303            TokenType.ARRAY,
304            TokenType.FINAL,
305            TokenType.FORMAT,
306            TokenType.SETTINGS,
307        }
308
309        ALIAS_TOKENS = parser.Parser.ALIAS_TOKENS - {
310            TokenType.FORMAT,
311        }
312
313        LOG_DEFAULTS_TO_LN = True
314
315        QUERY_MODIFIER_PARSERS = {
316            **parser.Parser.QUERY_MODIFIER_PARSERS,
317            TokenType.SETTINGS: lambda self: (
318                "settings",
319                self._advance() or self._parse_csv(self._parse_conjunction),
320            ),
321            TokenType.FORMAT: lambda self: ("format", self._advance() or self._parse_id_var()),
322        }
323
324        def _parse_conjunction(self) -> t.Optional[exp.Expression]:
325            this = super()._parse_conjunction()
326
327            if self._match(TokenType.PLACEHOLDER):
328                return self.expression(
329                    exp.If,
330                    this=this,
331                    true=self._parse_conjunction(),
332                    false=self._match(TokenType.COLON) and self._parse_conjunction(),
333                )
334
335            return this
336
337        def _parse_placeholder(self) -> t.Optional[exp.Expression]:
338            """
339            Parse a placeholder expression like SELECT {abc: UInt32} or FROM {table: Identifier}
340            https://clickhouse.com/docs/en/sql-reference/syntax#defining-and-using-query-parameters
341            """
342            if not self._match(TokenType.L_BRACE):
343                return None
344
345            this = self._parse_id_var()
346            self._match(TokenType.COLON)
347            kind = self._parse_types(check_func=False, allow_identifiers=False) or (
348                self._match_text_seq("IDENTIFIER") and "Identifier"
349            )
350
351            if not kind:
352                self.raise_error("Expecting a placeholder type or 'Identifier' for tables")
353            elif not self._match(TokenType.R_BRACE):
354                self.raise_error("Expecting }")
355
356            return self.expression(exp.Placeholder, this=this, kind=kind)
357
358        def _parse_in(self, this: t.Optional[exp.Expression], is_global: bool = False) -> exp.In:
359            this = super()._parse_in(this)
360            this.set("is_global", is_global)
361            return this
362
363        def _parse_table(
364            self,
365            schema: bool = False,
366            joins: bool = False,
367            alias_tokens: t.Optional[t.Collection[TokenType]] = None,
368            parse_bracket: bool = False,
369            is_db_reference: bool = False,
370        ) -> t.Optional[exp.Expression]:
371            this = super()._parse_table(
372                schema=schema,
373                joins=joins,
374                alias_tokens=alias_tokens,
375                parse_bracket=parse_bracket,
376                is_db_reference=is_db_reference,
377            )
378
379            if self._match(TokenType.FINAL):
380                this = self.expression(exp.Final, this=this)
381
382            return this
383
384        def _parse_position(self, haystack_first: bool = False) -> exp.StrPosition:
385            return super()._parse_position(haystack_first=True)
386
387        # https://clickhouse.com/docs/en/sql-reference/statements/select/with/
388        def _parse_cte(self) -> exp.CTE:
389            # WITH <identifier> AS <subquery expression>
390            cte: t.Optional[exp.CTE] = self._try_parse(super()._parse_cte)
391
392            if not cte:
393                # WITH <expression> AS <identifier>
394                cte = self.expression(
395                    exp.CTE,
396                    this=self._parse_conjunction(),
397                    alias=self._parse_table_alias(),
398                    scalar=True,
399                )
400
401            return cte
402
403        def _parse_join_parts(
404            self,
405        ) -> t.Tuple[t.Optional[Token], t.Optional[Token], t.Optional[Token]]:
406            is_global = self._match(TokenType.GLOBAL) and self._prev
407            kind_pre = self._match_set(self.JOIN_KINDS, advance=False) and self._prev
408
409            if kind_pre:
410                kind = self._match_set(self.JOIN_KINDS) and self._prev
411                side = self._match_set(self.JOIN_SIDES) and self._prev
412                return is_global, side, kind
413
414            return (
415                is_global,
416                self._match_set(self.JOIN_SIDES) and self._prev,
417                self._match_set(self.JOIN_KINDS) and self._prev,
418            )
419
420        def _parse_join(
421            self, skip_join_token: bool = False, parse_bracket: bool = False
422        ) -> t.Optional[exp.Join]:
423            join = super()._parse_join(skip_join_token=skip_join_token, parse_bracket=True)
424            if join:
425                join.set("global", join.args.pop("method", None))
426
427            return join
428
429        def _parse_function(
430            self,
431            functions: t.Optional[t.Dict[str, t.Callable]] = None,
432            anonymous: bool = False,
433            optional_parens: bool = True,
434        ) -> t.Optional[exp.Expression]:
435            func = super()._parse_function(
436                functions=functions, anonymous=anonymous, optional_parens=optional_parens
437            )
438
439            if isinstance(func, exp.Anonymous):
440                parts = self.AGG_FUNC_MAPPING.get(func.this)
441                params = self._parse_func_params(func)
442
443                if params:
444                    if parts and parts[1]:
445                        return self.expression(
446                            exp.CombinedParameterizedAgg,
447                            this=func.this,
448                            expressions=func.expressions,
449                            params=params,
450                            parts=parts,
451                        )
452                    return self.expression(
453                        exp.ParameterizedAgg,
454                        this=func.this,
455                        expressions=func.expressions,
456                        params=params,
457                    )
458
459                if parts:
460                    if parts[1]:
461                        return self.expression(
462                            exp.CombinedAggFunc,
463                            this=func.this,
464                            expressions=func.expressions,
465                            parts=parts,
466                        )
467                    return self.expression(
468                        exp.AnonymousAggFunc,
469                        this=func.this,
470                        expressions=func.expressions,
471                    )
472
473            return func
474
475        def _parse_func_params(
476            self, this: t.Optional[exp.Func] = None
477        ) -> t.Optional[t.List[exp.Expression]]:
478            if self._match_pair(TokenType.R_PAREN, TokenType.L_PAREN):
479                return self._parse_csv(self._parse_lambda)
480
481            if self._match(TokenType.L_PAREN):
482                params = self._parse_csv(self._parse_lambda)
483                self._match_r_paren(this)
484                return params
485
486            return None
487
488        def _parse_quantile(self) -> exp.Quantile:
489            this = self._parse_lambda()
490            params = self._parse_func_params()
491            if params:
492                return self.expression(exp.Quantile, this=params[0], quantile=this)
493            return self.expression(exp.Quantile, this=this, quantile=exp.Literal.number(0.5))
494
495        def _parse_wrapped_id_vars(self, optional: bool = False) -> t.List[exp.Expression]:
496            return super()._parse_wrapped_id_vars(optional=True)
497
498        def _parse_primary_key(
499            self, wrapped_optional: bool = False, in_props: bool = False
500        ) -> exp.PrimaryKeyColumnConstraint | exp.PrimaryKey:
501            return super()._parse_primary_key(
502                wrapped_optional=wrapped_optional or in_props, in_props=in_props
503            )
504
505        def _parse_on_property(self) -> t.Optional[exp.Expression]:
506            index = self._index
507            if self._match_text_seq("CLUSTER"):
508                this = self._parse_id_var()
509                if this:
510                    return self.expression(exp.OnCluster, this=this)
511                else:
512                    self._retreat(index)
513            return None

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

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.DateAdd'>: <function date_delta_sql.<locals>._delta_sql>, <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.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.CurrentDate'>: <function ClickHouse.Generator.<lambda>>, <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 = {'DICTIONARY', 'VIEW', 'NAMED COLLECTION', 'TABLE', 'DATABASE', 'INDEX', 'FUNCTION'}
def likeproperty_sql(self, expression: sqlglot.expressions.LikeProperty) -> str:
647        def likeproperty_sql(self, expression: exp.LikeProperty) -> str:
648            return f"AS {self.sql(expression, 'this')}"
def eq_sql(self, expression: sqlglot.expressions.EQ) -> str:
667        def eq_sql(self, expression: exp.EQ) -> str:
668            return self._any_to_has(expression, super().eq_sql)
def neq_sql(self, expression: sqlglot.expressions.NEQ) -> str:
670        def neq_sql(self, expression: exp.NEQ) -> str:
671            return self._any_to_has(expression, super().neq_sql, "NOT ")
def regexpilike_sql(self, expression: sqlglot.expressions.RegexpILike) -> str:
673        def regexpilike_sql(self, expression: exp.RegexpILike) -> str:
674            # Manually add a flag to make the search case-insensitive
675            regex = self.func("CONCAT", "'(?i)'", expression.expression)
676            return self.func("match", expression.this, regex)
def datatype_sql(self, expression: sqlglot.expressions.DataType) -> str:
678        def datatype_sql(self, expression: exp.DataType) -> str:
679            # String is the standard ClickHouse type, every other variant is just an alias.
680            # Additionally, any supplied length parameter will be ignored.
681            #
682            # https://clickhouse.com/docs/en/sql-reference/data-types/string
683            if expression.this in self.STRING_TYPE_MAPPING:
684                return "String"
685
686            return super().datatype_sql(expression)
def cte_sql(self, expression: sqlglot.expressions.CTE) -> str:
688        def cte_sql(self, expression: exp.CTE) -> str:
689            if expression.args.get("scalar"):
690                this = self.sql(expression, "this")
691                alias = self.sql(expression, "alias")
692                return f"{this} AS {alias}"
693
694            return super().cte_sql(expression)
def after_limit_modifiers(self, expression: sqlglot.expressions.Expression) -> List[str]:
696        def after_limit_modifiers(self, expression: exp.Expression) -> t.List[str]:
697            return super().after_limit_modifiers(expression) + [
698                (
699                    self.seg("SETTINGS ") + self.expressions(expression, key="settings", flat=True)
700                    if expression.args.get("settings")
701                    else ""
702                ),
703                (
704                    self.seg("FORMAT ") + self.sql(expression, "format")
705                    if expression.args.get("format")
706                    else ""
707                ),
708            ]
def parameterizedagg_sql(self, expression: sqlglot.expressions.ParameterizedAgg) -> str:
710        def parameterizedagg_sql(self, expression: exp.ParameterizedAgg) -> str:
711            params = self.expressions(expression, key="params", flat=True)
712            return self.func(expression.name, *expression.expressions) + f"({params})"
def anonymousaggfunc_sql(self, expression: sqlglot.expressions.AnonymousAggFunc) -> str:
714        def anonymousaggfunc_sql(self, expression: exp.AnonymousAggFunc) -> str:
715            return self.func(expression.name, *expression.expressions)
def combinedaggfunc_sql(self, expression: sqlglot.expressions.CombinedAggFunc) -> str:
717        def combinedaggfunc_sql(self, expression: exp.CombinedAggFunc) -> str:
718            return self.anonymousaggfunc_sql(expression)
def combinedparameterizedagg_sql(self, expression: sqlglot.expressions.CombinedParameterizedAgg) -> str:
720        def combinedparameterizedagg_sql(self, expression: exp.CombinedParameterizedAgg) -> str:
721            return self.parameterizedagg_sql(expression)
def placeholder_sql(self, expression: sqlglot.expressions.Placeholder) -> str:
723        def placeholder_sql(self, expression: exp.Placeholder) -> str:
724            return f"{{{expression.name}: {self.sql(expression, 'kind')}}}"
def oncluster_sql(self, expression: sqlglot.expressions.OnCluster) -> str:
726        def oncluster_sql(self, expression: exp.OnCluster) -> str:
727            return f"ON CLUSTER {self.sql(expression, 'this')}"
def createable_sql( self, expression: sqlglot.expressions.Create, locations: DefaultDict) -> str:
729        def createable_sql(self, expression: exp.Create, locations: t.DefaultDict) -> str:
730            if expression.kind in self.ON_CLUSTER_TARGETS and locations.get(
731                exp.Properties.Location.POST_NAME
732            ):
733                this_name = self.sql(expression.this, "this")
734                this_properties = " ".join(
735                    [self.sql(prop) for prop in locations[exp.Properties.Location.POST_NAME]]
736                )
737                this_schema = self.schema_columns_sql(expression.this)
738                return f"{this_name}{self.sep()}{this_properties}{self.sep()}{this_schema}"
739
740            return super().createable_sql(expression, locations)
def prewhere_sql(self, expression: sqlglot.expressions.PreWhere) -> str:
742        def prewhere_sql(self, expression: exp.PreWhere) -> str:
743            this = self.indent(self.sql(expression, "this"))
744            return f"{self.seg('PREWHERE')}{self.sep()}{this}"
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
indexcolumnconstraint_sql
nvl2_sql
comprehension_sql
columnprefix_sql
opclass_sql
predict_sql
forin_sql
refresh_sql
operator_sql
toarray_sql
tsordstotime_sql
tsordstodate_sql
unixdate_sql
lastday_sql
arrayany_sql
generateseries_sql
struct_sql
partitionrange_sql
truncatetable_sql
convert_sql