From f87e0c8acd07ff5637bb986ce1a48c73fb577582 Mon Sep 17 00:00:00 2001 From: mwish Date: Fri, 24 Nov 2023 21:03:54 +0800 Subject: [PATCH] Minor: making filter const --- cpp/src/parquet/statistics.cc | 14 +++++++------- cpp/src/parquet/statistics.h | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cpp/src/parquet/statistics.cc b/cpp/src/parquet/statistics.cc index 37b245e0dd6c2..e54b94f1a861a 100644 --- a/cpp/src/parquet/statistics.cc +++ b/cpp/src/parquet/statistics.cc @@ -438,9 +438,9 @@ class TypedComparatorImpl return Helper::Compare(type_length_, a, b); } - bool Compare(const T& a, const T& b) override { return CompareInline(a, b); } + bool Compare(const T& a, const T& b) const override { return CompareInline(a, b); } - std::pair GetMinMax(const T* values, int64_t length) override { + std::pair GetMinMax(const T* values, int64_t length) const override { DCHECK_GT(length, 0); T min = Helper::DefaultMin(); @@ -457,7 +457,7 @@ class TypedComparatorImpl std::pair GetMinMaxSpaced(const T* values, int64_t length, const uint8_t* valid_bits, - int64_t valid_bits_offset) override { + int64_t valid_bits_offset) const override { DCHECK_GT(length, 0); T min = Helper::DefaultMin(); @@ -477,7 +477,7 @@ class TypedComparatorImpl return {min, max}; } - std::pair GetMinMax(const ::arrow::Array& values) override { + std::pair GetMinMax(const ::arrow::Array& values) const override { ParquetException::NYI(values.type()->ToString()); } @@ -491,7 +491,7 @@ class TypedComparatorImpl template <> std::pair TypedComparatorImpl::GetMinMax(const int32_t* values, - int64_t length) { + int64_t length) const { DCHECK_GT(length, 0); const uint32_t* unsigned_values = reinterpret_cast(values); @@ -537,13 +537,13 @@ std::pair GetMinMaxBinaryHelper( template <> std::pair TypedComparatorImpl::GetMinMax( - const ::arrow::Array& values) { + const ::arrow::Array& values) const { return GetMinMaxBinaryHelper(*this, values); } template <> std::pair TypedComparatorImpl::GetMinMax( - const ::arrow::Array& values) { + const ::arrow::Array& values) const { return GetMinMaxBinaryHelper(*this, values); } diff --git a/cpp/src/parquet/statistics.h b/cpp/src/parquet/statistics.h index ae6c1ca29b2f6..6730e6bcdc1e0 100644 --- a/cpp/src/parquet/statistics.h +++ b/cpp/src/parquet/statistics.h @@ -73,16 +73,16 @@ class TypedComparator : public Comparator { /// \brief Scalar comparison of two elements, return true if first /// is strictly less than the second - virtual bool Compare(const T& a, const T& b) = 0; + virtual bool Compare(const T& a, const T& b) const = 0; /// \brief Compute maximum and minimum elements in a batch of /// elements without any nulls - virtual std::pair GetMinMax(const T* values, int64_t length) = 0; + virtual std::pair GetMinMax(const T* values, int64_t length) const = 0; /// \brief Compute minimum and maximum elements from an Arrow array. Only /// valid for certain Parquet Type / Arrow Type combinations, like BYTE_ARRAY /// / arrow::BinaryArray - virtual std::pair GetMinMax(const ::arrow::Array& values) = 0; + virtual std::pair GetMinMax(const ::arrow::Array& values) const = 0; /// \brief Compute maximum and minimum elements in a batch of /// elements with accompanying bitmap indicating which elements are @@ -96,7 +96,7 @@ class TypedComparator : public Comparator { /// the first element in the sequence virtual std::pair GetMinMaxSpaced(const T* values, int64_t length, const uint8_t* valid_bits, - int64_t valid_bits_offset) = 0; + int64_t valid_bits_offset) const = 0; }; /// \brief Typed version of Comparator::Make