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


##########
core/src/main/scala/org/apache/spark/util/io/ChunkedByteBuffer.scala:
##########
@@ -42,8 +42,9 @@ import org.apache.spark.util.Utils
  *               buffers may also be used elsewhere then the caller is 
responsible for copying
  *               them as needed.
  */
-private[spark] class ChunkedByteBuffer(var chunks: Array[ByteBuffer]) {
+private[spark] class ChunkedByteBuffer(var chunks: Array[ByteBuffer]) extends 
Externalizable {
   require(chunks != null, "chunks must not be null")
+  require(!chunks.contains(null), "chunks must not contain null")

Review Comment:
   The `ChunkeByteBuffer` has a constructor overload `def this(byteBuffer: 
ByteBuffer)`, which is invoked with `null` in [the DirectTaskResult empty 
constructor](https://github.com/apache/spark/pull/38064/files#diff-dbad0b25e806252e4c794ac2a13776bfb50064401ee0284f9f1606b6d4d4de0dL48).
 
   
   It was triggered in some temp code snippet during my dev, but should not 
have any usage in the current code base(at least can not be found explicitly). 
That empty constructor might serve as default constructor for some 
serialization code I guess.......After all, the code in `ChunkeByteBuffer` are 
assuming `chunks` doesn't contains null, so I think it's no harm to do this 
check at the beginning.



-- 
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