This is an automated email from the ASF dual-hosted git repository.
gangwu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/orc.git
The following commit(s) were added to refs/heads/main by this push:
new 7c8392564 ORC-1480: [C++] Fix build break w/
BUILD_CPP_ENABLE_METRICS=ON
7c8392564 is described below
commit 7c839256470690b6b1a415a784bd924236c426a4
Author: Gang Wu <[email protected]>
AuthorDate: Fri Nov 3 13:41:23 2023 +0800
ORC-1480: [C++] Fix build break w/ BUILD_CPP_ENABLE_METRICS=ON
### What changes were proposed in this pull request?
Pass IOCount to SCOPED_STOPWATCH when counting I/Os.
### Why are the changes needed?
SCOPED_STOPWATCH macro was not correctly called when counting I/Os. This
breaks build when BUILD_CPP_ENABLE_METRICS is set to ON and fails the unit test
as well.
### How was this patch tested?
Failed test cases are fixed and all cases pass.
Closes #1646 from wgtmac/ORC-1480.
Authored-by: Gang Wu <[email protected]>
Signed-off-by: Gang Wu <[email protected]>
---
c++/src/io/OutputStream.cc | 2 +-
c++/test/TestBufferedOutputStream.cc | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/c++/src/io/OutputStream.cc b/c++/src/io/OutputStream.cc
index 118a66471..ac5339c64 100644
--- a/c++/src/io/OutputStream.cc
+++ b/c++/src/io/OutputStream.cc
@@ -87,7 +87,7 @@ namespace orc {
uint64_t dataSize = dataBuffer->size();
// flush data buffer into outputStream
if (dataSize > 0) {
- SCOPED_STOPWATCH(metrics, IOBlockingLatencyUs, nullptr);
+ SCOPED_STOPWATCH(metrics, IOBlockingLatencyUs, IOCount);
dataBuffer->writeTo(outputStream, metrics);
}
dataBuffer->resize(0);
diff --git a/c++/test/TestBufferedOutputStream.cc
b/c++/test/TestBufferedOutputStream.cc
index 4cb70007b..6735ac43d 100644
--- a/c++/test/TestBufferedOutputStream.cc
+++ b/c++/test/TestBufferedOutputStream.cc
@@ -46,7 +46,7 @@ namespace orc {
EXPECT_EQ(memStream.getData()[i], 'a' + i % 10);
}
#if ENABLE_METRICS
- EXPECT_EQ(metrics.IOCount.load(), 1);
+ EXPECT_EQ(metrics.IOCount.load(), 2);
#endif
}
@@ -95,7 +95,7 @@ namespace orc {
EXPECT_EQ(memStream.getData()[i + 7], 'a' + i);
}
#if ENABLE_METRICS
- EXPECT_EQ(metrics.IOCount.load(), 2);
+ EXPECT_EQ(metrics.IOCount.load(), 4);
#endif
}