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

Determines how function names are going to be normalized.

NULL_ORDERING = 'nulls_are_last'

Indicates the 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

Determines whether or not user-defined data types are supported.

SAFE_DIVISION = True

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

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

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

Arguments:
  • pretty: Whether or not 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 or not to normalize identifiers to lowercase. Default: False.
  • pad: Determines the pad size in a formatted string. Default: 2.
  • indent: Determines the indentation size in a formatted string. Default: 2.
  • normalize_functions: Whether or not to normalize all 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: Determines whether or not 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 or not 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
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.CaseSpecificColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CharacterSetColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CharacterSetProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CheckColumnConstraint'>: <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.ExecuteAsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ExternalProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.HeapProperty'>: <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.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.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.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.VarMap'>: <function ClickHouse.Generator.<lambda>>, <class 'sqlglot.expressions.VolatileProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WithJournalTableProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.AnyValue'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.ApproxDistinct'>: <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.JSONExtract'>: <function json_extract_segments.<locals>._json_extract_segments>, <class 'sqlglot.expressions.JSONExtractScalar'>: <function json_extract_segments.<locals>._json_extract_segments>, <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.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.HeapProperty'>: <Location.POST_WITH: 'POST_WITH'>, <class 'sqlglot.expressions.InheritsProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.InputModelProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.IsolatedLoadingProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.JournalProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.LanguageProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.LikeProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.LocationProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.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.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.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 = {'VIEW', 'DICTIONARY', 'FUNCTION', 'NAMED COLLECTION', 'DATABASE', 'TABLE', 'INDEX'}
def likeproperty_sql(self, expression: sqlglot.expressions.LikeProperty) -> str:
638        def likeproperty_sql(self, expression: exp.LikeProperty) -> str:
639            return f"AS {self.sql(expression, 'this')}"
def eq_sql(self, expression: sqlglot.expressions.EQ) -> str:
657        def eq_sql(self, expression: exp.EQ) -> str:
658            return self._any_to_has(expression, super().eq_sql)
def neq_sql(self, expression: sqlglot.expressions.NEQ) -> str:
660        def neq_sql(self, expression: exp.NEQ) -> str:
661            return self._any_to_has(expression, super().neq_sql, "NOT ")
def regexpilike_sql(self, expression: sqlglot.expressions.RegexpILike) -> str:
663        def regexpilike_sql(self, expression: exp.RegexpILike) -> str:
664            # Manually add a flag to make the search case-insensitive
665            regex = self.func("CONCAT", "'(?i)'", expression.expression)
666            return f"match({self.format_args(expression.this, regex)})"
def datatype_sql(self, expression: sqlglot.expressions.DataType) -> str:
668        def datatype_sql(self, expression: exp.DataType) -> str:
669            # String is the standard ClickHouse type, every other variant is just an alias.
670            # Additionally, any supplied length parameter will be ignored.
671            #
672            # https://clickhouse.com/docs/en/sql-reference/data-types/string
673            if expression.this in self.STRING_TYPE_MAPPING:
674                return "String"
675
676            return super().datatype_sql(expression)
def cte_sql(self, expression: sqlglot.expressions.CTE) -> str:
678        def cte_sql(self, expression: exp.CTE) -> str:
679            if expression.args.get("scalar"):
680                this = self.sql(expression, "this")
681                alias = self.sql(expression, "alias")
682                return f"{this} AS {alias}"
683
684            return super().cte_sql(expression)
def after_limit_modifiers(self, expression: sqlglot.expressions.Expression) -> List[str]:
686        def after_limit_modifiers(self, expression: exp.Expression) -> t.List[str]:
687            return super().after_limit_modifiers(expression) + [
688                (
689                    self.seg("SETTINGS ") + self.expressions(expression, key="settings", flat=True)
690                    if expression.args.get("settings")
691                    else ""
692                ),
693                (
694                    self.seg("FORMAT ") + self.sql(expression, "format")
695                    if expression.args.get("format")
696                    else ""
697                ),
698            ]
def parameterizedagg_sql(self, expression: sqlglot.expressions.ParameterizedAgg) -> str:
700        def parameterizedagg_sql(self, expression: exp.ParameterizedAgg) -> str:
701            params = self.expressions(expression, key="params", flat=True)
702            return self.func(expression.name, *expression.expressions) + f"({params})"
def anonymousaggfunc_sql(self, expression: sqlglot.expressions.AnonymousAggFunc) -> str:
704        def anonymousaggfunc_sql(self, expression: exp.AnonymousAggFunc) -> str:
705            return self.func(expression.name, *expression.expressions)
def combinedaggfunc_sql(self, expression: sqlglot.expressions.CombinedAggFunc) -> str:
707        def combinedaggfunc_sql(self, expression: exp.CombinedAggFunc) -> str:
708            return self.anonymousaggfunc_sql(expression)
def combinedparameterizedagg_sql(self, expression: sqlglot.expressions.CombinedParameterizedAgg) -> str:
710        def combinedparameterizedagg_sql(self, expression: exp.CombinedParameterizedAgg) -> str:
711            return self.parameterizedagg_sql(expression)
def placeholder_sql(self, expression: sqlglot.expressions.Placeholder) -> str:
713        def placeholder_sql(self, expression: exp.Placeholder) -> str:
714            return f"{{{expression.name}: {self.sql(expression, 'kind')}}}"
def oncluster_sql(self, expression: sqlglot.expressions.OnCluster) -> str:
716        def oncluster_sql(self, expression: exp.OnCluster) -> str:
717            return f"ON CLUSTER {self.sql(expression, 'this')}"
def createable_sql( self, expression: sqlglot.expressions.Create, locations: DefaultDict) -> str:
719        def createable_sql(self, expression: exp.Create, locations: t.DefaultDict) -> str:
720            kind = self.sql(expression, "kind").upper()
721            if kind in self.ON_CLUSTER_TARGETS and locations.get(exp.Properties.Location.POST_NAME):
722                this_name = self.sql(expression.this, "this")
723                this_properties = " ".join(
724                    [self.sql(prop) for prop in locations[exp.Properties.Location.POST_NAME]]
725                )
726                this_schema = self.schema_columns_sql(expression.this)
727                return f"{this_name}{self.sep()}{this_properties}{self.sep()}{this_schema}"
728
729            return super().createable_sql(expression, locations)
SELECT_KINDS: Tuple[str, ...] = ()
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
RESERVED_KEYWORDS
WITH_SEPARATED_COMMENTS
EXCLUDE_COMMENTS
UNWRAPPED_INTERVAL_VALUES
EXPRESSIONS_WITHOUT_NESTED_CTES
KEY_VALUE_DEFINITIONS
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
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
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_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
offset_limit_modifiers
after_having_modifiers
select_sql
schema_sql
schema_columns_sql
star_sql
parameter_sql
sessionparameter_sql
subquery_sql
qualify_sql
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
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
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
or_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
set_operation
tag_sql
token_sql
userdefinedfunction_sql
joinhint_sql
kwarg_sql
when_sql
merge_sql
tochar_sql
dictproperty_sql
dictrange_sql
dictsubproperty_sql
clusteredbyproperty_sql
anyvalue_sql
querytransform_sql
indexconstraintoption_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