MCPcopy Create free account
hub / github.com/apache/arrow / TestMinMaxEncode

Method TestMinMaxEncode

cpp/src/parquet/statistics_test.cc:623–650  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

621
622template <>
623void TestStatistics<ByteArrayType>::TestMinMaxEncode() {
624 this->GenerateData(1000);
625 // Test that we encode min max strings correctly
626 auto statistics1 = MakeStatistics<ByteArrayType>(this->schema_.Column(0));
627 statistics1->Update(this->values_ptr_, this->values_.size(), 0);
628 std::string encoded_min = statistics1->EncodeMin();
629 std::string encoded_max = statistics1->EncodeMax();
630
631 // encoded is same as unencoded
632 ASSERT_EQ(encoded_min,
633 std::string(reinterpret_cast<const char*>(statistics1->min().ptr),
634 statistics1->min().len));
635 ASSERT_EQ(encoded_max,
636 std::string(reinterpret_cast<const char*>(statistics1->max().ptr),
637 statistics1->max().len));
638
639 auto statistics2 = MakeStatistics<ByteArrayType>(
640 this->schema_.Column(0), encoded_min, encoded_max, this->values_.size(),
641 /*null_count=*/0,
642 /*distinct_count=*/0, /*has_min_max=*/true, /*has_null_count=*/true,
643 /*has_distinct_count=*/true, /*is_min_value_exact=*/true,
644 /*is_max_value_exact=*/true);
645
646 ASSERT_EQ(encoded_min, statistics2->EncodeMin());
647 ASSERT_EQ(encoded_max, statistics2->EncodeMax());
648 ASSERT_EQ(statistics1->min(), statistics2->min());
649 ASSERT_EQ(statistics1->max(), statistics2->max());
650}
651
652using Types = ::testing::Types<Int32Type, Int64Type, FloatType, DoubleType, ByteArrayType,
653 FLBAType, BooleanType>;

Callers 1

TYPED_TESTFunction · 0.45

Calls 8

EncodeMinMethod · 0.80
EncodeMaxMethod · 0.80
GenerateDataMethod · 0.45
ColumnMethod · 0.45
UpdateMethod · 0.45
sizeMethod · 0.45
minMethod · 0.45
maxMethod · 0.45

Tested by

no test coverage detected