From 68cb94362885816fbf069ea324c06b2003012c45 Mon Sep 17 00:00:00 2001 From: Jonathan Keane Date: Mon, 29 Nov 2021 11:16:07 +0000 Subject: [PATCH] ARROW-14803: [R] Function not declared in scope It looks like there was an order-of-imports issue and then one place where a return type wasn't quite right (when altrep wasn't defined). These changes make the old versions pass again (though there might be a better way to accomplish this!) Closes #11772 from jonkeane/r-versions-fix Authored-by: Jonathan Keane Signed-off-by: Nic Crane --- r/src/altrep.cpp | 2 +- r/src/arrow_cpp11.h | 11 +++++++++++ r/src/arrow_types.h | 11 ----------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/r/src/altrep.cpp b/r/src/altrep.cpp index 9305ce826742c..2813ba421389f 100644 --- a/r/src/altrep.cpp +++ b/r/src/altrep.cpp @@ -706,7 +706,7 @@ SEXP MakeAltrepVector(const std::shared_ptr& chunked_array) { bool is_arrow_altrep(SEXP) { return false; } -std::shared_ptr vec_to_arrow_altrep_bypass(SEXP x) { return nullptr; } +std::shared_ptr vec_to_arrow_altrep_bypass(SEXP x) { return nullptr; } } // namespace altrep } // namespace r diff --git a/r/src/arrow_cpp11.h b/r/src/arrow_cpp11.h index 15f31cd65b0e1..3bebc4fdbb4aa 100644 --- a/r/src/arrow_cpp11.h +++ b/r/src/arrow_cpp11.h @@ -40,6 +40,17 @@ #define ALTREP_CLASS_SERIALIZED_CLASS(x) ATTRIB(x) #define ALTREP_SERIALIZED_CLASS_PKGSYM(x) CADR(x) +#if (R_VERSION < R_Version(3, 5, 0)) +#define LOGICAL_RO(x) ((const int*)LOGICAL(x)) +#define INTEGER_RO(x) ((const int*)INTEGER(x)) +#define REAL_RO(x) ((const double*)REAL(x)) +#define COMPLEX_RO(x) ((const Rcomplex*)COMPLEX(x)) +#define STRING_PTR_RO(x) ((const SEXP*)STRING_PTR(x)) +#define RAW_RO(x) ((const Rbyte*)RAW(x)) +#define DATAPTR_RO(x) ((const void*)STRING_PTR(x)) +#define DATAPTR(x) (void*)STRING_PTR(x) +#endif + namespace arrow { namespace r { diff --git a/r/src/arrow_types.h b/r/src/arrow_types.h index 088e7fe82039b..3900ae0c431f9 100644 --- a/r/src/arrow_types.h +++ b/r/src/arrow_types.h @@ -75,17 +75,6 @@ std::shared_ptr RecordBatch__from_arrays(SEXP, SEXP); arrow::MemoryPool* gc_memory_pool(); arrow::compute::ExecContext* gc_context(); -#if (R_VERSION < R_Version(3, 5, 0)) -#define LOGICAL_RO(x) ((const int*)LOGICAL(x)) -#define INTEGER_RO(x) ((const int*)INTEGER(x)) -#define REAL_RO(x) ((const double*)REAL(x)) -#define COMPLEX_RO(x) ((const Rcomplex*)COMPLEX(x)) -#define STRING_PTR_RO(x) ((const SEXP*)STRING_PTR(x)) -#define RAW_RO(x) ((const Rbyte*)RAW(x)) -#define DATAPTR_RO(x) ((const void*)STRING_PTR(x)) -#define DATAPTR(x) (void*)STRING_PTR(x) -#endif - #define VECTOR_PTR_RO(x) ((const SEXP*)DATAPTR_RO(x)) namespace arrow {