Phoenix500526 commented on code in PR #10277:
URL: https://github.com/apache/arrow-rs/pull/10277#discussion_r3651596297
##########
arrow-ipc/src/writer.rs:
##########
@@ -135,6 +135,226 @@ impl<'a> IpcBodySink<'a> {
}
}
+struct MetadataLayout {
+ padded_header_len: usize,
+ padded_metadata_len: usize,
+ metadata_padding: usize,
+}
+
+#[inline]
+fn metadata_layout(metadata_len: usize, write_options: &IpcWriteOptions) ->
MetadataLayout {
Review Comment:
Done
##########
arrow-ipc/src/writer.rs:
##########
@@ -135,6 +135,226 @@ impl<'a> IpcBodySink<'a> {
}
}
+struct MetadataLayout {
+ padded_header_len: usize,
+ padded_metadata_len: usize,
+ metadata_padding: usize,
+}
+
+#[inline]
+fn metadata_layout(metadata_len: usize, write_options: &IpcWriteOptions) ->
MetadataLayout {
+ let prefix_size = if write_options.write_legacy_ipc_format {
+ 4
+ } else {
+ 8
+ };
+ let alignment_mask = usize::from(write_options.alignment - 1);
+ let padded_header_len = (metadata_len + prefix_size + alignment_mask) &
!alignment_mask;
+ let padded_metadata_len = padded_header_len - prefix_size;
+ let metadata_padding = padded_metadata_len - metadata_len;
+
+ MetadataLayout {
+ padded_header_len,
+ padded_metadata_len,
+ metadata_padding,
+ }
+}
+
+/// Destination for a complete framed IPC message.
+///
+/// This emits the stream/file framing around the serialized FlatBuffer
+/// [`crate::Message`] metadata plus its optional body buffers.
Review Comment:
Done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]