Skip to content

Commit 8e13dbc

Browse files
authored
GH-44926: [R] Remove usage of cpp11's cpp11/altrep.hpp and HAS_ALTREP (#48902)
### Rationale for this change Don't need to check for altrep as it's in R >= 4.0 ### What changes are included in this PR? Remove altrep checking ### Are these changes tested? All good if CI passes ### Are there any user-facing changes? Nah * GitHub Issue: #44926 Authored-by: Nic Crane <thisisnic@gmail.com> Signed-off-by: Nic Crane <thisisnic@gmail.com>
1 parent 02e37e2 commit 8e13dbc

File tree

6 files changed

+0
-52
lines changed

6 files changed

+0
-52
lines changed

r/data-raw/codegen.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,7 @@ static const R_CallMethodDef CallEntries[] = {
211211
R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
212212
R_useDynamicSymbols(dll, FALSE);
213213
214-
#if defined(HAS_ALTREP)
215214
arrow::r::altrep::Init_Altrep_classes(dll);
216-
#endif
217215
218216
_arrow_compute__Initialize();
219217
}

r/src/altrep.cpp

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -24,30 +24,9 @@
2424
#include <arrow/util/bitmap_reader.h>
2525
#include <arrow/visit_data_inline.h>
2626

27-
#include <cpp11/altrep.hpp>
2827
#include <cpp11/declarations.hpp>
29-
#if defined(HAS_ALTREP)
3028

31-
#if R_VERSION < R_Version(3, 6, 0)
32-
33-
// workaround because R's <R_ext/Altrep.h> not so conveniently uses `class`
34-
// as a variable name, and C++ is not happy about that
35-
//
36-
// SEXP R_new_altrep(R_altrep_class_t class, SEXP data1, SEXP data2);
37-
//
38-
#define class klass
39-
40-
// Because functions declared in <R_ext/Altrep.h> have C linkage
41-
extern "C" {
4229
#include <R_ext/Altrep.h>
43-
}
44-
45-
// undo the workaround
46-
#undef class
47-
48-
#else
49-
#include <R_ext/Altrep.h>
50-
#endif
5130

5231
#include "./r_task_group.h"
5332

@@ -1116,29 +1095,6 @@ std::shared_ptr<ChunkedArray> vec_to_arrow_altrep_bypass(SEXP x) {
11161095
} // namespace r
11171096
} // namespace arrow
11181097

1119-
#else // HAS_ALTREP
1120-
1121-
namespace arrow {
1122-
namespace r {
1123-
namespace altrep {
1124-
1125-
// return an altrep R vector that shadows the array if possible
1126-
SEXP MakeAltrepVector(const std::shared_ptr<ChunkedArray>& chunked_array) {
1127-
return R_NilValue;
1128-
}
1129-
1130-
bool is_arrow_altrep(SEXP) { return false; }
1131-
1132-
std::shared_ptr<ChunkedArray> vec_to_arrow_altrep_bypass(SEXP x) { return nullptr; }
1133-
1134-
bool is_unmaterialized_arrow_altrep(SEXP) { return false; }
1135-
1136-
} // namespace altrep
1137-
} // namespace r
1138-
} // namespace arrow
1139-
1140-
#endif
1141-
11421098
// [[arrow::export]]
11431099
bool is_arrow_altrep(cpp11::sexp x) { return arrow::r::altrep::is_arrow_altrep(x); }
11441100

r/src/array_to_vector.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include <arrow/util/bitmap_writer.h>
2626
#include <arrow/util/int_util.h>
2727

28-
#include <cpp11/altrep.hpp>
2928
#include <type_traits>
3029

3130
#include "./extension.h"

r/src/arrowExports.cpp

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

r/src/arrow_cpp11.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#undef Free
2424

2525
#include <cpp11.hpp>
26-
#include <cpp11/altrep.hpp>
2726

2827
#include "./nameof.h"
2928

r/src/arrow_types.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,7 @@ arrow::Status AddMetadataFromDots(SEXP lst, int num_fields,
246246

247247
namespace altrep {
248248

249-
#if defined(HAS_ALTREP)
250249
void Init_Altrep_classes(DllInfo* dll);
251-
#endif
252250

253251
SEXP MakeAltrepVector(const std::shared_ptr<ChunkedArray>& chunked_array);
254252
bool is_arrow_altrep(SEXP x);

0 commit comments

Comments
 (0)