@@ -280,6 +280,11 @@ struct AltrepArrayPrimitive {
280280 }
281281
282282 static SEXP Unserialize (SEXP /* class_ */ , SEXP state) { return state; }
283+
284+ SEXP Coerce (int type) {
285+ // Just let R handle it for now
286+ return NULL ;
287+ }
283288};
284289template <int sexp_type>
285290R_altrep_class_t AltrepArrayPrimitive<sexp_type>::class_t ;
@@ -344,6 +349,11 @@ SEXP Unserialize(SEXP class_, SEXP state) {
344349 return AltrepClass::Unserialize (class_, state);
345350}
346351
352+ template <typename AltrepClass>
353+ SEXP Coerce (SEXP alt, int type) {
354+ return AltrepClass (alt).Coerce (type);
355+ }
356+
347357static std::shared_ptr<arrow::compute::ScalarAggregateOptions> NaRmOptions (
348358 const std::shared_ptr<Array>& array, bool na_rm) {
349359 auto options = std::make_shared<arrow::compute::ScalarAggregateOptions>(
@@ -435,6 +445,7 @@ void InitAltrepMethods(R_altrep_class_t class_t, DllInfo* dll) {
435445 R_set_altrep_Duplicate_method (class_t , Duplicate<AltrepClass>);
436446 R_set_altrep_Serialized_state_method (class_t , Serialized_state<AltrepClass>);
437447 R_set_altrep_Unserialize_method (class_t , Unserialize<AltrepClass>);
448+ R_set_altrep_Coerce_method (class_t , Coerce<AltrepClass>);
438449}
439450
440451template <typename AltrepClass>
0 commit comments