lowka commented on code in PR #4522:
URL: https://github.com/apache/ignite-3/pull/4522#discussion_r1796622594
##########
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:
Introduce Mutable holders for long and double.
##########
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:
Introduced Mutable holders for long and double.
--
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]