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

Function FillZeroLengthArray

cpp/src/arrow/array/data.cc:384–414  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

382namespace internal {
383
384void FillZeroLengthArray(const DataType* type, ArraySpan* span) {
385 span->type = type;
386 span->length = 0;
387 int num_buffers = GetNumBuffers(*type);
388 for (int i = 0; i < num_buffers; ++i) {
389 alignas(int64_t) static std::array<uint8_t, sizeof(int64_t) * 2> kZeros{0};
390 span->buffers[i].data = kZeros.data();
391 span->buffers[i].size = 0;
392 }
393
394 if (!may_have_validity_bitmap(type->id())) {
395 span->buffers[0] = {};
396 }
397
398 for (int i = num_buffers; i < 3; ++i) {
399 span->buffers[i] = {};
400 }
401
402 if (type->id() == Type::DICTIONARY) {
403 span->child_data.resize(1);
404 const std::shared_ptr<DataType>& value_type =
405 checked_cast<const DictionaryType*>(type)->value_type();
406 FillZeroLengthArray(value_type.get(), &span->child_data[0]);
407 } else {
408 // Fill children
409 span->child_data.resize(type->num_fields());
410 for (int i = 0; i < type->num_fields(); ++i) {
411 FillZeroLengthArray(type->field(i)->type().get(), &span->child_data[i]);
412 }
413 }
414}
415
416} // namespace internal
417

Callers 2

FillFromScalarMethod · 0.85
NextMethod · 0.85

Calls 10

GetNumBuffersFunction · 0.85
may_have_validity_bitmapFunction · 0.85
resizeMethod · 0.80
dataMethod · 0.45
idMethod · 0.45
value_typeMethod · 0.45
getMethod · 0.45
num_fieldsMethod · 0.45
typeMethod · 0.45
fieldMethod · 0.45

Tested by

no test coverage detected