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

Method AppendArraySlice

cpp/src/arrow/array/builder_binary.h:286–304  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284 }
285
286 Status AppendArraySlice(const ArraySpan& array, int64_t offset,
287 int64_t length) override {
288 auto bitmap = array.GetValues<uint8_t>(0, 0);
289 auto offsets = array.GetValues<offset_type>(1);
290 auto data = array.GetValues<uint8_t>(2, 0);
291 auto total_length = offsets[offset + length] - offsets[offset];
292 ARROW_RETURN_NOT_OK(Reserve(length));
293 ARROW_RETURN_NOT_OK(ReserveData(total_length));
294 for (int64_t i = 0; i < length; i++) {
295 if (!bitmap || bit_util::GetBit(bitmap, array.offset + offset + i)) {
296 const offset_type start = offsets[offset + i];
297 const offset_type end = offsets[offset + i + 1];
298 UnsafeAppend(data + start, end - start);
299 } else {
300 UnsafeAppendNull();
301 }
302 }
303 return Status::OK();
304 }
305
306 void Reset() override {
307 ArrayBuilder::Reset();

Callers

nothing calls this directly

Calls 6

ReserveDataFunction · 0.85
ReserveFunction · 0.70
UnsafeAppendFunction · 0.70
UnsafeAppendNullFunction · 0.70
GetBitFunction · 0.50
OKFunction · 0.50

Tested by

no test coverage detected