Convert and append a sequence of values masked with a numpy array
| 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 |
no test coverage detected