From 5a3a43d5ab61794212cdf4132a4b3bb62c1c4914 Mon Sep 17 00:00:00 2001 From: Maksim Timonin Date: Sat, 28 Dec 2024 16:30:38 +0300 Subject: [PATCH] Fix test --- .../query/calcite/exec/rel/HashAggregateNode.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/HashAggregateNode.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/HashAggregateNode.java index 42eefa7462e92..e92645a9a9bda 100644 --- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/HashAggregateNode.java +++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/HashAggregateNode.java @@ -25,6 +25,7 @@ import java.util.List; import java.util.Map; import java.util.function.BiFunction; +import java.util.function.Function; import java.util.function.Supplier; import org.apache.calcite.rel.type.RelDataType; import org.apache.calcite.util.ImmutableBitSet; @@ -251,6 +252,9 @@ private class Grouping { /** */ private final BiFunction>, List>> getOrCreateGroup; + /** */ + private final Function>> createGroup; + /** */ private Grouping(byte grpId, ImmutableBitSet grpFields) { this.grpId = grpId; @@ -259,6 +263,8 @@ private Grouping(byte grpId, ImmutableBitSet grpFields) { grpKeyBld = GroupKey.builder(grpFields.cardinality()); handler = context().rowHandler(); + createGroup = (k) -> create(); + getOrCreateGroup = (k, v) -> { if (v == null) { grpKeyBld = GroupKey.builder(grpFields.cardinality()); @@ -332,7 +338,7 @@ private void addOnReducer(Row row) { GroupKey grpKey = (GroupKey)handler.get(1, row); - List> wrappers = groups.get(grpKey); + List> wrappers = groups.computeIfAbsent(grpKey, createGroup); Accumulator[] accums = hasAccumulators() ? (Accumulator[])handler.get(2, row) : null; for (int i = 0; i < F.size(wrappers); i++) {