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_r256106886
 
 

 ##########
 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:
   Case statement's a good idea. Looks cleaner.
   
   Do you mean a class instead of a trait? The various classes are all top 
level, so I'm not sure where I'd put this method instead.

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