| 920 | static std::shared_ptr<::arrow::DataType> arrow_type(); |
| 921 | |
| 922 | void Plain(int seed, int rounds = 1, int offset = 0) { |
| 923 | auto random_array = GetValues(seed)->Slice(offset); |
| 924 | auto encoder = MakeTypedEncoder<ParquetType>( |
| 925 | Encoding::PLAIN, /*use_dictionary=*/false, column_descr()); |
| 926 | auto decoder = MakeTypedDecoder<ParquetType>(Encoding::PLAIN, column_descr()); |
| 927 | |
| 928 | for (int i = 0; i < rounds; ++i) { |
| 929 | ASSERT_NO_THROW(encoder->Put(*random_array)); |
| 930 | } |
| 931 | std::shared_ptr<::arrow::Array> values; |
| 932 | if (rounds == 1) { |
| 933 | values = random_array; |
| 934 | } else { |
| 935 | ::arrow::ArrayVector arrays(rounds, random_array); |
| 936 | EXPECT_OK_AND_ASSIGN(values, |
| 937 | ::arrow::Concatenate(arrays, ::arrow::default_memory_pool())); |
| 938 | } |
| 939 | auto buf = encoder->FlushValues(); |
| 940 | |
| 941 | decoder->SetData(static_cast<int>(values->length()), buf->data(), |
| 942 | static_cast<int>(buf->size())); |
| 943 | |
| 944 | BuilderType acc(arrow_type(), ::arrow::default_memory_pool()); |
| 945 | ASSERT_EQ(static_cast<int>(values->length() - values->null_count()), |
| 946 | decoder->DecodeArrow(static_cast<int>(values->length()), |
| 947 | static_cast<int>(values->null_count()), |
| 948 | values->null_bitmap_data(), values->offset(), &acc)); |
| 949 | |
| 950 | std::shared_ptr<::arrow::Array> result; |
| 951 | ASSERT_OK(acc.Finish(&result)); |
| 952 | ASSERT_OK(result->ValidateFull()); |
| 953 | ASSERT_EQ(values->length(), result->length()); |
| 954 | ::arrow::AssertArraysEqual(*values, *result, /*verbose=*/true); |
| 955 | } |
| 956 | |
| 957 | void ByteStreamSplit(int seed) { |
| 958 | if constexpr (!std::is_same_v<ParquetType, FloatType> && |
no test coverage detected