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

Method Ingest_some_nulls_Impl

r/src/array_to_vector.cpp:685–717  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

683 private:
684 template <typename Type>
685 Status Ingest_some_nulls_Impl(SEXP data, const std::shared_ptr<arrow::Array>& array,
686 R_xlen_t start, R_xlen_t n, size_t chunk_index) const {
687 using index_type = typename arrow::TypeTraits<Type>::ArrayType::value_type;
688 auto indices = checked_cast<const DictionaryArray&>(*array).indices();
689 auto raw_indices = indices->data()->GetValues<index_type>(1);
690
691 auto p_data = INTEGER(data) + start;
692 auto null_one = [&](R_xlen_t i) {
693 p_data[i] = NA_INTEGER;
694 return Status::OK();
695 };
696
697 // convert the 0-based indices from the arrow Array
698 // to 1-based indices used in R factors
699 if (need_unification_) {
700 // transpose the indices before converting
701 auto transposed =
702 reinterpret_cast<const int32_t*>(arrays_transpose_[chunk_index]->data());
703
704 auto ingest_one = [&](R_xlen_t i) {
705 p_data[i] = transposed[raw_indices[i]] + 1;
706 return Status::OK();
707 };
708
709 return IngestSome(array, n, ingest_one, null_one);
710 } else {
711 auto ingest_one = [&](R_xlen_t i) {
712 p_data[i] = static_cast<int>(raw_indices[i]) + 1;
713 return Status::OK();
714 };
715 return IngestSome(array, n, ingest_one, null_one);
716 }
717 }
718
719 bool GetOrdered() const {
720 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