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

Function GenerateArray

cpp/src/parquet/chunker_internal_test.cc:77–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75
76template <typename BuilderType, typename ValueFunc>
77Result<std::shared_ptr<Array>> GenerateArray(const std::shared_ptr<DataType>& type,
78 bool nullable, int64_t length, uint64_t seed,
79 ValueFunc value_func) {
80 BuilderType builder(type, default_memory_pool());
81
82 if (nullable) {
83 for (int64_t i = 0; i < length; ++i) {
84 uint64_t val = hash(seed, i);
85 if (val % 10 == 0) {
86 RETURN_NOT_OK(builder.AppendNull());
87 } else {
88 RETURN_NOT_OK(builder.Append(value_func(val)));
89 }
90 }
91 } else {
92 for (int64_t i = 0; i < length; ++i) {
93 uint64_t val = hash(seed, i);
94 RETURN_NOT_OK(builder.Append(value_func(val)));
95 }
96 }
97
98 std::shared_ptr<Array> array;
99 RETURN_NOT_OK(builder.Finish(&array));
100 RETURN_NOT_OK(array->ValidateFull());
101 return array;
102}
103
104#define GENERATE_CASE(TYPE_ID, BUILDER_TYPE, VALUE_EXPR) \
105 case ::arrow::Type::TYPE_ID: { \

Callers 1

TESTFunction · 0.70

Calls 15

default_memory_poolFunction · 0.85
hashFunction · 0.85
to_stringFunction · 0.85
nullableMethod · 0.80
substrMethod · 0.80
push_backMethod · 0.80
storage_typeMethod · 0.80
Decimal128Class · 0.50
Decimal256Class · 0.50
InvalidFunction · 0.50
fieldFunction · 0.50

Tested by

no test coverage detected