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

Method Plain

cpp/src/parquet/encoding_test.cc:922–955  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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> &&

Callers 1

TYPED_TESTFunction · 0.80

Calls 15

GetValuesFunction · 0.85
EXPECT_OK_AND_ASSIGNFunction · 0.85
ConcatenateFunction · 0.85
default_memory_poolFunction · 0.85
AssertArraysEqualFunction · 0.85
SliceMethod · 0.45
PutMethod · 0.45
FlushValuesMethod · 0.45
SetDataMethod · 0.45
lengthMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected