summaryrefslogtreecommitdiffstats
path: root/sqlglot/dialects/clickhouse.py
diff options
context:
space:
mode:
Diffstat (limited to 'sqlglot/dialects/clickhouse.py')
-rw-r--r--sqlglot/dialects/clickhouse.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/sqlglot/dialects/clickhouse.py b/sqlglot/dialects/clickhouse.py
index f2e4fe1..1248edc 100644
--- a/sqlglot/dialects/clickhouse.py
+++ b/sqlglot/dialects/clickhouse.py
@@ -88,6 +88,8 @@ class ClickHouse(Dialect):
"UINT8": TokenType.UTINYINT,
"IPV4": TokenType.IPV4,
"IPV6": TokenType.IPV6,
+ "AGGREGATEFUNCTION": TokenType.AGGREGATEFUNCTION,
+ "SIMPLEAGGREGATEFUNCTION": TokenType.SIMPLEAGGREGATEFUNCTION,
}
SINGLE_TOKENS = {
@@ -548,6 +550,8 @@ class ClickHouse(Dialect):
exp.DataType.Type.UTINYINT: "UInt8",
exp.DataType.Type.IPV4: "IPv4",
exp.DataType.Type.IPV6: "IPv6",
+ exp.DataType.Type.AGGREGATEFUNCTION: "AggregateFunction",
+ exp.DataType.Type.SIMPLEAGGREGATEFUNCTION: "SimpleAggregateFunction",
}
TRANSFORMS = {
@@ -651,12 +655,16 @@ class ClickHouse(Dialect):
def after_limit_modifiers(self, expression: exp.Expression) -> t.List[str]:
return super().after_limit_modifiers(expression) + [
- self.seg("SETTINGS ") + self.expressions(expression, key="settings", flat=True)
- if expression.args.get("settings")
- else "",
- self.seg("FORMAT ") + self.sql(expression, "format")
- if expression.args.get("format")
- else "",
+ (
+ self.seg("SETTINGS ") + self.expressions(expression, key="settings", flat=True)
+ if expression.args.get("settings")
+ else ""
+ ),
+ (
+ self.seg("FORMAT ") + self.sql(expression, "format")
+ if expression.args.get("format")
+ else ""
+ ),
]
def parameterizedagg_sql(self, expression: exp.ParameterizedAgg) -> str: