Skip to content

Commit

Permalink
Merge pull request #1 from amoeba/fix/GH-44357_fix_r_backwards_compat…
Browse files Browse the repository at this point in the history
…_job

Guard ChunkResolver use in altrep.cpp
  • Loading branch information
anjakefala authored Oct 18, 2024
2 parents 3d3e1be + d2d29b0 commit 62bad5b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions r/src/altrep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,26 @@ void DeletePointer(std::shared_ptr<T>* ptr) {
template <typename T>
using Pointer = cpp11::external_pointer<std::shared_ptr<T>, DeletePointer<T>>;

#if ARROW_MAJOR_VERSION >= 18
using ChunkResolver = arrow::ChunkResolver;
using ChunkLocation = arrow::ChunkLocation;
#else
using ChunkResolver = arrow::internal::ChunkResolver;
using ChunkLocation = arrow::internal::ChunkLocation;
#endif

class ArrowAltrepData {
public:
explicit ArrowAltrepData(const std::shared_ptr<ChunkedArray>& chunked_array)
: chunked_array_(chunked_array), resolver_(chunked_array->chunks()) {}

const std::shared_ptr<ChunkedArray>& chunked_array() { return chunked_array_; }

arrow::ChunkLocation locate(int64_t index) { return resolver_.Resolve(index); }
ChunkLocation locate(int64_t index) { return resolver_.Resolve(index); }

private:
std::shared_ptr<ChunkedArray> chunked_array_;
arrow::ChunkResolver resolver_;
ChunkResolver resolver_;
};

// the ChunkedArray that is being wrapped by the altrep object
Expand Down

0 comments on commit 62bad5b

Please sign in to comment.