@@ -30,29 +30,23 @@ namespace sparrow_ipc
3030 serialized_record_batch_info serialize_record_batch (
3131 const sparrow::record_batch& record_batch,
3232 any_output_stream& stream,
33-
34- std::optional<CompressionType> compression
35- ,
36- std::optional<std::reference_wrapper<CompressionCache>> cache)
33+ std::optional<CompressionType> compression,
34+ std::optional<std::reference_wrapper<CompressionCache>> cache
35+ )
3736 {
3837 // Build and serialize metadata
3938 flatbuffers::FlatBufferBuilder builder = get_record_batch_message_builder (record_batch, compression, cache);
40- const flatbuffers::uoffset_t flatbuffer_size = builder.GetSize ();
41-
39+
4240 // Calculate metadata length for the Block in the footer
4341 // According to Arrow spec, metadata_length must be a multiple of 8.
4442 // The encapsulated message format is:
4543 // - continuation (4 bytes)
4644 // - size prefix (4 bytes)
4745 // - flatbuffer metadata (flatbuffer_size bytes)
4846 // - padding to 8-byte boundary
49- //
47+ //
5048 // Arrow's WriteMessage returns metadata_length = align_to_8(8 + flatbuffer_size)
5149 // which INCLUDES the continuation bytes.
52- const size_t prefix_size = continuation.size () + sizeof (uint32_t ); // 8 bytes
53- const int32_t metadata_length = static_cast <int32_t >(
54- utils::align_to_8 (prefix_size + flatbuffer_size)
55- );
5650
5751 // Write metadata
5852 common_serialize (builder, stream);
0 commit comments