Skip to content

Commit

Permalink
ARROW-14803: [R] Function not declared in scope
Browse files Browse the repository at this point in the history
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 apache#11772 from jonkeane/r-versions-fix

Authored-by: Jonathan Keane <[email protected]>
Signed-off-by: Nic Crane <[email protected]>
  • Loading branch information
jonkeane authored and kou committed Dec 1, 2021
1 parent cb5c07f commit 68cb943
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion r/src/altrep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ SEXP MakeAltrepVector(const std::shared_ptr<ChunkedArray>& chunked_array) {

bool is_arrow_altrep(SEXP) { return false; }

std::shared_ptr<Array> vec_to_arrow_altrep_bypass(SEXP x) { return nullptr; }
std::shared_ptr<ChunkedArray> vec_to_arrow_altrep_bypass(SEXP x) { return nullptr; }

} // namespace altrep
} // namespace r
Expand Down
11 changes: 11 additions & 0 deletions r/src/arrow_cpp11.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
11 changes: 0 additions & 11 deletions r/src/arrow_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,6 @@ std::shared_ptr<arrow::RecordBatch> 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 {
Expand Down

0 comments on commit 68cb943

Please sign in to comment.