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

    https://github.com/apache/spark/pull/11791#discussion_r56916760
  
    --- Diff: 
core/src/main/scala/org/apache/spark/storage/memory/MemoryStore.scala ---
    @@ -500,3 +601,79 @@ private[storage] class PartiallyUnrolledIterator(
         iter = null
       }
     }
    +
    +/**
    + * A wrapper which allows an open [[OutputStream]] to be redirected to a 
different sink.
    + */
    +private class RedirectableOutputStream extends OutputStream {
    +  private[this] var os: OutputStream = _
    +  def setOutputStream(s: OutputStream): Unit = { os = s }
    +  override def write(b: Int): Unit = os.write(b)
    +  override def write(b: Array[Byte]): Unit = os.write(b)
    +  override def write(b: Array[Byte], off: Int, len: Int): Unit = 
os.write(b, off, len)
    +  override def flush(): Unit = os.flush()
    +  override def close(): Unit = os.close()
    +}
    +
    +/**
    + * The result of a failed [[MemoryStore.putIteratorAsBytes()]] call.
    + *
    + * @param memoryStore the MemoryStore, used for freeing memory.
    + * @param blockManager the BlockManager, used for deserializing values.
    + * @param blockId the block id.
    + * @param serializationStream a serialization stream which writes to 
[[redirectableOutputStream]].
    + * @param redirectableOutputStream an OutputStream which can be redirected 
to a different sink.
    + * @param unrollMemory the amount of unroll memory used by the values in 
`unrolled`.
    + * @param unrolled a byte buffer containing the partially-serialized 
values.
    + * @param rest         the rest of the original iterator passed to
    + *                     [[MemoryStore.putIteratorAsValues()]].
    + */
    +private[storage] class PartiallySerializedBlock(
    +    memoryStore: MemoryStore,
    +    blockManager: BlockManager,
    +    blockId: BlockId,
    +    serializationStream: SerializationStream,
    +    redirectableOutputStream: RedirectableOutputStream,
    +    unrollMemory: Long,
    +    unrolled: ChunkedByteBuffer,
    +    rest: Iterator[Any]) {
    +
    +  /**
    +   * Called to dispose of this block and free its memory.
    +   */
    +  def discard(): Unit = {
    --- End diff --
    
    who calls this now?


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to