Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20292#discussion_r163510314
  
    --- Diff: 
core/src/main/scala/org/apache/spark/util/collection/ExternalAppendOnlyMap.scala
 ---
    @@ -528,14 +528,22 @@ class ExternalAppendOnlyMap[K, V, C](
         override def hasNext: Boolean = {
           if (nextItem == null) {
             if (deserializeStream == null) {
    -          return false
    +          // In case of deserializeStream has not been initialized
    +          deserializeStream = nextBatchStream()
    +          if (deserializeStream == null) {
    +            return false
    +          }
             }
             nextItem = readNextItem()
           }
           nextItem != null
         }
     
         override def next(): (K, C) = {
    --- End diff --
    
    nit:
    ```
    if (!hasNext) {
      throw new NoSuchElementException
    }
    val item = nextItem
    nextItem = null
    item
    ```


---

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

Reply via email to