| 1045 | } |
| 1046 | |
| 1047 | void Dict(int seed) { |
| 1048 | if (std::is_same<ParquetType, BooleanType>::value) { |
| 1049 | return; |
| 1050 | } |
| 1051 | |
| 1052 | auto values = GetValues(seed); |
| 1053 | |
| 1054 | auto owned_encoder = |
| 1055 | MakeTypedEncoder<ParquetType>(Encoding::PLAIN, |
| 1056 | /*use_dictionary=*/true, column_descr()); |
| 1057 | auto encoder = dynamic_cast<DictEncoder<ParquetType>*>(owned_encoder.get()); |
| 1058 | |
| 1059 | ASSERT_NO_THROW(encoder->Put(*values)); |
| 1060 | |
| 1061 | std::shared_ptr<Buffer> buf, dict_buf; |
| 1062 | int num_values = static_cast<int>(values->length() - values->null_count()); |
| 1063 | |
| 1064 | std::unique_ptr<TypedDecoder<ParquetType>> decoder; |
| 1065 | GetDictDecoder(encoder, num_values, &buf, &dict_buf, column_descr(), &decoder); |
| 1066 | |
| 1067 | BuilderType acc(arrow_type(), ::arrow::default_memory_pool()); |
| 1068 | ASSERT_EQ(num_values, |
| 1069 | decoder->DecodeArrow(static_cast<int>(values->length()), |
| 1070 | static_cast<int>(values->null_count()), |
| 1071 | values->null_bitmap_data(), values->offset(), &acc)); |
| 1072 | |
| 1073 | std::shared_ptr<::arrow::Array> result; |
| 1074 | ASSERT_OK(acc.Finish(&result)); |
| 1075 | ASSERT_OK(result->ValidateFull()); |
| 1076 | ::arrow::AssertArraysEqual(*values, *result); |
| 1077 | } |
| 1078 | |
| 1079 | void DictPutIndices() { |
| 1080 | if (std::is_same<ParquetType, BooleanType>::value) { |
no test coverage detected