lowka commented on code in PR #4522:
URL: https://github.com/apache/ignite-3/pull/4522#discussion_r1796443870


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/exp/agg/Accumulators.java:
##########
@@ -400,25 +447,34 @@ public RelDataType returnType(IgniteTypeFactory 
typeFactory) {
         }
     }
 
-    private static class LongCount implements Accumulator {
+    /** {@code COUNT(LONG)} accumulator.. */
+    public static class LongCount implements Accumulator {
         public static final Supplier<Accumulator> FACTORY = LongCount::new;
 
-        private long cnt;
-
         /** {@inheritDoc} */
         @Override
-        public void add(Object... args) {
+        public void add(AccumulatorsState state, Object... args) {
             assert nullOrEmpty(args) || args.length == 1;
 
             if (nullOrEmpty(args) || args[0] != null) {
-                cnt++;
+                Long cnt = (Long) state.get();

Review Comment:
   There is no point in doing so  until:
   1) The SQL engine provides APIs (See SqlHandler::get()) for accessing 
primitive values w/o always boxing them. 
   2) All cast machinery inside `AccumulatorsFactory` is implemented by code 
generation.



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

Reply via email to