| 621 | |
| 622 | template <> |
| 623 | void 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 | |
| 652 | using Types = ::testing::Types<Int32Type, Int64Type, FloatType, DoubleType, ByteArrayType, |
| 653 | FLBAType, BooleanType>; |
no test coverage detected