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

Method ExtendMasked

python/pyarrow/src/arrow/python/python_to_arrow.cc:568–584  ·  view source on GitHub ↗

Convert and append a sequence of values masked with a numpy array

Source from the content-addressed store, hash-verified

566
567 // Convert and append a sequence of values masked with a numpy array
568 Status ExtendMasked(PyObject* values, PyObject* mask, int64_t size,
569 int64_t offset = 0) override {
570 ARROW_DCHECK_GE(size, offset);
571 /// Ensure we've allocated enough space
572 RETURN_NOT_OK(this->Reserve(size - offset));
573 // Iterate over the items adding each one
574 return internal::VisitSequenceMasked(
575 values, mask, offset, [this](PyObject* item, bool is_masked, bool* /* unused */) {
576 if (is_masked) {
577 return this->AppendNull();
578 } else {
579 // This will also apply the null-checking convention in the event
580 // that the value is not masked
581 return this->Append(item); // perhaps use AppendValue instead?
582 }
583 });
584 }
585};
586
587// Helper function to unwrap extension scalar to its storage scalar

Callers 1

ConvertPySequenceFunction · 0.45

Calls 4

VisitSequenceMaskedFunction · 0.85
ReserveMethod · 0.45
AppendNullMethod · 0.45
AppendMethod · 0.45

Tested by

no test coverage detected