alex-plekhanov commented on code in PR #11783: URL: https://github.com/apache/ignite/pull/11783#discussion_r1898882800
########## modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/HashAggregateNode.java: ########## @@ -293,14 +297,20 @@ else if (type == AggregateType.MAP) /** */ private void addOnMapper(Row row) { - GroupKey.Builder b = GroupKey.builder(grpFields.cardinality()); - for (Integer field : grpFields) - b.add(handler.get(field, row)); + grpKeyBld.add(handler.get(field, row)); - GroupKey grpKey = b.build(); + GroupKey grpKey = grpKeyBld.build(); - List<AccumulatorWrapper<Row>> wrappers = groups.computeIfAbsent(grpKey, this::create); + List<AccumulatorWrapper<Row>> wrappers = groups.get(grpKey); + + if (wrappers == null) { + groups.put(grpKey, (wrappers = create(grpKey))); + + grpKeyBld = GroupKey.builder(grpFields.cardinality()); + } + else + grpKeyBld.clear(); Review Comment: ```suggestion List<AccumulatorWrapper<Row>> wrappers = groups.compute(grpKey, (k, v) -> { if (v == null) { grpKeyBld = GroupKey.builder(grpFields.cardinality()); return create(k); } else { grpKeyBld.clear(); return v; } }); ``` Also, looks like `create` method doesn't use key parameter and this parameter can be removed. -- 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