18 const R& record_batches,
19 std::size_t current_stream_size,
21 std::optional<CompressionType> compression,
23 std::optional<std::reference_wrapper<CompressionCache>> cache = std::nullopt
26 if (std::ranges::empty(record_batches))
28 return current_stream_size;
32 const std::size_t total_with_record_batches = std::accumulate(
33 record_batches.begin(),
36 [&cache, &reservation_tracker, compression](std::size_t acc,
const sparrow::record_batch& rb)
38 std::size_t dictionaries_size = 0;
39 for_each_pending_dictionary(rb, reservation_tracker, [&](const dictionary_info& dict_info)
41 dictionaries_size += calculate_dictionary_batch_message_size(
50 return acc + dictionaries_size
57 return total_with_record_batches
61 return total_with_record_batches;
std::size_t calculate_serializer_reserve_size(const R &record_batches, std::size_t current_stream_size, bool schema_received, std::optional< CompressionType > compression, const dictionary_tracker &dict_tracker, std::optional< std::reference_wrapper< CompressionCache > > cache=std::nullopt)
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.