Skip to content

Commit

Permalink
ORC-1706: [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?
1. Fix build break w/ BUILD_CPP_ENABLE_METRICS=ON
2. Add -DBUILD_CPP_ENABLE_METRICS=ON on format check actions.
3. Fix a typo on README file name.

### Why are the changes needed?
C++ build breaks when the option BUILD_CPP_ENABLE_METRICS is switched on.

### How was this patch tested?
UT passed.

### Was this patch authored or co-authored using generative AI tooling?
NO

Closes #1915 from ffacs/ORC-1706.

Authored-by: ffacs <ffacs@[email protected]>
Signed-off-by: Gang Wu <[email protected]>
  • Loading branch information
ffacs authored and wgtmac committed Apr 27, 2024
1 parent 3bf6ea9 commit f919fab
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ jobs:
run: |
mkdir build
cd build
cmake .. -DBUILD_JAVA=OFF -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DSTOP_BUILD_ON_WARNING=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=1
cmake .. -DBUILD_JAVA=OFF -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DSTOP_BUILD_ON_WARNING=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DBUILD_CPP_ENABLE_METRICS=1
make
- name: Check clang-tidy
run: cd build && make check-clang-tidy
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion c++/src/OrcFile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ namespace orc {
}

void read(void* buf, uint64_t length, uint64_t offset) override {
SCOPED_STOPWATCH(metrics, IOBlockingLatencyUs, IOCount);
SCOPED_STOPWATCH(metrics_, IOBlockingLatencyUs, IOCount);
if (!buf) {
throw ParseError("Buffer is null");
}
Expand Down
2 changes: 1 addition & 1 deletion c++/src/Reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1117,7 +1117,7 @@ namespace orc {
}

bool RowReaderImpl::next(ColumnVectorBatch& data) {
SCOPED_STOPWATCH(contents->readerMetrics, ReaderInclusiveLatencyUs, ReaderCall);
SCOPED_STOPWATCH(contents_->readerMetrics, ReaderInclusiveLatencyUs, ReaderCall);
if (currentStripe_ >= lastStripe_) {
data.numElements = 0;
markEndOfFile();
Expand Down
4 changes: 2 additions & 2 deletions c++/src/Writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ namespace orc {
// Write file header
const static size_t magicIdLength = strlen(WriterImpl::magicId);
{
SCOPED_STOPWATCH(options.getWriterMetrics(), IOBlockingLatencyUs, IOCount);
SCOPED_STOPWATCH(options_.getWriterMetrics(), IOBlockingLatencyUs, IOCount);
outStream_->write(WriterImpl::magicId, magicIdLength);
}
currentOffset_ += magicIdLength;
Expand Down Expand Up @@ -585,7 +585,7 @@ namespace orc {
throw std::logic_error("Failed to write post script.");
}
unsigned char psLength = static_cast<unsigned char>(bufferedStream_->flush());
SCOPED_STOPWATCH(options.getWriterMetrics(), IOBlockingLatencyUs, IOCount);
SCOPED_STOPWATCH(options_.getWriterMetrics(), IOBlockingLatencyUs, IOCount);
outStream_->write(&psLength, sizeof(unsigned char));
}

Expand Down
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, IOCount);
SCOPED_STOPWATCH(metrics_, IOBlockingLatencyUs, IOCount);
dataBuffer_->writeTo(outputStream_, metrics_);
}
dataBuffer_->resize(0);
Expand Down

0 comments on commit f919fab

Please sign in to comment.