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

Method TestMinMaxEncode

cpp/src/parquet/statistics_test.cc:556–583  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

554
555template <>
556void TestStatistics<ByteArrayType>::TestMinMaxEncode() {
557 this->GenerateData(1000);
558 // Test that we encode min max strings correctly
559 auto statistics1 = MakeStatistics<ByteArrayType>(this->schema_.Column(0));
560 statistics1->Update(this->values_ptr_, this->values_.size(), 0);
561 std::string encoded_min = statistics1->EncodeMin();
562 std::string encoded_max = statistics1->EncodeMax();
563
564 // encoded is same as unencoded
565 ASSERT_EQ(encoded_min,
566 std::string(reinterpret_cast<const char*>(statistics1->min().ptr),
567 statistics1->min().len));
568 ASSERT_EQ(encoded_max,
569 std::string(reinterpret_cast<const char*>(statistics1->max().ptr),
570 statistics1->max().len));
571
572 auto statistics2 = MakeStatistics<ByteArrayType>(
573 this->schema_.Column(0), encoded_min, encoded_max, this->values_.size(),
574 /*null_count=*/0,
575 /*distinct_count=*/0, /*has_min_max=*/true, /*has_null_count=*/true,
576 /*has_distinct_count=*/true, /*is_min_value_exact=*/true,
577 /*is_max_value_exact=*/true);
578
579 ASSERT_EQ(encoded_min, statistics2->EncodeMin());
580 ASSERT_EQ(encoded_max, statistics2->EncodeMax());
581 ASSERT_EQ(statistics1->min(), statistics2->min());
582 ASSERT_EQ(statistics1->max(), statistics2->max());
583}
584
585using Types = ::testing::Types<Int32Type, Int64Type, FloatType, DoubleType, ByteArrayType,
586 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