taosaildrone 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_r256098117
 
 

 ##########
 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]) {
+      val rowIter = iter.asInstanceOf[RowIteratorFromScala]
+      val underlyingIter = rowIter.toScala
 
 Review comment:
   For our case of RowIteratorFromScala, this would return the underlying 
iterator

----------------------------------------------------------------
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]

Reply via email to