SteNicholas commented on code in PR #3575:
URL: https://github.com/apache/celeborn/pull/3575#discussion_r2706673880


##########
cpp/celeborn/client/ShuffleClient.cpp:
##########
@@ -154,23 +160,37 @@ int ShuffleClientImpl::pushData(
   auto pushState = getPushState(mapKey);
   const int nextBatchId = pushState->nextBatchId();
 
-  // TODO: compression in writing is not supported.
+  // Compression support: compress data if compression is enabled
+  const uint8_t* dataToWrite = data + offset;
+  size_t lengthToWrite = length;
+  std::unique_ptr<uint8_t[]> compressedBuffer;
+
+  if (shuffleCompressionEnabled_ && compressor_) {
+    // Allocate buffer for compressed data
+    const size_t compressedCapacity = compressor_->getDstCapacity(length);
+    compressedBuffer = std::make_unique<uint8_t[]>(compressedCapacity);
+
+    // Compress the data
+    lengthToWrite =
+        compressor_->compress(data, offset, length, compressedBuffer.get(), 0);
+    dataToWrite = compressedBuffer.get();

Review Comment:
   Should `offset` set to zero?



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

Reply via email to