gatorsmile commented on a change in pull request #26235: [SPARK-29576][Core]
Use Spark's CompressionCodec for Ser/Deser of MapOutputStatus
URL: https://github.com/apache/spark/pull/26235#discussion_r343509904
##########
File path: core/src/main/scala/org/apache/spark/MapOutputTracker.scala
##########
@@ -890,16 +891,20 @@ private[spark] object MapOutputTracker extends Logging {
// Serialize an array of map output locations into an efficient byte format
so that we can send
// it to reduce tasks. We do this by compressing the serialized bytes using
Zstd. They will
// generally be pretty compressible because many map outputs will be on the
same hostname.
- def serializeMapStatuses(statuses: Array[MapStatus], broadcastManager:
BroadcastManager,
- isLocal: Boolean, minBroadcastSize: Int): (Array[Byte],
Broadcast[Array[Byte]]) = {
+ def serializeMapStatuses(
+ statuses: Array[MapStatus],
+ broadcastManager: BroadcastManager,
+ isLocal: Boolean,
+ minBroadcastSize: Int,
+ conf: SparkConf): (Array[Byte], Broadcast[Array[Byte]]) = {
// Using `org.apache.commons.io.output.ByteArrayOutputStream` instead of
the standard one
// This implementation doesn't reallocate the whole memory block but
allocates
// additional buffers. This way no buffers need to be garbage collected and
// the contents don't have to be copied to the new buffer.
val out = new ApacheByteArrayOutputStream()
- val compressedOut = new ApacheByteArrayOutputStream()
-
- val objOut = new ObjectOutputStream(out)
+ out.write(DIRECT)
+ val codec = CompressionCodec.createCodec(conf, "zstd")
Review comment:
cc @zsxwing @cloud-fan
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]