You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by tu...@apache.org on 2022/10/16 06:14:36 UTC

[arrow-rs] branch master updated: Increase default IPC alignment to 64 (#2883) (#2884)

This is an automated email from the ASF dual-hosted git repository.

tustvold pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git


The following commit(s) were added to refs/heads/master by this push:
     new a3effc19c Increase default IPC alignment to 64 (#2883) (#2884)
a3effc19c is described below

commit a3effc19cc13d5612ffcca5c04c44dee0995dd46
Author: Raphael Taylor-Davies <17...@users.noreply.github.com>
AuthorDate: Sun Oct 16 19:14:30 2022 +1300

    Increase default IPC alignment to 64 (#2883) (#2884)
    
    * Increase default IPC alignment to 64 (#2883)
    
    * Update test
---
 arrow/src/ipc/writer.rs | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/arrow/src/ipc/writer.rs b/arrow/src/ipc/writer.rs
index 63f1520a5..4f40574ab 100644
--- a/arrow/src/ipc/writer.rs
+++ b/arrow/src/ipc/writer.rs
@@ -46,7 +46,7 @@ use ipc::CONTINUATION_MARKER;
 #[derive(Debug, Clone)]
 pub struct IpcWriteOptions {
     /// Write padding after memory buffers to this multiple of bytes.
-    /// Generally 8 or 64, defaults to 8
+    /// Generally 8 or 64, defaults to 64
     alignment: usize,
     /// The legacy format is for releases before 0.15.0, and uses metadata V4
     write_legacy_ipc_format: bool,
@@ -132,7 +132,7 @@ impl IpcWriteOptions {
 impl Default for IpcWriteOptions {
     fn default() -> Self {
         Self {
-            alignment: 8,
+            alignment: 64,
             write_legacy_ipc_format: false,
             metadata_version: ipc::MetadataVersion::V5,
             batch_compression_type: None,
@@ -788,7 +788,8 @@ impl<W: Write> StreamWriter<W> {
     ///
     /// ```
     /// # use arrow::datatypes::Schema;
-    /// # use arrow::ipc::writer::StreamWriter;
+    /// # use arrow::ipc::writer::{StreamWriter, IpcWriteOptions};
+    /// # use arrow::ipc::MetadataVersion;
     /// # use arrow::error::ArrowError;
     /// # fn main() -> Result<(), ArrowError> {
     /// // The result we expect from an empty schema
@@ -807,7 +808,8 @@ impl<W: Write> StreamWriter<W> {
     ///
     /// let schema = Schema::new(vec![]);
     /// let buffer: Vec<u8> = Vec::new();
-    /// let stream_writer = StreamWriter::try_new(buffer, &schema)?;
+    /// let options = IpcWriteOptions::try_new(8, false, MetadataVersion::V5)?;
+    /// let stream_writer = StreamWriter::try_new_with_options(buffer, &schema, options)?;
     ///
     /// assert_eq!(stream_writer.into_inner()?, expected);
     /// # Ok(())