|
sparrow 1.3.0
|
C++ proxy class for managing ArrowArrayStream objects. More...
#include <arrow_array_stream_proxy.hpp>
Public Member Functions | |
| SPARROW_API | arrow_array_stream_proxy () |
| Constructs a new ArrowArrayStream producer. | |
| SPARROW_API | arrow_array_stream_proxy (ArrowArrayStream &&stream) |
| Constructs from an existing ArrowArrayStream by taking ownership. | |
| SPARROW_API | arrow_array_stream_proxy (ArrowArrayStream *stream) |
| Constructs from an existing ArrowArrayStream pointer by referencing it. | |
| arrow_array_stream_proxy (const arrow_array_stream_proxy &)=delete | |
| arrow_array_stream_proxy & | operator= (const arrow_array_stream_proxy &)=delete |
| arrow_array_stream_proxy (arrow_array_stream_proxy &&other) noexcept | |
| arrow_array_stream_proxy & | operator= (arrow_array_stream_proxy &&other) noexcept |
| SPARROW_API | ~arrow_array_stream_proxy () |
| Destructor that releases all resources. | |
| SPARROW_API ArrowArrayStream * | export_stream () |
| Export the stream pointer. | |
| template<std::ranges::input_range R> requires layout<std::ranges::range_value_t<R>> | |
| void | push (R &&arrays) |
| Adds a range of arrays to the stream. | |
| template<layout A> | |
| void | push (A &&array) |
| Adds a single array to the stream. | |
| SPARROW_API std::optional< array > | pop () |
| Retrieves the next array from the stream. | |
C++ proxy class for managing ArrowArrayStream objects.
This class provides a C++ interface for working with ArrowArrayStream objects as defined by the Arrow C Stream Interface specification. It manages the lifetime of the stream and provides convenient methods for adding and retrieving data chunks.
The Arrow C Stream Interface is designed for streaming data exchange between different libraries or components within a single process. A stream exposes a source of data chunks, where each chunk has the same schema.
Key features:
Thread safety:
Definition at line 56 of file arrow_array_stream_proxy.hpp.
| SPARROW_API sparrow::arrow_array_stream_proxy::arrow_array_stream_proxy | ( | ) |
Constructs a new ArrowArrayStream producer.
Creates a new stream with an empty queue of arrays. The stream must be populated with a schema and arrays before it can be consumed.
|
explicit |
Constructs from an existing ArrowArrayStream by taking ownership.
Moves an externally created ArrowArrayStream into this proxy. This allows stack-allocated or otherwise-owned ArrowArrayStream objects to be transferred into the proxy without additional heap allocation.
| stream | The ArrowArrayStream to move and take ownership of. |
|
explicit |
Constructs from an existing ArrowArrayStream pointer by referencing it.
References an externally created ArrowArrayStream without taking ownership. The stream must remain valid for the lifetime of this proxy.
| stream | Pointer to the ArrowArrayStream to reference (not owned). |
|
delete |
|
noexcept |
| SPARROW_API sparrow::arrow_array_stream_proxy::~arrow_array_stream_proxy | ( | ) |
Destructor that releases all resources.
Calls the release callback on both the schema and stream if they are not already released. This ensures proper cleanup of all Arrow C interface objects.
| SPARROW_API ArrowArrayStream * sparrow::arrow_array_stream_proxy::export_stream | ( | ) |
Export the stream pointer.
Returns a pointer to the stream. If this proxy owns the stream, ownership is transferred. If this proxy references an external stream, a pointer to that stream is returned.
This is useful for passing the stream to external C APIs that will take ownership.
|
noexcept |
|
delete |
| SPARROW_API std::optional< array > sparrow::arrow_array_stream_proxy::pop | ( | ) |
Retrieves the next array from the stream.
Removes and returns the next array from the stream's queue. This implements the consumer-side pop operation, similar to calling get_next on the ArrowArrayStream.
| std::system_error | If getting the schema fails. |
| std::runtime_error | If the stream is immutable. |
|
inline |
Adds a single array to the stream.
Pushes a single array into the stream's queue. The array must have a schema compatible with the stream's schema.
| A | A type satisfying the layout concept. |
| array | The array to add to the stream. |
| std::runtime_error | If the array has an incompatible schema. |
| std::runtime_error | If the stream is immutable (released or not initialized). |
Definition at line 188 of file arrow_array_stream_proxy.hpp.
|
inline |
Adds a range of arrays to the stream.
Pushes multiple arrays into the stream's queue. All arrays must have schemas compatible with the stream's schema. Arrays are validated before being added.
| R | A range type whose value type satisfies the layout concept. |
| arrays | The range of arrays to add to the stream. |
| std::runtime_error | If any array has an incompatible schema. |
| std::runtime_error | If the stream is immutable (released or not initialized). |
Definition at line 144 of file arrow_array_stream_proxy.hpp.