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


##########
core/src/main/scala/org/apache/spark/executor/Executor.scala:
##########
@@ -659,9 +659,10 @@ private[spark] class Executor(
         val accumUpdates = task.collectAccumulatorUpdates()
         val metricPeaks = metricsPoller.getTaskMetricPeaks(taskId)
         // TODO: do not serialize value twice
-        val directResult = new DirectTaskResult(valueBytes, accumUpdates, 
metricPeaks)
-        val serializedDirectResult = ser.serialize(directResult)
-        val resultSize = serializedDirectResult.limit()
+        val directResult = new DirectTaskResult(valueByteBuffer, accumUpdates, 
metricPeaks)
+        val serializedDirectResult = 
SerializerHelper.serializeToChunkedBuffer(ser, directResult,
+          valueByteBuffer.size)

Review Comment:
   nit:
   
   There is no cheap way to determine what the expected size would be - given 
mostly the bulk of it would typically be `valueBytes`, we can reasonably 
extrapolate and make it closer.
   Something like:
   `valueBytes.size + accumUpdates.size * 32 + metricPeaks.length * 8`
   
   (A common accumulator `LongAccumulator` size is closer to 26 or so)



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