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 2023/04/29 13:53:51 UTC

[arrow-rs] branch master updated: Make arrow_json::ReaderBuilder method names consistent (#4128)

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 9d72cc598 Make arrow_json::ReaderBuilder method names consistent (#4128)
9d72cc598 is described below

commit 9d72cc5986ed4673d35e29c9de14097e04f21446
Author: Raphael Taylor-Davies <17...@users.noreply.github.com>
AuthorDate: Sat Apr 29 09:53:44 2023 -0400

    Make arrow_json::ReaderBuilder method names consistent (#4128)
---
 arrow-json/src/reader/mod.rs | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/arrow-json/src/reader/mod.rs b/arrow-json/src/reader/mod.rs
index 9541e0372..5f1a2bb43 100644
--- a/arrow-json/src/reader/mod.rs
+++ b/arrow-json/src/reader/mod.rs
@@ -195,8 +195,16 @@ impl ReaderBuilder {
         Self { batch_size, ..self }
     }
 
-    /// Sets if the decoder should coerce primitive values (bool and number) into string when the Schema's column is Utf8 or LargeUtf8.
+    /// Sets if the decoder should coerce primitive values (bool and number) into string
+    /// when the Schema's column is Utf8 or LargeUtf8.
+    #[deprecated(note = "Use with_coerce_primitive")]
     pub fn coerce_primitive(self, coerce_primitive: bool) -> Self {
+        self.with_coerce_primitive(coerce_primitive)
+    }
+
+    /// Sets if the decoder should coerce primitive values (bool and number) into string
+    /// when the Schema's column is Utf8 or LargeUtf8.
+    pub fn with_coerce_primitive(self, coerce_primitive: bool) -> Self {
         Self {
             coerce_primitive,
             ..self
@@ -669,7 +677,7 @@ mod tests {
         for batch_size in [1, 3, 100, batch_size] {
             unbuffered = ReaderBuilder::new(schema.clone())
                 .with_batch_size(batch_size)
-                .coerce_primitive(coerce_primitive)
+                .with_coerce_primitive(coerce_primitive)
                 .build(Cursor::new(buf.as_bytes()))
                 .unwrap()
                 .collect::<Result<Vec<_>, _>>()
@@ -683,7 +691,7 @@ mod tests {
             for b in [1, 3, 5] {
                 let buffered = ReaderBuilder::new(schema.clone())
                     .with_batch_size(batch_size)
-                    .coerce_primitive(coerce_primitive)
+                    .with_coerce_primitive(coerce_primitive)
                     .build(BufReader::with_capacity(b, Cursor::new(buf.as_bytes())))
                     .unwrap()
                     .collect::<Result<Vec<_>, _>>()