thisisnic commented on code in PR #48634:
URL: https://github.com/apache/arrow/pull/48634#discussion_r2642337463


##########
r/src/altrep.cpp:
##########
@@ -1191,18 +1200,19 @@ bool test_arrow_altrep_force_materialize(sexp x) {
     stop("x is already materialized");
   }
 
-  sexp data_class_sym = CAR(ATTRIB(ALTREP_CLASS(x)));
-  std::string class_name(CHAR(PRINTNAME(data_class_sym)));
-
-  if (class_name == "arrow::array_dbl_vector") {
+  if (R_altrep_inherits(x, 
arrow::r::altrep::AltrepVectorPrimitive<REALSXP>::class_t)) {
     arrow::r::altrep::AltrepVectorPrimitive<REALSXP>::Materialize(x);
-  } else if (class_name == "arrow::array_int_vector") {
+  } else if (R_altrep_inherits(
+                 x, arrow::r::altrep::AltrepVectorPrimitive<INTSXP>::class_t)) 
{
     arrow::r::altrep::AltrepVectorPrimitive<INTSXP>::Materialize(x);
-  } else if (class_name == "arrow::array_string_vector") {
+  } else if (R_altrep_inherits(
+                 x, 
arrow::r::altrep::AltrepVectorString<arrow::StringType>::class_t)) {
     arrow::r::altrep::AltrepVectorString<arrow::StringType>::Materialize(x);
-  } else if (class_name == "arrow::array_large_string_vector") {
+  } else if (R_altrep_inherits(
+                 x,
+                 
arrow::r::altrep::AltrepVectorString<arrow::LargeStringType>::class_t)) {
     
arrow::r::altrep::AltrepVectorString<arrow::LargeStringType>::Materialize(x);
-  } else if (class_name == "arrow::array_factor") {
+  } else if (R_altrep_inherits(x, arrow::r::altrep::AltrepFactor::class_t)) {

Review Comment:
   See above comment 
(https://github.com/apache/arrow/pull/48634/files#r2642335344)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to