You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by al...@apache.org on 2023/01/01 17:24:17 UTC

[arrow-rs] branch master updated: Minor: Improve docs for arrow-ipc, remove clippy ignore (#3421)

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

alamb 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 2408bb274 Minor: Improve docs for arrow-ipc, remove clippy ignore (#3421)
2408bb274 is described below

commit 2408bb274e82c785cca9b4596cd8f201ccc5d7c6
Author: Andrew Lamb <an...@nerdnetworks.org>
AuthorDate: Sun Jan 1 12:24:12 2023 -0500

    Minor: Improve docs for arrow-ipc, remove clippy ignore (#3421)
    
    * Minor: Add doc example to IpcDataGenerator
    
    * Improve docs / cleanup
    
    * Update doc links
---
 arrow-ipc/src/lib.rs    |  7 +++----
 arrow-ipc/src/writer.rs | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/arrow-ipc/src/lib.rs b/arrow-ipc/src/lib.rs
index 38217957d..4f35ffb60 100644
--- a/arrow-ipc/src/lib.rs
+++ b/arrow-ipc/src/lib.rs
@@ -15,10 +15,9 @@
 // specific language governing permissions and limitations
 // under the License.
 
-//! Support for the Arrow IPC format
-
-// TODO: (vcq): Protobuf codegen is not generating Debug impls.
-#![allow(missing_debug_implementations)]
+//! Support for the [Arrow IPC Format]
+//!
+//! [Arrow IPC Format]: https://arrow.apache.org/docs/format/Columnar.html#serialization-and-interprocess-communication-ipc
 
 pub mod convert;
 pub mod reader;
diff --git a/arrow-ipc/src/writer.rs b/arrow-ipc/src/writer.rs
index 82cf2c90b..e4dcab40a 100644
--- a/arrow-ipc/src/writer.rs
+++ b/arrow-ipc/src/writer.rs
@@ -137,6 +137,38 @@ impl Default for IpcWriteOptions {
 }
 
 #[derive(Debug, Default)]
+/// Handles low level details of encoding [`Array`] and [`Schema`] into the
+/// [Arrow IPC Format].
+///
+/// # Example:
+/// ```
+/// # fn run() {
+/// # use std::sync::Arc;
+/// # use arrow_array::UInt64Array;
+/// # use arrow_array::RecordBatch;
+/// # use arrow_ipc::writer::{DictionaryTracker, IpcDataGenerator, IpcWriteOptions};
+///
+/// // Create a record batch
+/// let batch = RecordBatch::try_from_iter(vec![
+///  ("col2", Arc::new(UInt64Array::from_iter([10, 23, 33])) as _)
+/// ]).unwrap();
+///
+/// // Error of dictionary ids are replaced.
+/// let error_on_replacement = true;
+/// let options = IpcWriteOptions::default();
+/// let mut dictionary_tracker = DictionaryTracker::new(error_on_replacement);
+///
+/// // encode the batch into zero or more encoded dictionaries
+/// // and the data for the actual array.
+/// let data_gen = IpcDataGenerator {};
+/// let (encoded_dictionaries, encoded_message) = data_gen
+///   .encoded_batch(&batch, &mut dictionary_tracker, &options)
+///   .unwrap();
+/// # }
+/// ```
+///
+/// [Arrow IPC Format]: https://arrow.apache.org/docs/format/Columnar.html#serialization-and-interprocess-communication-ipc
+
 pub struct IpcDataGenerator {}
 
 impl IpcDataGenerator {