Aaaaaaron commented on a change in pull request #2274:
URL: https://github.com/apache/calcite/pull/2274#discussion_r528170124



##########
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:
       Seems can enter, I test "SELECT sum(distinct employee_id) over (order by 
hire_date) FROM employee" can enter, but I can not write a SQL with SUM0, do 
you have any advice about this, or I can add the SUM DISTINCT query?




----------------------------------------------------------------
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]


Reply via email to