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

Method Extend

cpp/src/arrow/util/converter.h:313–343  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

311 }
312
313 Status Extend(InputType values, int64_t size, int64_t offset = 0) {
314 while (offset < size) {
315 auto length_before = converter_->builder()->length();
316 auto status = converter_->Extend(values, size, offset);
317 auto length_after = converter_->builder()->length();
318 auto num_converted = length_after - length_before;
319
320 offset += num_converted;
321 length_ += num_converted;
322
323 if (status.IsCapacityError()) {
324 if (converter_->builder()->length() == 0) {
325 // Builder length == 0 means the individual element is too large to append.
326 // In this case, no need to try again.
327 return status;
328 } else if (converter_->rewind_on_overflow()) {
329 // The list-like and binary-like conversion paths may raise a capacity error,
330 // we need to handle them differently. While the binary-like converters check
331 // the capacity before append/extend the list-like converters just check after
332 // append/extend. Thus depending on the implementation semantics we may need
333 // to rewind (slice) the output chunk by one.
334 length_ -= 1;
335 offset -= 1;
336 }
337 ARROW_RETURN_NOT_OK(FinishChunk());
338 } else if (!status.ok()) {
339 return status;
340 }
341 }
342 return Status::OK();
343 }
344
345 Status ExtendMasked(InputType values, InputType mask, int64_t size,
346 int64_t offset = 0) {

Callers

nothing calls this directly

Calls 5

rewind_on_overflowMethod · 0.80
OKFunction · 0.50
lengthMethod · 0.45
builderMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected