16#include <arrow/compute/api_aggregate.h>
17#include <arrow/compute/kernel.h>
18#include <arrow/status.h>
19#include <arrow/table.h>
20#include <arrow/util/key_value_metadata.h>
63 auto status = arrow::MakeBuilder(pool, arrow::int32(), &
mBuilder);
77 (
void)
static_cast<arrow::Int32Builder*
>(
mBuilder.get())->Append(idx);
82 std::shared_ptr<arrow::Array>
array;
83 auto status =
static_cast<arrow::Int32Builder*
>(
mBuilder.get())->Finish(&
array);
88 return std::make_shared<arrow::ChunkedArray>(
array);
94 auto status = arrow::MakeBuilder(pool, arrow::int32(), &
mBuilder);
110 size_t step =
count / 2;
132 (
void)
static_cast<arrow::Int32Builder*
>(
mBuilder.get())->Append(-1);
138 std::shared_ptr<arrow::Array>
array;
139 auto status =
static_cast<arrow::Int32Builder*
>(
mBuilder.get())->Finish(&
array);
143 return std::make_shared<arrow::ChunkedArray>(
array);
153 std::unique_ptr<arrow::ArrayBuilder> builder;
154 auto status = arrow::MakeBuilder(pool, arrow::int32(), &builder);
158 mListBuilder = std::make_unique<arrow::FixedSizeListBuilder>(pool, std::move(builder), 2);
178 auto step =
count / 2;
197 int data[2] = {-1, -1};
205 (
void)
static_cast<arrow::FixedSizeListBuilder*
>(
mListBuilder.get())->AppendValues(1);
211 std::shared_ptr<arrow::Array>
array;
212 auto status =
static_cast<arrow::FixedSizeListBuilder*
>(
mListBuilder.get())->Finish(&
array);
216 return std::make_shared<arrow::ChunkedArray>(
array);
219arrow::Status SliceBuilder::SliceBuilder::preSlice()
221 arrow::Datum value_counts;
222 auto options = arrow::compute::ScalarAggregateOptions::Defaults();
223 ARROW_ASSIGN_OR_RAISE(value_counts, arrow::compute::CallFunction(
"value_counts", {mSource}, &options));
224 auto pair =
static_cast<arrow::StructArray
>(value_counts.array());
225 mValues = std::make_shared<arrow::NumericArray<arrow::Int32Type>>(pair.field(0)->data());
226 mCounts = std::make_shared<arrow::NumericArray<arrow::Int64Type>>(pair.field(1)->data());
227 return arrow::Status::OK();
237 std::unique_ptr<arrow::ArrayBuilder> builder;
238 auto status = arrow::MakeBuilder(pool, arrow::int32(), &builder);
242 mListBuilder = std::make_unique<arrow::ListBuilder>(pool, std::move(builder));
268 (
void)
static_cast<arrow::Int32Builder*
>(
mValueBuilder)->AppendValues(
nullptr, 0);
274 std::shared_ptr<arrow::Array>
array;
275 auto status =
static_cast<arrow::ListBuilder*
>(
mListBuilder.get())->Finish(&
array);
279 return std::make_shared<arrow::ChunkedArray>(
array);
285 auto options = arrow::compute::ScalarAggregateOptions::Defaults();
286 ARROW_ASSIGN_OR_RAISE(
max, arrow::compute::CallFunction(
"max", {
mSource}, &options));
287 auto maxValue = std::dynamic_pointer_cast<arrow::Int32Scalar>(
max.scalar())->value;
291 for (
auto i = 0;
i <
mSource->length(); ++
i) {
301 return arrow::Status::OK();
329 [](std::monostate) {},
338 [](std::monostate) {
return false; },
339 [&idx](
auto&
b) {
return b.find(idx); },
348 [](std::monostate) {},
349 [&idx](
auto&
b) {
b.fill(idx); }},
357 [](std::monostate) -> std::shared_ptr<arrow::ChunkedArray> {
return nullptr; },
358 [](
auto&
b) {
return b.result(); }},
366 return std::static_pointer_cast<arrow::Int32Array>(chunk);
#define O2_BUILTIN_UNLIKELY(x)
GLboolean GLboolean GLboolean b
GLsizei GLsizei GLchar * source
GLuint GLsizei GLsizei * length
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
Defining PrimaryVertex explicitly as messageable.
RuntimeErrorRef runtime_error(const char *)
void cannotCreateIndexBuilder()
void cannotBuildAnArray()
arrow::ArrayBuilder * mValueBuilder
std::vector< int > mValues
std::shared_ptr< arrow::ChunkedArray > result() const
std::vector< std::vector< int > > mIndices
ArrayBuilder(std::shared_ptr< arrow::ChunkedArray > source, arrow::MemoryPool *pool)
std::unique_ptr< arrow::ArrayBuilder > mListBuilder
void reset(std::shared_ptr< arrow::ChunkedArray > source)
std::shared_ptr< arrow::Int32Array > getCurrentArray()
ChunkedArrayIterator(std::shared_ptr< arrow::ChunkedArray > source)
std::shared_ptr< arrow::Int32Array > mCurrentArray
void reset(std::shared_ptr< arrow::ChunkedArray > &source)
std::shared_ptr< arrow::ChunkedArray > mSource
IndexColumnBuilder(soa::IndexKind kind, int pos, arrow::MemoryPool *pool, std::shared_ptr< arrow::ChunkedArray > source=nullptr)
std::shared_ptr< arrow::ChunkedArray > result() const
void reset(std::shared_ptr< arrow::ChunkedArray > source=nullptr)
std::variant< std::monostate, SelfBuilder, SingleBuilder, SliceBuilder, ArrayBuilder > builder
SelfBuilder(arrow::MemoryPool *pool)
std::shared_ptr< arrow::ChunkedArray > result() const
std::unique_ptr< arrow::ArrayBuilder > mBuilder
std::unique_ptr< framework::ChunkedArrayIterator > keyIndex
void reset(std::shared_ptr< arrow::ChunkedArray >)
std::unique_ptr< arrow::ArrayBuilder > mBuilder
SingleBuilder(std::shared_ptr< arrow::ChunkedArray > source, arrow::MemoryPool *pool)
std::shared_ptr< arrow::ChunkedArray > result() const
void reset(std::shared_ptr< arrow::ChunkedArray > source)
std::shared_ptr< arrow::NumericArray< arrow::Int32Type > > mValues
std::unique_ptr< arrow::ArrayBuilder > mListBuilder
std::shared_ptr< arrow::ChunkedArray > result() const
SliceBuilder(std::shared_ptr< arrow::ChunkedArray > source, arrow::MemoryPool *pool)
void reset(std::shared_ptr< arrow::ChunkedArray > source)
arrow::ArrayBuilder * mValueBuilder
std::shared_ptr< arrow::NumericArray< arrow::Int64Type > > mCounts
From https://en.cppreference.com/w/cpp/utility/variant/visit.