coderex2522 commented on code in PR #1275:
URL: https://github.com/apache/orc/pull/1275#discussion_r1004086464


##########
c++/src/io/OutputStream.cc:
##########
@@ -95,9 +91,30 @@ namespace orc {
 
   uint64_t BufferedOutputStream::flush() {
     uint64_t dataSize = dataBuffer->size();
+    // flush data buffer into outputStream
+    if (dataBuffer->getBlockNumber() > 0)
     {
-      SCOPED_STOPWATCH(metrics, IOBlockingLatencyUs, IOCount);
-      outputStream->write(dataBuffer->data(), dataSize);
+      uint64_t ioCount = 0;
+      SCOPED_STOPWATCH(metrics, IOBlockingLatencyUs, nullptr);
+      // try to merge adjacent IO requests
+      BlockBuffer::Block mergeBlock = dataBuffer->getBlock(0);
+      for (uint64_t i = 1; i < dataBuffer->getBlockNumber(); ++i) {
+        auto curBlock = dataBuffer->getBlock(i);
+        if (mergeBlock.data + mergeBlock.size == curBlock.data) {

Review Comment:
   High probability of not happening. So remove this logic.



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