Make sure everything gets closed in SpillableHashAggregationBuilder
@@ -189,10 +189,10 @@ public class SpillableHashAggregationBuilder
@Override
public void close()
{
+ try (Closer closer = Closer.create()) {
if (hashAggregationBuilder != null) {
- hashAggregationBuilder.close();
+ closer.register(hashAggregationBuilder::close);
}
- try (Closer closer = Closer.create()) {
merger.ifPresent(closer::register);
spiller.ifPresent(closer::register);
mergeHashSort.ifPresent(closer::register);
@@ -278,9 +278,10 @@ public class SpillableHashAggregationBuilder
if (hashAggregationBuilder != null) {
hashCollisions += hashAggregationBuilder.getHashCollisions();
expectedHashCollisions += hashAggregationBuilder.getExpectedHashCollisions();
+ hashAggregationBuilder.close();
}
- this.hashAggregationBuilder = new InMemoryHashAggregationBuilder(
+ hashAggregationBuilder = new InMemoryHashAggregationBuilder(
accumulatorFactories,
step,
expectedGroups,
@@ -290,6 +291,6 @@ public class SpillableHashAggregationBuilder
operatorContext,
DataSize.succinctBytes(0),
joinCompiler);
- this.emptyHashAggregationBuilderSize = this.hashAggregationBuilder.getSizeInMemory();
+ emptyHashAggregationBuilderSize = hashAggregationBuilder.getSizeInMemory();
}
}
