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

Method Ingest_some_nulls_Impl

r/src/array_to_vector.cpp:664–696  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

662 private:
663 template <typename Type>
664 Status Ingest_some_nulls_Impl(SEXP data, const std::shared_ptr<arrow::Array>& array,
665 R_xlen_t start, R_xlen_t n, size_t chunk_index) const {
666 using index_type = typename arrow::TypeTraits<Type>::ArrayType::value_type;
667 auto indices = checked_cast<const DictionaryArray&>(*array).indices();
668 auto raw_indices = indices->data()->GetValues<index_type>(1);
669
670 auto p_data = INTEGER(data) + start;
671 auto null_one = [&](R_xlen_t i) {
672 p_data[i] = NA_INTEGER;
673 return Status::OK();
674 };
675
676 // convert the 0-based indices from the arrow Array
677 // to 1-based indices used in R factors
678 if (need_unification_) {
679 // transpose the indices before converting
680 auto transposed =
681 reinterpret_cast<const int32_t*>(arrays_transpose_[chunk_index]->data());
682
683 auto ingest_one = [&](R_xlen_t i) {
684 p_data[i] = transposed[raw_indices[i]] + 1;
685 return Status::OK();
686 };
687
688 return IngestSome(array, n, ingest_one, null_one);
689 } else {
690 auto ingest_one = [&](R_xlen_t i) {
691 p_data[i] = static_cast<int>(raw_indices[i]) + 1;
692 return Status::OK();
693 };
694 return IngestSome(array, n, ingest_one, null_one);
695 }
696 }
697
698 bool GetOrdered() const {
699 return checked_cast<const DictionaryType&>(*chunked_array_->type()).ordered();

Callers

nothing calls this directly

Calls 4

IngestSomeFunction · 0.85
indicesMethod · 0.80
OKFunction · 0.50
dataMethod · 0.45

Tested by

no test coverage detected