| 554 | |
| 555 | template <> |
| 556 | void 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 | |
| 585 | using Types = ::testing::Types<Int32Type, Int64Type, FloatType, DoubleType, ByteArrayType, |
| 586 | FLBAType, BooleanType>; |
no test coverage detected