Github user jiangxb1987 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20292#discussion_r162151603
  
    --- Diff: 
core/src/main/scala/org/apache/spark/util/collection/ExternalAppendOnlyMap.scala
 ---
    @@ -509,8 +509,8 @@ class ExternalAppendOnlyMap[K, V, C](
          */
         private def readNextItem(): (K, C) = {
           try {
    -        val k = deserializeStream.readKey().asInstanceOf[K]
    -        val c = deserializeStream.readValue().asInstanceOf[C]
    +        val k = deserializeStream.get.readKey().asInstanceOf[K]
    --- End diff --
    
    If developer call `next()` without checking `hasNext` then this will 
trigger clean up, which is not expected.


---

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

Reply via email to