Skip to content

Commit

Permalink
Add test for ColumnIndex/BoundaryOrder
Browse files Browse the repository at this point in the history
  • Loading branch information
benibus committed Nov 13, 2023
1 parent c8404bb commit 157e0d7
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions cpp/src/parquet/page_index_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <memory>

#include "arrow/io/file.h"
#include "arrow/util/float16.h"
#include "parquet/file_reader.h"
#include "parquet/metadata.h"
#include "parquet/schema.h"
Expand Down Expand Up @@ -579,6 +580,27 @@ TEST(PageIndex, WriteFLBAColumnIndex) {
/*has_null_counts=*/false);
}

TEST(PageIndex, WriteFloat16ColumnIndex) {
using ::arrow::util::Float16;
auto encode = [](auto value) {
auto bytes = Float16(value).ToLittleEndian();
return std::string(reinterpret_cast<const char*>(bytes.data()), bytes.size());
};

// Float16 (FLBA) values in the ascending order and without null count.
std::vector<EncodedStatistics> page_stats(4);
page_stats.at(0).set_min(encode(-1.3)).set_max(encode(+3.6));
page_stats.at(1).set_min(encode(-0.2)).set_max(encode(+4.5));
page_stats.at(2).set_min(encode(+1.1)).set_max(encode(+5.4));
page_stats.at(3).set_min(encode(+2.0)).set_max(encode(+6.3));

auto node = schema::PrimitiveNode::Make(
"c1", Repetition::OPTIONAL, LogicalType::Float16(), Type::FIXED_LEN_BYTE_ARRAY,
/*length=*/2);
TestWriteTypedColumnIndex(std::move(node), page_stats, BoundaryOrder::Ascending,
/*has_null_counts=*/false);
}

TEST(PageIndex, WriteColumnIndexWithAllNullPages) {
// All values are null.
std::vector<EncodedStatistics> page_stats(3);
Expand Down

0 comments on commit 157e0d7

Please sign in to comment.