xiedeyantu commented on code in PR #4247:
URL: https://github.com/apache/calcite/pull/4247#discussion_r2013048511
##########
core/src/main/java/org/apache/calcite/sql/dialect/ClickHouseSqlDialect.java:
##########
@@ -181,6 +188,21 @@ private static SqlDataTypeSpec
createSqlDataTypeSpecByName(String typeAlias,
return;
}
+ if (call.getOperator() instanceof SqlFilterOperator) {
+ SqlCall aggCall = call.operand(0);
+ if (call.getOperandList().size() > 1 && call.operand(1) != null) {
+ SqlCall filterCondition = call.operand(1);
+ String functionName = aggCall.getOperator().getName();
+ writer.print(functionName.toLowerCase(Locale.ROOT) + "If");
Review Comment:
Thanks for review it. Clickhouse has such a logic. It will concatenate the
aggregate function and -If instead of implementing a new xxxIf function. For
example, whether stddevIf exists depends on whether Clickhouse supports stddev.
I understand that the conversion of pr is correct. If more precision is needed,
we may need to do a good job of mapping the functions from calcite to
Clickhouse, but it seems that each dialect is being implemented one by one,
which may be an area that needs improvement.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]