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

Method AppendArraySlice

cpp/src/arrow/array/builder_binary.cc:52–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50 : BinaryViewBuilder(pool) {}
51
52Status BinaryViewBuilder::AppendArraySlice(const ArraySpan& array, int64_t offset,
53 int64_t length) {
54 auto bitmap = array.GetValues<uint8_t>(0, 0);
55 auto values = array.GetValues<BinaryViewType::c_type>(1) + offset;
56
57 int64_t out_of_line_total = 0, i = 0;
58 VisitNullBitmapInline(
59 array.buffers[0].data, array.offset + offset, length, array.null_count,
60 [&] {
61 if (!values[i].is_inline()) {
62 out_of_line_total += static_cast<int64_t>(values[i].size());
63 }
64 ++i;
65 },
66 [&] { ++i; });
67
68 RETURN_NOT_OK(Reserve(length));
69 RETURN_NOT_OK(ReserveData(out_of_line_total));
70
71 for (int64_t i = 0; i < length; i++) {
72 if (bitmap && !bit_util::GetBit(bitmap, array.offset + offset + i)) {
73 UnsafeAppendNull();
74 continue;
75 }
76
77 UnsafeAppend(util::FromBinaryView(values[i], array.GetVariadicBuffers().data()));
78 }
79 return Status::OK();
80}
81
82Status BinaryViewBuilder::FinishInternal(std::shared_ptr<ArrayData>* out) {
83 ARROW_ASSIGN_OR_RAISE(auto null_bitmap, null_bitmap_builder_.FinishWithLength(length_));

Callers

nothing calls this directly

Calls 11

VisitNullBitmapInlineFunction · 0.85
ReserveDataFunction · 0.85
FromBinaryViewFunction · 0.85
GetVariadicBuffersMethod · 0.80
ReserveFunction · 0.70
UnsafeAppendNullFunction · 0.70
UnsafeAppendFunction · 0.70
GetBitFunction · 0.50
OKFunction · 0.50
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected