Skip to content

Commit 77562c8

Browse files
committed
close resources
1 parent 00c5efa commit 77562c8

File tree

1 file changed

+2
-0
lines changed
  • x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/approximate

1 file changed

+2
-0
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/approximate/Approximate.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ private ActionListener<Result> sourceCountListener(LogicalPlanRunner runner, Act
199199
return listener.delegateFailureAndWrap((countListener, countResult) -> {
200200
logger.debug("sourceCountPlan result: {} rows", rowCount(countResult));
201201
double sampleProbability = sampleProbability(countResult);
202+
countResult.pages().getFirst().close();
202203
if (hasFilters) {
203204
runner.run(countPlan(sampleProbability), countListener(runner, sampleProbability, listener));
204205
} else {
@@ -250,6 +251,7 @@ private ActionListener<Result> countListener(LogicalPlanRunner runner, double pr
250251
long rowCount = rowCount(countResult);
251252
logger.debug("countPlan result (p={}): {} rows", probability, rowCount);
252253
double newProbability = probability * SAMPLE_ROW_COUNT / Math.max(1, rowCount);
254+
countResult.pages().getFirst().close();
253255
if (rowCount <= SAMPLE_ROW_COUNT / 2 && newProbability < 1.0) {
254256
runner.run(countPlan(newProbability), countListener(runner, newProbability, listener));
255257
} else {

0 commit comments

Comments
 (0)