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/08/03 20:52:13 UTC

[arrow-rs] branch master updated: Remove test_utils from default features (#2298) (#2299)

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 f40403f54 Remove test_utils from default features (#2298) (#2299)
f40403f54 is described below

commit f40403f54ef8f552b87ab78877a59dbb3aff1c14
Author: Raphael Taylor-Davies <17...@users.noreply.github.com>
AuthorDate: Wed Aug 3 21:52:06 2022 +0100

    Remove test_utils from default features (#2298) (#2299)
    
    * Remove test_utils from default features (#2298)
    
    * Fix doctest
---
 arrow/Cargo.toml                | 16 ++++++++++------
 arrow/examples/dynamic_types.rs | 10 ++--------
 arrow/src/csv/writer.rs         |  6 ++----
 arrow/src/util/mod.rs           |  4 ++--
 4 files changed, 16 insertions(+), 20 deletions(-)

diff --git a/arrow/Cargo.toml b/arrow/Cargo.toml
index dcecdb674..2bd0885b1 100644
--- a/arrow/Cargo.toml
+++ b/arrow/Cargo.toml
@@ -23,7 +23,7 @@ homepage = "https://github.com/apache/arrow-rs"
 repository = "https://github.com/apache/arrow-rs"
 authors = ["Apache Arrow <de...@arrow.apache.org>"]
 license = "Apache-2.0"
-keywords = [ "arrow" ]
+keywords = ["arrow"]
 include = [
     "benches/*.rs",
     "src/**/*.rs",
@@ -43,17 +43,17 @@ serde = { version = "1.0", default-features = false }
 serde_derive = { version = "1.0", default-features = false }
 serde_json = { version = "1.0", default-features = false, features = ["std"] }
 indexmap = { version = "1.9", default-features = false, features = ["std"] }
-rand = { version = "0.8", default-features = false, features =  ["std", "std_rng"], optional = true }
+rand = { version = "0.8", default-features = false, features = ["std", "std_rng"], optional = true }
 num = { version = "0.4", default-features = false, features = ["std"] }
 half = { version = "2.0", default-features = false }
 hashbrown = { version = "0.12", default-features = false }
-csv_crate = { version = "1.1", default-features = false, optional = true, package="csv" }
+csv_crate = { version = "1.1", default-features = false, optional = true, package = "csv" }
 regex = { version = "1.5.6", default-features = false, features = ["std", "unicode"] }
 regex-syntax = { version = "0.6.27", default-features = false, features = ["unicode"] }
 lazy_static = { version = "1.4", default-features = false }
 packed_simd = { version = "0.3", default-features = false, optional = true, package = "packed_simd_2" }
 chrono = { version = "0.4", default-features = false, features = ["clock"] }
-chrono-tz = {version = "0.6", default-features = false, optional = true}
+chrono-tz = { version = "0.6", default-features = false, optional = true }
 flatbuffers = { version = "2.1.2", default-features = false, features = ["thiserror"], optional = true }
 hex = { version = "0.4", default-features = false, features = ["std"] }
 comfy-table = { version = "6.0", optional = true, default-features = false }
@@ -63,7 +63,7 @@ multiversion = { version = "0.6.1", default-features = false }
 bitflags = { version = "1.2.1", default-features = false }
 
 [features]
-default = ["csv", "ipc", "test_utils"]
+default = ["csv", "ipc"]
 csv = ["csv_crate"]
 ipc = ["flatbuffers"]
 simd = ["packed_simd"]
@@ -80,13 +80,17 @@ pyarrow = ["pyo3"]
 force_validate = []
 
 [dev-dependencies]
-rand = { version = "0.8", default-features = false, features =  ["std", "std_rng"] }
+rand = { version = "0.8", default-features = false, features = ["std", "std_rng"] }
 criterion = { version = "0.3", default-features = false }
 flate2 = { version = "1", default-features = false, features = ["rust_backend"] }
 tempfile = { version = "3", default-features = false }
 
 [build-dependencies]
 
+[[example]]
+name = "dynamic_types"
+required-features = ["prettyprint"]
+
 [[bench]]
 name = "aggregate_kernels"
 harness = false
diff --git a/arrow/examples/dynamic_types.rs b/arrow/examples/dynamic_types.rs
index f98596f2e..eefbf6dcd 100644
--- a/arrow/examples/dynamic_types.rs
+++ b/arrow/examples/dynamic_types.rs
@@ -65,10 +65,7 @@ fn main() -> Result<()> {
     let batch =
         RecordBatch::try_new(Arc::new(schema), vec![Arc::new(id), Arc::new(nested)])?;
 
-    #[cfg(feature = "prettyprint")]
-    {
-        print_batches(&[batch.clone()]).unwrap();
-    }
+    print_batches(&[batch.clone()]).unwrap();
 
     process(&batch);
     Ok(())
@@ -108,8 +105,5 @@ fn process(batch: &RecordBatch) {
     )
     .unwrap();
 
-    #[cfg(feature = "prettyprint")]
-    {
-        print_batches(&[projection]).unwrap();
-    }
+    print_batches(&[projection]).unwrap();
 }
diff --git a/arrow/src/csv/writer.rs b/arrow/src/csv/writer.rs
index 394047cac..7097706ba 100644
--- a/arrow/src/csv/writer.rs
+++ b/arrow/src/csv/writer.rs
@@ -27,8 +27,6 @@
 //! use arrow::csv;
 //! use arrow::datatypes::*;
 //! use arrow::record_batch::RecordBatch;
-//! use arrow::util::test_util::get_temp_file;
-//! use std::fs::File;
 //! use std::sync::Arc;
 //!
 //! let schema = Schema::new(vec![
@@ -56,9 +54,9 @@
 //! )
 //! .unwrap();
 //!
-//! let file = get_temp_file("out.csv", &[]);
+//! let mut output = Vec::with_capacity(1024);
 //!
-//! let mut writer = csv::Writer::new(file);
+//! let mut writer = csv::Writer::new(&mut output);
 //! let batches = vec![&batch, &batch];
 //! for batch in batches {
 //!     writer.write(batch).unwrap();
diff --git a/arrow/src/util/mod.rs b/arrow/src/util/mod.rs
index 86253da8d..1ee05d8a0 100644
--- a/arrow/src/util/mod.rs
+++ b/arrow/src/util/mod.rs
@@ -24,13 +24,13 @@ pub mod bit_util;
 #[cfg(feature = "test_utils")]
 pub mod data_gen;
 pub mod display;
-#[cfg(feature = "test_utils")]
+#[cfg(any(test, feature = "test_utils"))]
 pub mod integration_util;
 #[cfg(feature = "prettyprint")]
 pub mod pretty;
 pub(crate) mod serialization;
 pub mod string_writer;
-#[cfg(feature = "test_utils")]
+#[cfg(any(test, feature = "test_utils"))]
 pub mod test_util;
 
 mod trusted_len;