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

Method Allocate

r/src/array_to_vector.cpp:756–777  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

754 }
755
756 SEXP Allocate(R_xlen_t n) const {
757 // allocate a data frame column to host each array
758 // If possible, a column is dealt with directly with altrep
759 auto type =
760 checked_cast<const arrow::StructType*>(this->chunked_array_->type().get());
761 auto out =
762 arrow::r::to_r_list(converters, [n](const std::shared_ptr<Converter>& converter) {
763 SEXP out = converter->MaybeAltrep();
764 if (Rf_isNull(out)) {
765 out = converter->Allocate(n);
766 }
767 return out;
768 });
769 auto colnames = arrow::r::to_r_strings(
770 type->fields(),
771 [](const std::shared_ptr<Field>& field) { return field->name(); });
772 out.attr(symbols::row_names) = arrow::r::short_row_names(static_cast<int>(n));
773 out.attr(R_NamesSymbol) = colnames;
774 out.attr(R_ClassSymbol) = arrow::r::data::classes_tbl_df;
775
776 return out;
777 }
778
779 Status Ingest_all_nulls(SEXP data, R_xlen_t start, R_xlen_t n) const {
780 int nf = static_cast<int>(converters.size());

Callers

nothing calls this directly

Calls 9

to_r_listFunction · 0.85
to_r_stringsFunction · 0.85
short_row_namesFunction · 0.85
MaybeAltrepMethod · 0.80
getMethod · 0.45
typeMethod · 0.45
AllocateMethod · 0.45
fieldsMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected