From 4475fddbf75969efa2e1994297d4b34c828491c0 Mon Sep 17 00:00:00 2001
From: Costin Leau <costin.leau@gmail.com>
Date: Wed, 27 Sep 2023 11:36:28 -0700
Subject: [PATCH] ESQL: Improve block closing in tests

---
 .../elasticsearch/compute/operator/ProjectOperatorTests.java   | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/ProjectOperatorTests.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/ProjectOperatorTests.java
index 1d3c95ff5eba3..fa3b2096acb05 100644
--- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/ProjectOperatorTests.java
+++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/ProjectOperatorTests.java
@@ -74,8 +74,9 @@ public void testProjection() {
         for (int i = 0; i < out.getBlockCount(); i++) {
             var block = out.<IntBlock>getBlock(i);
             assertEquals(block, page.getBlock(randomProjection.get(i)));
-            block.close();
         }
+        // close all blocks separately since the same block can be used by multiple columns (aliased)
+        out.releaseBlocks();
     }
 
     private List<Integer> randomProjection(int size) {