AMashenkov commented on code in PR #6479:
URL: https://github.com/apache/ignite-3/pull/6479#discussion_r2313698438


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/rel/agg/MapReduceAggregates.java:
##########
@@ -487,6 +490,28 @@ private static MapReduceAgg createSimpleAgg(AggregateCall 
call, int reduceArgume
         return new MapReduceAgg(argList, call, reduceCall, USE_INPUT_FIELD);
     }
 
+    private static MapReduceAgg createGroupingAgg(AggregateCall call, int 
reduceArgumentOffset) {
+        IntList argList = IntList.of(reduceArgumentOffset);
+
+        AggregateCall reduceCall = AggregateCall.create(
+                SqlStdOperatorTable.SINGLE_VALUE,
+                call.isDistinct(),
+                call.isApproximate(),
+                call.ignoreNulls(),
+                ImmutableList.of(),
+                argList,
+                // there is no filtering on REDUCE phase
+                -1,
+                null,
+                call.collation,
+                call.type,
+                "GROUPING" + reduceArgumentOffset);
+
+        // For aggregate that use the same aggregate function for both MAP and 
REDUCE phases
+        // use the result of an aggregate as is.
+        return new MapReduceAgg(argList, call, reduceCall, USE_INPUT_FIELD);

Review Comment:
   We need smth to pass from map->reduce phase. Our code doesn't allows reduce 
aggregate without map aggregate.
   Tests added.



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to