6#include <sparrow/record_batch.hpp>
63 std::optional<CompressionType> compression = std::nullopt,
64 std::optional<std::reference_wrapper<CompressionCache>> cache = std::nullopt);
80 template <std::ranges::input_range R>
81 requires std::same_as<std::ranges::range_value_t<R>, sparrow::record_batch>
83 std::optional<CompressionType> compression = std::nullopt,
84 std::optional<std::reference_wrapper<CompressionCache>> cache = std::nullopt)
86 if (record_batches.empty())
93 throw std::invalid_argument(
"Record batches have inconsistent schemas");
97 auto it = std::ranges::begin(record_batches);
101 for (
const auto& record_batch : record_batches)
129 std::optional<CompressionType> compression = std::nullopt,
130 std::optional<std::reference_wrapper<CompressionCache>> cache = std::nullopt);
146 std::optional<CompressionType> compression = std::nullopt,
147 std::optional<std::reference_wrapper<CompressionCache>> cache = std::nullopt);
Type-erased wrapper for any stream-like object.
bool check_record_batches_consistency(const R &record_batches)
Checks if all record batches in a collection have consistent structure.
SPARROW_IPC_API void generate_body(const sparrow::record_batch &record_batch, any_output_stream &stream, std::optional< CompressionType > compression=std::nullopt, std::optional< std::reference_wrapper< CompressionCache > > cache=std::nullopt)
Generates a serialized body from a record batch.
SPARROW_IPC_API void fill_body(const sparrow::arrow_proxy &arrow_proxy, any_output_stream &stream, std::optional< CompressionType > compression=std::nullopt, std::optional< std::reference_wrapper< CompressionCache > > cache=std::nullopt)
Fills the body vector with serialized data from an arrow proxy and its children.
SPARROW_IPC_API void serialize_schema_message(const sparrow::record_batch &record_batch, any_output_stream &stream)
Serializes a schema message for a record batch into a byte buffer.
SPARROW_IPC_API std::size_t calculate_record_batch_message_size(const sparrow::record_batch &record_batch, std::optional< CompressionType > compression=std::nullopt, std::optional< std::reference_wrapper< CompressionCache > > cache=std::nullopt)
Calculates the total serialized size of a record batch message.
std::size_t calculate_total_serialized_size(const R &record_batches, std::optional< CompressionType > compression=std::nullopt, std::optional< std::reference_wrapper< CompressionCache > > cache=std::nullopt)
Calculates the total serialized size for a collection of record batches.
SPARROW_IPC_API std::size_t calculate_schema_message_size(const sparrow::record_batch &record_batch)
Calculates the total serialized size of a schema message.
SPARROW_IPC_API std::vector< sparrow::data_type > get_column_dtypes(const sparrow::record_batch &rb)