From 3449c8a772899ff1752ea42efa89f1ddc049cc6a Mon Sep 17 00:00:00 2001 From: Alessandro Bellina Date: Sun, 8 Dec 2024 15:45:53 -0600 Subject: [PATCH] Fixes a leak for the empty nlj iterator (#11832) Signed-off-by: Alessandro Bellina --- .../GpuBroadcastNestedLoopJoinExecBase.scala | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sql-plugin/src/main/scala/org/apache/spark/sql/rapids/execution/GpuBroadcastNestedLoopJoinExecBase.scala b/sql-plugin/src/main/scala/org/apache/spark/sql/rapids/execution/GpuBroadcastNestedLoopJoinExecBase.scala index 578c1106eb1..b939a8c4155 100644 --- a/sql-plugin/src/main/scala/org/apache/spark/sql/rapids/execution/GpuBroadcastNestedLoopJoinExecBase.scala +++ b/sql-plugin/src/main/scala/org/apache/spark/sql/rapids/execution/GpuBroadcastNestedLoopJoinExecBase.scala @@ -658,11 +658,15 @@ abstract class GpuBroadcastNestedLoopJoinExecBase( localJoinType match { case LeftOuter if spillableBuiltBatch.numRows == 0 => - new EmptyOuterNestedLoopJoinIterator(streamedIter, spillableBuiltBatch.dataTypes, - true) + withResource(spillableBuiltBatch) { _ => + new EmptyOuterNestedLoopJoinIterator(streamedIter, spillableBuiltBatch.dataTypes, + true) + } case RightOuter if spillableBuiltBatch.numRows == 0 => - new EmptyOuterNestedLoopJoinIterator(streamedIter, spillableBuiltBatch.dataTypes, - false) + withResource(spillableBuiltBatch) { _ => + new EmptyOuterNestedLoopJoinIterator(streamedIter, spillableBuiltBatch.dataTypes, + false) + } case _ => new CrossJoinIterator( spillableBuiltBatch,