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

Method Allocate

r/src/array_to_vector.cpp:734–755  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

732 }
733
734 SEXP Allocate(R_xlen_t n) const {
735 // allocate a data frame column to host each array
736 // If possible, a column is dealt with directly with altrep
737 auto type =
738 checked_cast<const arrow::StructType*>(this->chunked_array_->type().get());
739 auto out =
740 arrow::r::to_r_list(converters, [n](const std::shared_ptr<Converter>& converter) {
741 SEXP out = converter->MaybeAltrep();
742 if (Rf_isNull(out)) {
743 out = converter->Allocate(n);
744 }
745 return out;
746 });
747 auto colnames = arrow::r::to_r_strings(
748 type->fields(),
749 [](const std::shared_ptr<Field>& field) { return field->name(); });
750 out.attr(symbols::row_names) = arrow::r::short_row_names(static_cast<int>(n));
751 out.attr(R_NamesSymbol) = colnames;
752 out.attr(R_ClassSymbol) = arrow::r::data::classes_tbl_df;
753
754 return out;
755 }
756
757 Status Ingest_all_nulls(SEXP data, R_xlen_t start, R_xlen_t n) const {
758 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