Skip to content

Commit

Permalink
apply clang-format to fix linter error
Browse files Browse the repository at this point in the history
  • Loading branch information
dongjoon-hyun committed Dec 9, 2023
1 parent 494259c commit f6d48dd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 19 deletions.
32 changes: 17 additions & 15 deletions c++/src/Reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,8 @@ namespace orc {
}
if (footer->row_index_stride() > 0) {
numRowGroupsInStripeRange +=
(stripeInfo.number_of_rows() + footer->row_index_stride() - 1) / footer->row_index_stride();
(stripeInfo.number_of_rows() + footer->row_index_stride() - 1) /
footer->row_index_stride();
}
}
}
Expand All @@ -305,9 +306,9 @@ namespace orc {
// prepare SargsApplier if SearchArgument is available
if (opts.getSearchArgument() && footer->row_index_stride() > 0) {
sargs = opts.getSearchArgument();
sargsApplier.reset(new SargsApplier(*contents->schema, sargs.get(), footer->row_index_stride(),
getWriterVersionImpl(_contents.get()),
contents->readerMetrics));
sargsApplier.reset(
new SargsApplier(*contents->schema, sargs.get(), footer->row_index_stride(),
getWriterVersionImpl(_contents.get()), contents->readerMetrics));
}

skipBloomFilters = hasBadBloomFilters();
Expand Down Expand Up @@ -412,8 +413,8 @@ namespace orc {
if (sargsApplier) {
// advance to selected row group if predicate pushdown is enabled
currentRowInStripe =
advanceToNextRowGroup(currentRowInStripe, rowsInCurrentStripe, footer->row_index_stride(),
sargsApplier->getNextSkippedRows());
advanceToNextRowGroup(currentRowInStripe, rowsInCurrentStripe,
footer->row_index_stride(), sargsApplier->getNextSkippedRows());
}
}

Expand Down Expand Up @@ -1087,9 +1088,10 @@ namespace orc {

if (currentStripe < lastStripe) {
// get writer timezone info from stripe footer to help understand timestamp values.
const Timezone& writerTimezone = currentStripeFooter.has_writer_timezone()
? getTimezoneByName(currentStripeFooter.writer_timezone())
: localTimezone;
const Timezone& writerTimezone =
currentStripeFooter.has_writer_timezone()
? getTimezoneByName(currentStripeFooter.writer_timezone())
: localTimezone;
StripeStreamsImpl stripeStreams(*this, currentStripe, currentStripeInfo, currentStripeFooter,
currentStripeInfo.offset(), *contents->stream, writerTimezone,
readerTimezone);
Expand All @@ -1099,8 +1101,8 @@ namespace orc {
if (sargsApplier) {
// move to the 1st selected row group when PPD is enabled.
currentRowInStripe =
advanceToNextRowGroup(currentRowInStripe, rowsInCurrentStripe, footer->row_index_stride(),
sargsApplier->getNextSkippedRows());
advanceToNextRowGroup(currentRowInStripe, rowsInCurrentStripe,
footer->row_index_stride(), sargsApplier->getNextSkippedRows());
previousRow = firstRowOfStripe[currentStripe] + currentRowInStripe - 1;
if (currentRowInStripe > 0) {
seekToRowGroup(static_cast<uint32_t>(currentRowInStripe / footer->row_index_stride()));
Expand Down Expand Up @@ -1339,10 +1341,10 @@ namespace orc {
MemoryPool& memoryPool, ReaderMetrics* readerMetrics) {
const char* footerPtr = buffer->data() + footerOffset;

std::unique_ptr<SeekableInputStream> pbStream =
createDecompressor(convertCompressionKind(ps),
std::make_unique<SeekableArrayInputStream>(footerPtr, ps.footer_length()),
getCompressionBlockSize(ps), memoryPool, readerMetrics);
std::unique_ptr<SeekableInputStream> pbStream = createDecompressor(
convertCompressionKind(ps),
std::make_unique<SeekableArrayInputStream>(footerPtr, ps.footer_length()),
getCompressionBlockSize(ps), memoryPool, readerMetrics);

auto footer = std::make_unique<proto::Footer>();
if (!footer->ParseFromZeroCopyStream(pbStream.get())) {
Expand Down
12 changes: 8 additions & 4 deletions c++/src/sargs/PredicateLeaf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -550,13 +550,16 @@ namespace orc {
break;
}
case PredicateDataType::TIMESTAMP: {
if (colStats.has_timestamp_statistics() && colStats.timestamp_statistics().has_minimum_utc() &&
if (colStats.has_timestamp_statistics() &&
colStats.timestamp_statistics().has_minimum_utc() &&
colStats.timestamp_statistics().has_maximum_utc()) {
const auto& stats = colStats.timestamp_statistics();
constexpr int32_t DEFAULT_MIN_NANOS = 0;
constexpr int32_t DEFAULT_MAX_NANOS = 999999;
int32_t minNano = stats.has_minimum_nanos() ? stats.minimum_nanos() - 1 : DEFAULT_MIN_NANOS;
int32_t maxNano = stats.has_maximum_nanos() ? stats.maximum_nanos() - 1 : DEFAULT_MAX_NANOS;
int32_t minNano =
stats.has_minimum_nanos() ? stats.minimum_nanos() - 1 : DEFAULT_MIN_NANOS;
int32_t maxNano =
stats.has_maximum_nanos() ? stats.maximum_nanos() - 1 : DEFAULT_MAX_NANOS;
Literal::Timestamp minTimestamp(
stats.minimum_utc() / 1000,
static_cast<int32_t>((stats.minimum_utc() % 1000) * 1000000) + minNano);
Expand Down Expand Up @@ -703,7 +706,8 @@ namespace orc {
((mOperator == Operator::EQUALS || mOperator == Operator::NULL_SAFE_EQUALS) &&
mLiterals.at(0).isNull())) {
// IS_NULL operator does not need to check min/max stats and bloom filter
return allNull ? TruthValue::YES : (colStats.has_null() ? TruthValue::YES_NO : TruthValue::NO);
return allNull ? TruthValue::YES
: (colStats.has_null() ? TruthValue::YES_NO : TruthValue::NO);
} else if (allNull) {
// if we don't have any value, everything must have been null
return TruthValue::IS_NULL;
Expand Down

0 comments on commit f6d48dd

Please sign in to comment.