You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/02/12 18:55:51 UTC

[GitHub] taosaildrone commented on a change in pull request #23762: [SPARK-21492][SQL][WIP] Memory leak in SortMergeJoin

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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org