srowen commented on a change in pull request #23762: [SPARK-21492][SQL][WIP]
Memory leak in SortMergeJoin
URL: https://github.com/apache/spark/pull/23762#discussion_r256032844
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/joins/SortMergeJoinExec.scala
##########
@@ -1140,9 +1167,26 @@ private class FullOuterIterator(
override def advanceNext(): Boolean = {
val r = smjScanner.advanceNext()
- if (r) numRows += 1
+ if (r) {
+ numRows += 1
+ } else {
+ smjScanner.close()
+ }
r
}
override def getRow: InternalRow = resultProj(joinedRow)
}
+
+trait CloseableScanner {
+ def closeIterator(iter: RowIterator): Unit = {
+ if (iter.isInstanceOf[RowIteratorFromScala]) {
Review comment:
I think you can use a `case` statement here to make it a little more
concise, but no big deal.
Does this need to be a trait vs just a method that these various classes can
call?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]