This is an automated email from the ASF dual-hosted git repository.
cloud-fan pushed a commit to branch branch-4.x
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-4.x by this push:
new c7265dee9d62 [SPARK-61248][4.4][SQL][FOLLOWUP] Make the spill-backed
iterator closeable, so the ASOF scan can close it
c7265dee9d62 is described below
commit c7265dee9d6294a69a08b3a1cc529cdf619680b9
Author: Luka Zdravić <[email protected]>
AuthorDate: Tue Nov 10 13:10:20 2026 +0000
[SPARK-61248][4.4][SQL][FOLLOWUP] Make the spill-backed iterator closeable,
so the ASOF scan can close it
### What changes were proposed in this pull request?
`SpillableArrayIterator` in `ExternalAppendOnlyUnsafeRowArray` now
implements `Closeable`. Its close code moves from `closeIfNeeded` into a public
`close()`, and `closeIfNeeded` calls it. Master already has these lines, from
SPARK-58201. This PR takes only these lines.
### Why are the changes needed?
SPARK-61248 (#60240) was picked to branch-4.x. Its fix closes a right-side
group's iterator only if the iterator is `Closeable`. On branch-4.x the
spill-backed iterator is not, so the fix closes nothing. Its new test fails the
branch-4.x build
([run](https://github.com/apache/spark/actions/runs/42732290097), "sql - other
tests"):
```
- buffered scan closes the spill readers of a group it leaves early ***
FAILED ***
Backward: 55 was not less than 8 the scan left 55 more files open
(SortMergeAsOfJoinScannerSuite.scala:117)
```
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
On branch-4.x, the failing test now passes.
`SortMergeAsOfJoinScannerSuite`, `ExternalAppendOnlyUnsafeRowArraySuite`,
`AsOfJoinSortMergeSQLSuite` and `SortMergeAsOfJoinSuite` pass: 275 tests.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code
This pull request and its description were written by Isaac.
Closes #60297 from LukaZdravic/asof-close-spill-readers-4.x.
Authored-by: Luka Zdravić <[email protected]>
Signed-off-by: Wenchen Fan <[email protected]>
skip-checks: true
---
.../spark/sql/execution/ExternalAppendOnlyUnsafeRowArray.scala | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git
a/sql/core/src/main/scala/org/apache/spark/sql/execution/ExternalAppendOnlyUnsafeRowArray.scala
b/sql/core/src/main/scala/org/apache/spark/sql/execution/ExternalAppendOnlyUnsafeRowArray.scala
index 9fb2a915ac2a..3791d2068f06 100644
---
a/sql/core/src/main/scala/org/apache/spark/sql/execution/ExternalAppendOnlyUnsafeRowArray.scala
+++
b/sql/core/src/main/scala/org/apache/spark/sql/execution/ExternalAppendOnlyUnsafeRowArray.scala
@@ -256,7 +256,7 @@ class ExternalAppendOnlyUnsafeRowArray(
private[this] class SpillableArrayIterator(
iterator: UnsafeSorterIterator,
numFieldPerRow: Int)
- extends ExternalAppendOnlyUnsafeRowArrayIterator {
+ extends ExternalAppendOnlyUnsafeRowArrayIterator with Closeable {
private val currentRow = new UnsafeRow(numFieldPerRow)
@@ -269,7 +269,9 @@ class ExternalAppendOnlyUnsafeRowArray(
currentRow
}
- override protected def closeIfNeeded(): Unit = iterator match {
+ override protected def closeIfNeeded(): Unit = close()
+
+ override def close(): Unit = iterator match {
case c: Closeable => c.close()
case _ => // do nothing
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]