diff --git a/cpp/src/parquet/arrow/test_util.h b/cpp/src/parquet/arrow/test_util.h index 05f6fd24ac03..2c23e7162bec 100644 --- a/cpp/src/parquet/arrow/test_util.h +++ b/cpp/src/parquet/arrow/test_util.h @@ -141,7 +141,7 @@ ::arrow::enable_if_fixed_size_binary NonNullArray( } template -static void random_decimals(int64_t n, uint32_t seed, int32_t precision, uint8_t* out) { +void random_decimals(int64_t n, uint32_t seed, int32_t precision, uint8_t* out) { auto gen = ::arrow::random::RandomArrayGenerator(seed); std::shared_ptr decimals; if constexpr (byte_width == 4) { diff --git a/cpp/src/parquet/column_reader_test.cc b/cpp/src/parquet/column_reader_test.cc index 87514d87db63..e042f6f1d4d1 100644 --- a/cpp/src/parquet/column_reader_test.cc +++ b/cpp/src/parquet/column_reader_test.cc @@ -48,38 +48,6 @@ using testing::ElementsAre; namespace test { -template -static inline bool vector_equal_with_def_levels(const std::vector& left, - const std::vector& def_levels, - int16_t max_def_levels, - int16_t max_rep_levels, - const std::vector& right) { - size_t i_left = 0; - size_t i_right = 0; - for (size_t i = 0; i < def_levels.size(); i++) { - if (def_levels[i] == max_def_levels) { - // Compare - if (left[i_left] != right[i_right]) { - std::cerr << "index " << i << " left was " << left[i_left] << " right was " - << right[i] << std::endl; - return false; - } - i_left++; - i_right++; - } else if (def_levels[i] == (max_def_levels - 1)) { - // Null entry on the lowest nested level - i_right++; - } else if (def_levels[i] < (max_def_levels - 1)) { - // Null entry on a higher nesting level, only supported for non-repeating data - if (max_rep_levels == 0) { - i_right++; - } - } - } - - return true; -} - class TestPrimitiveReader : public ::testing::Test { public: void InitReader(const ColumnDescriptor* d) { diff --git a/cpp/src/parquet/test_util.h b/cpp/src/parquet/test_util.h index 9271dc290cad..0e1199378b65 100644 --- a/cpp/src/parquet/test_util.h +++ b/cpp/src/parquet/test_util.h @@ -76,8 +76,7 @@ std::string get_bad_data_dir(); std::string get_data_file(const std::string& filename, bool is_good = true); template -static inline void assert_vector_equal(const std::vector& left, - const std::vector& right) { +inline void assert_vector_equal(const std::vector& left, const std::vector& right) { ASSERT_EQ(left.size(), right.size()); for (size_t i = 0; i < left.size(); ++i) { @@ -86,7 +85,7 @@ static inline void assert_vector_equal(const std::vector& left, } template -static inline bool vector_equal(const std::vector& left, const std::vector& right) { +inline bool vector_equal(const std::vector& left, const std::vector& right) { if (left.size() != right.size()) { return false; } @@ -103,7 +102,7 @@ static inline bool vector_equal(const std::vector& left, const std::vector } template -static std::vector slice(const std::vector& values, int start, int end) { +std::vector slice(const std::vector& values, int start, int end) { if (end < start) { return std::vector(0); } @@ -176,21 +175,20 @@ std::shared_ptr EncodeValues(Encoding::type encoding, bool use_dictionar } template -static void InitValues(int num_values, uint32_t seed, std::vector& values, - std::vector& buffer) { +void InitValues(int num_values, uint32_t seed, std::vector& values, + std::vector& buffer) { random_numbers(num_values, seed, std::numeric_limits::min(), std::numeric_limits::max(), values.data()); } template -static void InitValues(int num_values, std::vector& values, - std::vector& buffer) { +void InitValues(int num_values, std::vector& values, std::vector& buffer) { InitValues(num_values, 0, values, buffer); } template -static void InitDictValues(int num_values, int num_dicts, std::vector& values, - std::vector& buffer) { +void InitDictValues(int num_values, int num_dicts, std::vector& values, + std::vector& buffer) { int repeat_factor = num_values / num_dicts; InitValues(num_dicts, values, buffer); // add some repeated values @@ -347,7 +345,7 @@ inline void DataPageBuilder::AppendValues(const ColumnDescriptor* d } template -static std::shared_ptr MakeDataPage( +std::shared_ptr MakeDataPage( const ColumnDescriptor* d, const std::vector& values, int num_vals, Encoding::type encoding, const uint8_t* indices, int indices_size, const std::vector& def_levels, int16_t max_def_level, @@ -441,7 +439,7 @@ inline std::shared_ptr DictionaryPageBuilder::AppendValues( } template -inline static std::shared_ptr MakeDictPage( +inline std::shared_ptr MakeDictPage( const ColumnDescriptor* d, const std::vector& values, const std::vector& values_per_page, Encoding::type encoding, std::vector>& rle_indices) { @@ -463,15 +461,13 @@ inline static std::shared_ptr MakeDictPage( // Given def/rep levels and values create multiple dict pages template -inline static void PaginateDict(const ColumnDescriptor* d, - const std::vector& values, - const std::vector& def_levels, - int16_t max_def_level, - const std::vector& rep_levels, - int16_t max_rep_level, int num_levels_per_page, - const std::vector& values_per_page, - std::vector>& pages, - Encoding::type encoding = Encoding::RLE_DICTIONARY) { +inline void PaginateDict(const ColumnDescriptor* d, + const std::vector& values, + const std::vector& def_levels, int16_t max_def_level, + const std::vector& rep_levels, int16_t max_rep_level, + int num_levels_per_page, const std::vector& values_per_page, + std::vector>& pages, + Encoding::type encoding = Encoding::RLE_DICTIONARY) { int num_pages = static_cast(values_per_page.size()); std::vector> rle_indices; std::shared_ptr dict_page = @@ -501,15 +497,14 @@ inline static void PaginateDict(const ColumnDescriptor* d, // Given def/rep levels and values create multiple plain pages template -static inline void PaginatePlain(const ColumnDescriptor* d, - const std::vector& values, - const std::vector& def_levels, - int16_t max_def_level, - const std::vector& rep_levels, - int16_t max_rep_level, int num_levels_per_page, - const std::vector& values_per_page, - std::vector>& pages, - Encoding::type encoding = Encoding::PLAIN) { +inline void PaginatePlain(const ColumnDescriptor* d, + const std::vector& values, + const std::vector& def_levels, int16_t max_def_level, + const std::vector& rep_levels, int16_t max_rep_level, + int num_levels_per_page, + const std::vector& values_per_page, + std::vector>& pages, + Encoding::type encoding = Encoding::PLAIN) { int num_pages = static_cast(values_per_page.size()); int def_level_start = 0; int def_level_end = 0; @@ -537,14 +532,12 @@ static inline void PaginatePlain(const ColumnDescriptor* d, // Generates pages from randomly generated data template -static inline int MakePages(const ColumnDescriptor* d, int num_pages, int levels_per_page, - std::vector& def_levels, - std::vector& rep_levels, - std::vector& values, - std::vector& buffer, - std::vector>& pages, - Encoding::type encoding = Encoding::PLAIN, - uint32_t seed = 0) { +inline int MakePages(const ColumnDescriptor* d, int num_pages, int levels_per_page, + std::vector& def_levels, std::vector& rep_levels, + std::vector& values, + std::vector& buffer, + std::vector>& pages, + Encoding::type encoding = Encoding::PLAIN, uint32_t seed = 0) { int num_levels = levels_per_page * num_pages; int num_values = 0; int16_t zero = 0;