Skip to content

Commit

Permalink
cylondata#610: SampleArray util method replaced by using arrow::compu…
Browse files Browse the repository at this point in the history
…te::Take and pass corresponding indices to it - changes from build to using std:vector and std:sort. Vector data is moved to an arrow::Buffer::Wrap (wrapper) that can be used by the actual arrow::Array (continued - adds call to WrapNumericVector function added by cylondata#615-cylondata#616)
  • Loading branch information
mstaylor committed Aug 31, 2022
1 parent 49fbb89 commit 322fc21
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions cpp/src/cylon/util/arrow_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,7 @@ arrow::Status SampleArray(const std::shared_ptr<arrow::ChunkedArray> &arr,

std::sort(vector_indices.begin(), vector_indices.end());

auto buf = arrow::Buffer::Wrap(vector_indices.data(), vector_indices.size());
auto data = arrow::ArrayData::Make(arrow::int64(),
static_cast<int64_t>(vector_indices.size()),
{nullptr, std::move(buf)});

std::shared_ptr<arrow::Array> arrow_array = std::make_shared<arrow::UInt64Array>(std::move(data));
auto arrow_array = WrapNumericVector(vector_indices);

const arrow::compute::TakeOptions &take_options = arrow::compute::TakeOptions::NoBoundsCheck();

Expand Down

0 comments on commit 322fc21

Please sign in to comment.