[[arrow::export]]
| 1135 | |
| 1136 | // [[arrow::export]] |
| 1137 | bool test_arrow_altrep_force_materialize(sexp x) { |
| 1138 | if (!is_arrow_altrep(x)) { |
| 1139 | stop("x is not arrow ALTREP"); |
| 1140 | } |
| 1141 | |
| 1142 | bool already_materialized = as_cpp<bool>(test_arrow_altrep_is_materialized(x)); |
| 1143 | if (already_materialized) { |
| 1144 | stop("x is already materialized"); |
| 1145 | } |
| 1146 | |
| 1147 | SEXP class_sym = R_altrep_class_name(x); |
| 1148 | std::string class_name(CHAR(PRINTNAME(class_sym))); |
| 1149 | |
| 1150 | if (class_name == "arrow::array_dbl_vector") { |
| 1151 | arrow::r::altrep::AltrepVectorPrimitive<REALSXP>::Materialize(x); |
| 1152 | } else if (class_name == "arrow::array_int_vector") { |
| 1153 | arrow::r::altrep::AltrepVectorPrimitive<INTSXP>::Materialize(x); |
| 1154 | } else if (class_name == "arrow::array_string_vector") { |
| 1155 | arrow::r::altrep::AltrepVectorString<arrow::StringType>::Materialize(x); |
| 1156 | } else if (class_name == "arrow::array_large_string_vector") { |
| 1157 | arrow::r::altrep::AltrepVectorString<arrow::LargeStringType>::Materialize(x); |
| 1158 | } else if (class_name == "arrow::array_factor") { |
| 1159 | arrow::r::altrep::AltrepFactor::Materialize(x); |
| 1160 | } else { |
| 1161 | return false; |
| 1162 | } |
| 1163 | |
| 1164 | return true; |
| 1165 | } |
| 1166 | |
| 1167 | // [[arrow::export]] |
| 1168 | sexp test_arrow_altrep_copy_by_element(sexp x) { |
no test coverage detected