Skip to content

Commit

Permalink
MINOR: [C++][Parquet] Fix some comments and style in Statistics (#33996)
Browse files Browse the repository at this point in the history
### Rationale for this change

Statistics uses some virtual functions in constructor, so here I change it to explicit call rather than implicit virtual fn call. And I also fixed some comments typo

### What changes are included in this PR?

Some code style and comment fix in parquet statistics

### Are these changes tested?

No, and no tests are need.

### Are there any user-facing changes?

no

Authored-by: mwish <maplewish117@gmail.com>
Signed-off-by: Will Jones <willjones127@gmail.com>
  • Loading branch information
mapleFU authored Feb 8, 2023
1 parent 39bad54 commit 3e7b7e0
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions cpp/src/parquet/statistics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ struct BinaryLikeComparer<T, /*is_signed=*/false> {
int a_length = value_length(type_length, a);
int b_length = value_length(type_length, b);
// Unsigned comparison is used for non-numeric types so straight
// lexiographic comparison makes sense. (a.ptr is always unsigned)....
// lexicographic comparison makes sense. (a.ptr is always unsigned)....
return std::lexicographical_compare(a.ptr, a.ptr + a_length, b.ptr, b.ptr + b_length);
}
};
Expand All @@ -186,7 +186,7 @@ struct BinaryLikeComparer<T, /*is_signed=*/true> {
// We can short circuit for different signed numbers or
// for equal length bytes arrays that have different first bytes.
// The equality requirement is necessary for sign extension cases.
// 0xFF10 should be eqaul to 0x10 (due to big endian sign extension).
// 0xFF10 should be equal to 0x10 (due to big endian sign extension).
if ((0x80 & first_a) != (0x80 & first_b) ||
(a_length == b_length && first_a != first_b)) {
return first_a < first_b;
Expand Down Expand Up @@ -228,7 +228,7 @@ struct BinaryLikeComparer<T, /*is_signed=*/true> {
// a must be the lesser value: return true
//
// positive values:
// b is the longer value.
// b is the longer value.
// values in b must be greater than a: return true
// else:
// values in a must be greater than b: return false
Expand Down Expand Up @@ -470,7 +470,7 @@ class TypedStatisticsImpl : public TypedStatistics<DType> {
max_buffer_(AllocateBuffer(pool_, 0)) {
auto comp = Comparator::Make(descr);
comparator_ = std::static_pointer_cast<TypedComparator<DType>>(comp);
Reset();
TypedStatisticsImpl::Reset();
has_null_count_ = true;
has_distinct_count_ = true;
}
Expand All @@ -480,8 +480,8 @@ class TypedStatisticsImpl : public TypedStatistics<DType> {
: pool_(default_memory_pool()),
min_buffer_(AllocateBuffer(pool_, 0)),
max_buffer_(AllocateBuffer(pool_, 0)) {
IncrementNumValues(num_values);
IncrementNullCount(null_count);
TypedStatisticsImpl::IncrementNumValues(num_values);
TypedStatisticsImpl::IncrementNullCount(null_count);
IncrementDistinctCount(distinct_count);

Copy(min, &min_, min_buffer_.get());
Expand All @@ -494,9 +494,9 @@ class TypedStatisticsImpl : public TypedStatistics<DType> {
int64_t null_count, int64_t distinct_count, bool has_min_max,
bool has_null_count, bool has_distinct_count, MemoryPool* pool)
: TypedStatisticsImpl(descr, pool) {
IncrementNumValues(num_values);
TypedStatisticsImpl::IncrementNumValues(num_values);
if (has_null_count_) {
IncrementNullCount(null_count);
TypedStatisticsImpl::IncrementNullCount(null_count);
}
if (has_distinct_count) {
IncrementDistinctCount(distinct_count);
Expand Down

0 comments on commit 3e7b7e0

Please sign in to comment.