| 465 | } |
| 466 | |
| 467 | Status Ingest_some_nulls(SEXP data, const std::shared_ptr<arrow::Array>& array, |
| 468 | R_xlen_t start, R_xlen_t n, size_t chunk_index) const { |
| 469 | auto p_data = LOGICAL(data) + start; |
| 470 | auto p_bools = array->data()->GetValues<uint8_t>(1, 0); |
| 471 | if (!p_bools) { |
| 472 | return Status::Invalid("Invalid data buffer"); |
| 473 | } |
| 474 | |
| 475 | arrow::internal::BitmapReader data_reader(p_bools, array->offset(), n); |
| 476 | auto ingest_one = [&](R_xlen_t i) { |
| 477 | p_data[i] = data_reader.IsSet(); |
| 478 | data_reader.Next(); |
| 479 | return Status::OK(); |
| 480 | }; |
| 481 | |
| 482 | auto null_one = [&](R_xlen_t i) { |
| 483 | data_reader.Next(); |
| 484 | p_data[i] = NA_LOGICAL; |
| 485 | return Status::OK(); |
| 486 | }; |
| 487 | |
| 488 | return IngestSome(array, n, ingest_one, null_one); |
| 489 | } |
| 490 | }; |
| 491 | |
| 492 | template <typename ArrayType> |