pitrou commented on code in PR #35808:
URL: https://github.com/apache/arrow/pull/35808#discussion_r1210557387


##########
cpp/src/arrow/filesystem/s3fs.cc:
##########
@@ -1304,27 +1304,43 @@ class ObjectOutputStream final : public 
io::OutputStream {
       return Status::Invalid("Operation on closed stream");
     }
 
-    if (!current_part_ && nbytes >= part_upload_threshold_) {
-      // No current part and data large enough, upload it directly
-      // (without copying if the buffer is owned)
-      RETURN_NOT_OK(UploadPart(data, nbytes, owned_buffer));
-      pos_ += nbytes;
-      return Status::OK();
+    const int8_t* data_ptr = reinterpret_cast<const int8_t*>(data);
+    int64_t offset = 0;
+
+    // Handle case where we have some bytes bufferred from prior calls.
+    if (current_part_size_ > 0) {
+      // Try to fill current buffer
+      const int64_t to_copy =
+          std::min(nbytes - offset, part_upload_threshold_ - 
current_part_size_);

Review Comment:
   If `part_upload_threshold_` isn't a threshold anymore, perhaps rename it and 
make it `const`?



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