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

Method ExtendMasked

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

Source from the content-addressed store, hash-verified

343 }
344
345 Status ExtendMasked(InputType values, InputType mask, int64_t size,
346 int64_t offset = 0) {
347 while (offset < size) {
348 auto length_before = converter_->builder()->length();
349 auto status = converter_->ExtendMasked(values, mask, size, offset);
350 auto length_after = converter_->builder()->length();
351 auto num_converted = length_after - length_before;
352
353 offset += num_converted;
354 length_ += num_converted;
355
356 if (status.IsCapacityError()) {
357 if (converter_->builder()->length() == 0) {
358 // Builder length == 0 means the individual element is too large to append.
359 // In this case, no need to try again.
360 return status;
361 } else if (converter_->rewind_on_overflow()) {
362 // The list-like and binary-like conversion paths may raise a capacity error,
363 // we need to handle them differently. While the binary-like converters check
364 // the capacity before append/extend the list-like converters just check after
365 // append/extend. Thus depending on the implementation semantics we may need
366 // to rewind (slice) the output chunk by one.
367 length_ -= 1;
368 offset -= 1;
369 }
370 ARROW_RETURN_NOT_OK(FinishChunk());
371 } else if (!status.ok()) {
372 return status;
373 }
374 }
375 return Status::OK();
376 }
377
378 Status FinishChunk() {
379 ARROW_ASSIGN_OR_RAISE(auto chunk, converter_->ToArray(length_));

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