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

Function AppendArraySlice

cpp/src/arrow/array/builder_nested.h:568–589  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

566 Status AppendEmptyValues(int64_t length) final;
567
568 Status AppendArraySlice(const ArraySpan& array, int64_t offset,
569 int64_t length) override {
570 const auto* offsets = array.GetValues<int32_t>(1);
571 static_assert(internal::may_have_validity_bitmap(MapType::type_id));
572 const uint8_t* validity = array.MayHaveNulls() ? array.buffers[0].data : NULLPTR;
573 for (int64_t row = offset; row < offset + length; row++) {
574 const bool is_valid = !validity || bit_util::GetBit(validity, array.offset + row);
575 if (is_valid) {
576 ARROW_RETURN_NOT_OK(Append());
577 const int64_t slot_length = offsets[row + 1] - offsets[row];
578 // Add together the inner StructArray offset to the Map/List offset
579 int64_t key_value_offset = array.child_data[0].offset + offsets[row];
580 ARROW_RETURN_NOT_OK(key_builder_->AppendArraySlice(
581 array.child_data[0].child_data[0], key_value_offset, slot_length));
582 ARROW_RETURN_NOT_OK(item_builder_->AppendArraySlice(
583 array.child_data[0].child_data[1], key_value_offset, slot_length));
584 } else {
585 ARROW_RETURN_NOT_OK(AppendNull());
586 }
587 }
588 return Status::OK();
589 }
590
591 /// \brief Get builder to append keys.
592 ///

Callers

nothing calls this directly

Calls 9

may_have_validity_bitmapFunction · 0.85
UnsafeAppendToBitmapFunction · 0.85
AppendFunction · 0.70
AppendNullFunction · 0.70
ReserveFunction · 0.70
GetBitFunction · 0.50
OKFunction · 0.50
AppendArraySliceMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected