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

Method AppendArraySlice

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

Source from the content-addressed store, hash-verified

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