You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by yj...@apache.org on 2022/04/18 05:51:22 UTC
[arrow-rs] branch master updated: Derive `Clone` and `PartialEq` for json `DecoderOptions` (#1581)
This is an automated email from the ASF dual-hosted git repository.
yjshen 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 db4cb8fee Derive `Clone` and `PartialEq` for json `DecoderOptions` (#1581)
db4cb8fee is described below
commit db4cb8feea243ab4f11fd915bad74128b3ea329e
Author: Andrew Lamb <an...@nerdnetworks.org>
AuthorDate: Mon Apr 18 01:51:18 2022 -0400
Derive `Clone` and `PartialEq` for json `DecoderOptions` (#1581)
* Implement Clone and PartialEq for DecoderOptions
* fmt
---
arrow/src/json/reader.rs | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/arrow/src/json/reader.rs b/arrow/src/json/reader.rs
index d9ec407ff..f224b3b5b 100644
--- a/arrow/src/json/reader.rs
+++ b/arrow/src/json/reader.rs
@@ -590,13 +590,14 @@ pub struct Decoder {
options: DecoderOptions,
}
-#[derive(Debug)]
+#[derive(Debug, Clone, PartialEq)]
+/// Options for JSON decoding
pub struct DecoderOptions {
/// Batch size (number of records to load each time), defaults to 1024 records
batch_size: usize,
/// Optional projection for which columns to load (case-sensitive names)
projection: Option<Vec<String>>,
- /// optional HashMap of column names to its format string
+ /// optional HashMap of column name to its format string
format_strings: Option<HashMap<String, String>>,
}
@@ -3322,4 +3323,12 @@ mod tests {
assert_eq!(3, num_batches);
assert_eq!(100000000000011, sum_a);
}
+
+ #[test]
+ fn test_options_clone() {
+ // ensure options have appropriate derivation
+ let options = DecoderOptions::new().with_batch_size(64);
+ let cloned = options.clone();
+ assert_eq!(options, cloned);
+ }
}