Skip to content

Commit

Permalink
ORC-1480: [C++] Fix build break w/ BUILD_CPP_ENABLE_METRICS=ON
Browse files Browse the repository at this point in the history
### 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 <ustcwg@gmail.com>
Signed-off-by: Gang Wu <ustcwg@gmail.com>
(cherry picked from commit 7c83925)
Signed-off-by: Gang Wu <ustcwg@gmail.com>
  • Loading branch information
wgtmac committed Nov 3, 2023
1 parent 3487615 commit ab41bbb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion c++/src/io/OutputStream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions c++/test/TestBufferedOutputStream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit ab41bbb

Please sign in to comment.