You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "allisonwang-db (via GitHub)" <gi...@apache.org> on 2023/10/11 00:58:04 UTC

Re: [PR] [SPARK-45494][PYTHON] Introduce util functions to read/write a byte array for PythonWorkerUtils [spark]

allisonwang-db commented on code in PR #43321:
URL: https://github.com/apache/spark/pull/43321#discussion_r1353752650


##########
core/src/main/scala/org/apache/spark/api/python/PythonRunner.scala:
##########
@@ -845,9 +843,7 @@ private[spark] class PythonRunner(
         try {
           stream.readInt() match {
             case length if length > 0 =>
-              val obj = new Array[Byte](length)
-              stream.readFully(obj)
-              obj
+              PythonWorkerUtils.readBytes(length, stream)
             case 0 => Array.emptyByteArray

Review Comment:
   Can we use `PythonWorkerUtils.readBytes` if we have `length=0` or we need to handle that separately?



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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