liuzqt commented on code in PR #38064:
URL: https://github.com/apache/spark/pull/38064#discussion_r993757787


##########
core/src/main/scala/org/apache/spark/util/io/ChunkedByteBuffer.scala:
##########
@@ -207,6 +273,41 @@ private[spark] object ChunkedByteBuffer {
     }
     out.toChunkedByteBuffer
   }
+
+  /**
+   * util function writing ChunkedByteBuffer to destination with zero copy if 
possible(when
+   * ChunkedByteBuffer is backed by bytes array)
+   * @param src ChunkedByteBuffer as src
+   * @param write write function writing data to destination, following the 
semantic of
+   *              java.io.outputStream.write(buffer Array[Byte], off Int, len 
Int)
+   */
+  private def writeBufferToDest(
+      src: ChunkedByteBuffer,
+      write: (Array[Byte], Int, Int) => Unit): Unit = {
+    var buffer: Array[Byte] = null
+    val bufferLen = 1024 * 1024
+
+    src.chunks.foreach { chunk => {

Review Comment:
   good point, thanks! This saves me from restoring the states



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to