| 722 | private: |
| 723 | template <typename Type> |
| 724 | Status Ingest_some_nulls_Impl(SEXP data, const std::shared_ptr<arrow::Array>& array, |
| 725 | R_xlen_t start, R_xlen_t n, size_t chunk_index) const { |
| 726 | using index_type = typename arrow::TypeTraits<Type>::ArrayType::value_type; |
| 727 | auto indices = checked_cast<const DictionaryArray&>(*array).indices(); |
| 728 | auto raw_indices = indices->data()->GetValues<index_type>(1); |
| 729 | |
| 730 | auto p_data = INTEGER(data) + start; |
| 731 | auto null_one = [&](R_xlen_t i) { |
| 732 | p_data[i] = NA_INTEGER; |
| 733 | return Status::OK(); |
| 734 | }; |
| 735 | |
| 736 | // convert the 0-based indices from the arrow Array |
| 737 | // to 1-based indices used in R factors |
| 738 | if (need_unification_) { |
| 739 | // transpose the indices before converting |
| 740 | auto transposed = |
| 741 | reinterpret_cast<const int32_t*>(arrays_transpose_[chunk_index]->data()); |
| 742 | |
| 743 | auto ingest_one = [&](R_xlen_t i) { |
| 744 | p_data[i] = transposed[raw_indices[i]] + 1; |
| 745 | return Status::OK(); |
| 746 | }; |
| 747 | |
| 748 | return IngestSome(array, n, ingest_one, null_one); |
| 749 | } else { |
| 750 | auto ingest_one = [&](R_xlen_t i) { |
| 751 | p_data[i] = static_cast<int>(raw_indices[i]) + 1; |
| 752 | return Status::OK(); |
| 753 | }; |
| 754 | return IngestSome(array, n, ingest_one, null_one); |
| 755 | } |
| 756 | } |
| 757 | |
| 758 | bool GetOrdered() const { |
| 759 | return checked_cast<const DictionaryType&>(*chunked_array_->type()).ordered(); |
nothing calls this directly
no test coverage detected