zabetak commented on a change in pull request #2274:
URL: https://github.com/apache/calcite/pull/2274#discussion_r528538033
##########
File path: core/src/main/java/org/apache/calcite/rel/rel2sql/SqlImplementor.java
##########
@@ -1007,19 +1007,27 @@ private SqlCall toSql(RexProgram program, RexOver
rexOver) {
orderList, isRows, lowerBound, upperBound, allowPartial, POS);
final List<SqlNode> nodeList = toSql(program, rexOver.getOperands());
- return createOverCall(sqlAggregateFunction, nodeList, sqlWindow);
+ return createOverCall(sqlAggregateFunction, nodeList, sqlWindow,
rexOver.isDistinct());
}
private SqlCall createOverCall(SqlAggFunction op, List<SqlNode> operands,
- SqlWindow window) {
+ SqlWindow window, boolean isDistinct) {
if (op instanceof SqlSumEmptyIsZeroAggFunction) {
// Rewrite "SUM0(x) OVER w" to "COALESCE(SUM(x) OVER w, 0)"
final SqlCall node =
- createOverCall(SqlStdOperatorTable.SUM, operands, window);
+ createOverCall(SqlStdOperatorTable.SUM, operands, window,
isDistinct);
Review comment:
If I remember well `SUM0` appears when the column is nullable. Did you
try an example with a nullable column?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]