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

    https://github.com/apache/spark/pull/1165#discussion_r15091634
  
    --- Diff: core/src/main/scala/org/apache/spark/storage/MemoryStore.scala ---
    @@ -141,6 +174,86 @@ private class MemoryStore(blockManager: BlockManager, 
maxMemory: Long)
       }
     
       /**
    +   * Unfold the given block in memory safely.
    +   *
    +   * The safety of this operation refers to avoiding potential OOM 
exceptions caused by
    +   * unfolding the entirety of the block in memory at once. This is 
achieved by periodically
    +   * checking whether the memory restrictions for unfolding blocks are 
still satisfied,
    +   * stopping immediately if not. This check is a safeguard against the 
scenario in which
    +   * there is not enough free memory to accommodate the entirety of a 
single block.
    +   *
    +   * This method returns either a fully unfolded array or a partially 
unfolded iterator.
    +   */
    +  def unfoldSafely(
    --- End diff --
    
    I looked at this more closely and realized we can't do this easily. With a 
type parameter, this returns an `Array[T]`. However, to put the result into 
block manager, we need an `Array[Any]`, and we cannot easily cast from one to 
another efficiently because arrays are not covariant.
    
    Unfortunately, I think we need to keep this one as `Any`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to