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

Method Dict

cpp/src/parquet/encoding_test.cc:1047–1077  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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) {

Callers 1

TYPED_TESTFunction · 0.80

Calls 12

GetValuesFunction · 0.85
GetDictDecoderFunction · 0.85
default_memory_poolFunction · 0.85
AssertArraysEqualFunction · 0.85
getMethod · 0.45
PutMethod · 0.45
lengthMethod · 0.45
null_countMethod · 0.45
DecodeArrowMethod · 0.45
offsetMethod · 0.45
FinishMethod · 0.45
ValidateFullMethod · 0.45

Tested by

no test coverage detected