5#include <sparrow/record_batch.hpp>
48 template <std::ranges::input_range R>
49 requires std::same_as<std::ranges::range_value_t<R>, sparrow::record_batch>
51 std::optional<CompressionType> compression,
52 std::optional<std::reference_wrapper<CompressionCache>> cache)
54 if (record_batches.empty())
61 throw std::invalid_argument(
62 "All record batches must have the same schema to be serialized together."
66 for (
const auto& rb : record_batches)
95 std::optional<CompressionType> compression,
96 std::optional<std::reference_wrapper<CompressionCache>> cache);
Type-erased wrapper for any stream-like object.
void write(std::span< const std::uint8_t > span)
Writes a span of bytes to the underlying stream.
bool check_record_batches_consistency(const R &record_batches)
Checks if all record batches in a collection have consistent structure.
SPARROW_IPC_API serialized_record_batch_info serialize_record_batch(const sparrow::record_batch &record_batch, any_output_stream &stream, std::optional< CompressionType > compression, std::optional< std::reference_wrapper< CompressionCache > > cache)
Serializes a record batch into a binary format following the Arrow IPC specification.
constexpr std::array< std::uint8_t, 8 > end_of_stream
End-of-stream marker defined in the Arrow IPC specification: https://arrow.apache....
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.
void serialize_record_batches_to_ipc_stream(const R &record_batches, any_output_stream &stream, std::optional< CompressionType > compression, std::optional< std::reference_wrapper< CompressionCache > > cache)
Serializes a collection of record batches into a binary format.
Information about a serialized record batch block.
int64_t body_length
Length of the record batch body (data buffers)
int32_t metadata_length
Length of the metadata (FlatBuffer message + padding)