| 426 | } |
| 427 | |
| 428 | Status Ingest_some_nulls(SEXP data, const std::shared_ptr<arrow::Array>& array, |
| 429 | R_xlen_t start, R_xlen_t n, size_t chunk_index) const { |
| 430 | auto p_data = LOGICAL(data) + start; |
| 431 | auto p_bools = array->data()->GetValues<uint8_t>(1, 0); |
| 432 | if (!p_bools) { |
| 433 | return Status::Invalid("Invalid data buffer"); |
| 434 | } |
| 435 | |
| 436 | arrow::internal::BitmapReader data_reader(p_bools, array->offset(), n); |
| 437 | auto ingest_one = [&](R_xlen_t i) { |
| 438 | p_data[i] = data_reader.IsSet(); |
| 439 | data_reader.Next(); |
| 440 | return Status::OK(); |
| 441 | }; |
| 442 | |
| 443 | auto null_one = [&](R_xlen_t i) { |
| 444 | data_reader.Next(); |
| 445 | p_data[i] = NA_LOGICAL; |
| 446 | return Status::OK(); |
| 447 | }; |
| 448 | |
| 449 | return IngestSome(array, n, ingest_one, null_one); |
| 450 | } |
| 451 | }; |
| 452 | |
| 453 | template <typename ArrayType> |