11#ifndef O2_FRAMEWORK_DEFERREDFRAGMENT_H
12#define O2_FRAMEWORK_DEFERREDFRAGMENT_H
14#include <arrow/dataset/api.h>
28 arrow::compute::Expression partition_expression,
29 std::shared_ptr<arrow::Schema> physical_schema)
30 : Fragment(
std::move(partition_expression), physical_schema)
36 const std::shared_ptr<arrow::dataset::ScanOptions>& options)
override;
41 std::shared_ptr<arrow::Buffer> GetPlaceholderForOp(
size_t size)
43 mSizes.push_back(
size);
44 return std::make_shared<arrow::Buffer>((uint8_t*)(mSizes.size() - 1),
size);
46 std::vector<size_t> mSizes;
58 const std::shared_ptr<arrow::ResizableBuffer>&
buffer);
66 static arrow::Result<std::shared_ptr<PreallocatedOutputStream>>
Create(
67 std::vector<size_t>&
sizes,
68 int64_t initial_capacity = 4096,
69 arrow::MemoryPool* pool = arrow::default_memory_pool());
79 arrow::Status
Close()
override;
80 [[nodiscard]]
bool closed()
const override;
81 [[nodiscard]] arrow::Result<int64_t>
Tell()
const override;
82 arrow::Status
Write(
const void*
data, int64_t nbytes)
override;
85 using OutputStream::Write;
89 arrow::Result<std::shared_ptr<arrow::Buffer>>
Finish();
97 int64_t initial_capacity, arrow::MemoryPool* pool);
99 [[nodiscard]] int64_t
capacity()
const {
return capacity_; }
102 std::vector<size_t> sizes_;
106 arrow::Status Reserve(int64_t nbytes);
108 std::shared_ptr<arrow::ResizableBuffer> buffer_;
112 uint8_t* mutable_data_;
arrow::Result< arrow::RecordBatchGenerator > ScanBatchesAsync(const std::shared_ptr< arrow::dataset::ScanOptions > &options) override
EmptyFragment(size_t rows, arrow::compute::Expression partition_expression, std::shared_ptr< arrow::Schema > physical_schema)
arrow::Result< std::shared_ptr< arrow::Buffer > > Finish()
Close the stream and return the buffer.
~PreallocatedOutputStream() override=default
bool closed() const override
arrow::Status Close() override
Close the stream, preserving the buffer (retrieve it with Finish()).
static arrow::Result< std::shared_ptr< PreallocatedOutputStream > > Create(std::vector< size_t > &sizes, int64_t initial_capacity=4096, arrow::MemoryPool *pool=arrow::default_memory_pool())
Create in-memory output stream with indicated capacity using a memory pool.
arrow::Status Reset(std::vector< size_t > sizes, int64_t initial_capacity, arrow::MemoryPool *pool)
Initialize state of OutputStream with newly allocated memory and set position to 0.
arrow::Result< int64_t > Tell() const override
GLuint GLsizei const GLuint const GLintptr const GLsizeiptr * sizes
Defining PrimaryVertex explicitly as messageable.
Defining DataPointCompositeObject explicitly as copiable.
std::vector< ReadoutWindowData > rows