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 38370cbb8 Add RowFormatter to record public API (#2009)
38370cbb8 is described below

commit 38370cbb8cdd87eb1b365733421392c3b6aad6f6
Author: Fabio Silva <[email protected]>
AuthorDate: Wed Jul 6 09:36:22 2022 -0400

    Add RowFormatter to record public API (#2009)
---
 parquet/src/record/api.rs | 17 +++++++++++++++++
 parquet/src/record/mod.rs |  5 ++++-
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/parquet/src/record/api.rs b/parquet/src/record/api.rs
index 5df21e4b0..0a360fd29 100644
--- a/parquet/src/record/api.rs
+++ b/parquet/src/record/api.rs
@@ -134,6 +134,23 @@ pub trait RowAccessor {
 }
 
 /// Trait for formating fields within a Row.
+///
+/// # Examples
+///
+/// ```
+/// use std::fs::File;
+/// use std::path::Path;
+/// use parquet::record::Row;
+/// use parquet::record::RowFormatter;
+/// use parquet::file::reader::{FileReader, SerializedFileReader};
+///
+/// if let Ok(file) = File::open(&Path::new("test.parquet")) {
+///     let reader = SerializedFileReader::new(file).unwrap();
+///     let row = reader.get_row_iter(None).unwrap().next().unwrap();
+///     println!("column 0: {}, column 1: {}", row.fmt(0), row.fmt(1));
+/// }
+/// ```
+///
 pub trait RowFormatter {
     fn fmt(&self, i: usize) -> &dyn fmt::Display;
 }
diff --git a/parquet/src/record/mod.rs b/parquet/src/record/mod.rs
index 1202665a7..ce83cfa2b 100644
--- a/parquet/src/record/mod.rs
+++ b/parquet/src/record/mod.rs
@@ -23,6 +23,9 @@ mod record_writer;
 mod triplet;
 
 pub use self::{
-    api::{Field, List, ListAccessor, Map, MapAccessor, Row, RowAccessor, 
RowColumnIter},
+    api::{
+        Field, List, ListAccessor, Map, MapAccessor, Row, RowAccessor, 
RowColumnIter,
+        RowFormatter,
+    },
     record_writer::RecordWriter,
 };

Reply via email to