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

sunchao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 296656e  ARROW-4678: [Rust] Minimize unstable feature usage
296656e is described below

commit 296656e2da7c7b2be9287a89d9d3d34d34704548
Author: Steven Fackler <sfack...@palantir.com>
AuthorDate: Thu Feb 28 00:33:29 2019 -0800

    ARROW-4678: [Rust] Minimize unstable feature usage
    
    Author: Steven Fackler <sfack...@palantir.com>
    
    Closes #3764 from sfackler/more-stable and squashes the following commits:
    
    0de1bcf5 <Steven Fackler> Remove unused alloc serde feature
    92b75cb8 <Steven Fackler> Remove unused type ascription feature
    1b910829 <Steven Fackler> Remove box_patterns feature
    c0c0eb0d <Steven Fackler> Remove box_syntax feature
    f04881aa <Steven Fackler> Remove unused rustc_private feature
---
 rust/arrow/Cargo.toml         |  2 +-
 rust/arrow/src/json/reader.rs | 90 +++++++++++++++++++++----------------------
 rust/arrow/src/lib.rs         |  4 --
 rust/datafusion/Cargo.toml    |  2 +-
 rust/parquet/src/lib.rs       |  2 -
 5 files changed, 47 insertions(+), 53 deletions(-)

diff --git a/rust/arrow/Cargo.toml b/rust/arrow/Cargo.toml
index 0ff44cd..ac4c4db 100644
--- a/rust/arrow/Cargo.toml
+++ b/rust/arrow/Cargo.toml
@@ -37,7 +37,7 @@ path = "src/lib.rs"
 [dependencies]
 bytes = "0.4"
 libc = "0.2"
-serde = { version = "1.0.80", features = ["alloc", "rc"] }
+serde = { version = "1.0.80", features = ["rc"] }
 serde_derive = "1.0.80"
 serde_json = { version = "1.0.13", features = ["preserve_order"] }
 indexmap = "1.0"
diff --git a/rust/arrow/src/json/reader.rs b/rust/arrow/src/json/reader.rs
index 5ab0ce0..1495492 100644
--- a/rust/arrow/src/json/reader.rs
+++ b/rust/arrow/src/json/reader.rs
@@ -66,55 +66,55 @@ fn coerce_data_type(dt: Vec<&DataType>) -> Result<DataType> 
{
         1 => Ok(dt[0].clone()),
         2 => {
             // there can be a case where a list and scalar both exist
-            if dt.contains(&&DataType::List(box DataType::Float64))
-                || dt.contains(&&DataType::List(box DataType::Int64))
-                || dt.contains(&&DataType::List(box DataType::Boolean))
-                || dt.contains(&&DataType::List(box DataType::Utf8))
+            if dt.contains(&&DataType::List(Box::new(DataType::Float64)))
+                || dt.contains(&&DataType::List(Box::new(DataType::Int64)))
+                || dt.contains(&&DataType::List(Box::new(DataType::Boolean)))
+                || dt.contains(&&DataType::List(Box::new(DataType::Utf8)))
             {
                 // we have a list and scalars, so we should get the values and 
coerce them
                 let mut dt = dt;
                 // sorting guarantees that the list will be the second value
                 dt.sort();
                 match (dt[0], dt[1]) {
-                    (t1, DataType::List(box DataType::Float64)) => {
+                    (t1, DataType::List(e)) if **e == DataType::Float64 => {
                         if t1 == &DataType::Float64 {
-                            Ok(DataType::List(box DataType::Float64))
+                            Ok(DataType::List(Box::new(DataType::Float64)))
                         } else {
-                            Ok(DataType::List(box coerce_data_type(vec![
+                            Ok(DataType::List(Box::new(coerce_data_type(vec![
                                 t1,
                                 &DataType::Float64,
-                            ])?))
+                            ])?)))
                         }
                     }
-                    (t1, DataType::List(box DataType::Int64)) => {
+                    (t1, DataType::List(e)) if **e == DataType::Int64 => {
                         if t1 == &DataType::Int64 {
-                            Ok(DataType::List(box DataType::Int64))
+                            Ok(DataType::List(Box::new(DataType::Int64)))
                         } else {
-                            Ok(DataType::List(box coerce_data_type(vec![
+                            Ok(DataType::List(Box::new(coerce_data_type(vec![
                                 t1,
                                 &DataType::Int64,
-                            ])?))
+                            ])?)))
                         }
                     }
-                    (t1, DataType::List(box DataType::Boolean)) => {
+                    (t1, DataType::List(e)) if **e == DataType::Boolean => {
                         if t1 == &DataType::Boolean {
-                            Ok(DataType::List(box DataType::Boolean))
+                            Ok(DataType::List(Box::new(DataType::Boolean)))
                         } else {
-                            Ok(DataType::List(box coerce_data_type(vec![
+                            Ok(DataType::List(Box::new(coerce_data_type(vec![
                                 t1,
                                 &DataType::Boolean,
-                            ])?))
+                            ])?)))
                         }
                     }
-                    (t1, DataType::List(box DataType::Utf8)) => {
+                    (t1, DataType::List(e)) if **e == DataType::Utf8 => {
                         if t1 == &DataType::Utf8 {
-                            Ok(DataType::List(box DataType::Utf8))
+                            Ok(DataType::List(Box::new(DataType::Utf8)))
                         } else {
                             dbg!(&t1);
-                            Ok(DataType::List(box coerce_data_type(vec![
+                            Ok(DataType::List(Box::new(coerce_data_type(vec![
                                 t1,
                                 &DataType::Utf8,
-                            ])?))
+                            ])?)))
                         }
                     }
                     (t1 @ _, t2 @ _) => Err(ArrowError::JsonError(format!(
@@ -131,7 +131,7 @@ fn coerce_data_type(dt: Vec<&DataType>) -> Result<DataType> 
{
         _ => {
             // TODO(nevi_me) It's possible to have [float, int, list(float)], 
which should
             // return list(float). Will hash this out later
-            Ok(DataType::List(box DataType::Utf8))
+            Ok(DataType::List(Box::new(DataType::Utf8)))
         }
     }
 }
@@ -218,11 +218,11 @@ fn infer_json_schema(file: File, max_read_records: 
Option<usize>) -> Result<Arc<
 
                                             if values.contains_key(k) {
                                                 let x = 
values.get_mut(k).unwrap();
-                                                x.insert(DataType::List(box 
dt));
+                                                
x.insert(DataType::List(Box::new(dt)));
                                             } else {
                                                 // create hashset and add 
value type
                                                 let mut hs = HashSet::new();
-                                                hs.insert(DataType::List(box 
dt));
+                                                
hs.insert(DataType::List(Box::new(dt)));
                                                 values.insert(k.to_string(), 
hs);
                                             }
                                         }
@@ -411,19 +411,19 @@ impl<R: Read> Reader<R> {
                         }
                         Ok(Arc::new(builder.finish()) as ArrayRef)
                     }
-                    DataType::List(ref t) => match t {
-                        box DataType::Int8 => 
self.build_list_array::<Int8Type>(rows, field.name()),
-                        box DataType::Int16 => 
self.build_list_array::<Int16Type>(rows, field.name()),
-                        box DataType::Int32 => 
self.build_list_array::<Int32Type>(rows, field.name()),
-                        box DataType::Int64 => 
self.build_list_array::<Int64Type>(rows, field.name()),
-                        box DataType::UInt8 => 
self.build_list_array::<UInt8Type>(rows, field.name()),
-                        box DataType::UInt16 => 
self.build_list_array::<UInt16Type>(rows, field.name()),
-                        box DataType::UInt32 => 
self.build_list_array::<UInt32Type>(rows, field.name()),
-                        box DataType::UInt64 => 
self.build_list_array::<UInt64Type>(rows, field.name()),
-                        box DataType::Float32 => 
self.build_list_array::<Float32Type>(rows, field.name()),
-                        box DataType::Float64 => 
self.build_list_array::<Float64Type>(rows, field.name()),
-                        box DataType::Boolean => 
self.build_boolean_list_array(rows, field.name()),
-                        box DataType::Utf8 => {
+                    DataType::List(ref t) => match **t {
+                        DataType::Int8 => 
self.build_list_array::<Int8Type>(rows, field.name()),
+                        DataType::Int16 => 
self.build_list_array::<Int16Type>(rows, field.name()),
+                        DataType::Int32 => 
self.build_list_array::<Int32Type>(rows, field.name()),
+                        DataType::Int64 => 
self.build_list_array::<Int64Type>(rows, field.name()),
+                        DataType::UInt8 => 
self.build_list_array::<UInt8Type>(rows, field.name()),
+                        DataType::UInt16 => 
self.build_list_array::<UInt16Type>(rows, field.name()),
+                        DataType::UInt32 => 
self.build_list_array::<UInt32Type>(rows, field.name()),
+                        DataType::UInt64 => 
self.build_list_array::<UInt64Type>(rows, field.name()),
+                        DataType::Float32 => 
self.build_list_array::<Float32Type>(rows, field.name()),
+                        DataType::Float64 => 
self.build_list_array::<Float64Type>(rows, field.name()),
+                        DataType::Boolean => 
self.build_boolean_list_array(rows, field.name()),
+                        DataType::Utf8 => {
                             let values_builder = BinaryBuilder::new(rows.len() 
* 5);
                             let mut builder = ListBuilder::new(values_builder);
                             for row_index in 0..rows.len() {
@@ -997,21 +997,21 @@ mod tests {
         use crate::datatypes::DataType::*;
 
         assert_eq!(
-            List(box Float64),
-            coerce_data_type(vec![&Float64, &List(box Float64)]).unwrap()
+            List(Box::new(Float64)),
+            coerce_data_type(vec![&Float64, &List(Box::new(Float64))]).unwrap()
         );
         assert_eq!(
-            List(box Float64),
-            coerce_data_type(vec![&Float64, &List(box Int64)]).unwrap()
+            List(Box::new(Float64)),
+            coerce_data_type(vec![&Float64, &List(Box::new(Int64))]).unwrap()
         );
         assert_eq!(
-            List(box Int64),
-            coerce_data_type(vec![&Int64, &List(box Int64)]).unwrap()
+            List(Box::new(Int64)),
+            coerce_data_type(vec![&Int64, &List(Box::new(Int64))]).unwrap()
         );
         // boolean an number are incompatible, return utf8
         assert_eq!(
-            List(box Utf8),
-            coerce_data_type(vec![&Boolean, &List(box Float64)]).unwrap()
+            List(Box::new(Utf8)),
+            coerce_data_type(vec![&Boolean, &List(Box::new(Float64))]).unwrap()
         );
     }
 
@@ -1041,7 +1041,7 @@ mod tests {
             c.1.data_type()
         );
         let d = schema.column_with_name("d").unwrap();
-        assert_eq!(&DataType::List(box DataType::Utf8), d.1.data_type());
+        assert_eq!(&DataType::List(Box::new(DataType::Utf8)), d.1.data_type());
 
         let bb = batch
             .column(b.0)
diff --git a/rust/arrow/src/lib.rs b/rust/arrow/src/lib.rs
index 28a15ac..69e8530 100644
--- a/rust/arrow/src/lib.rs
+++ b/rust/arrow/src/lib.rs
@@ -21,11 +21,7 @@
 //! Currently the project is developed and tested against nightly Rust. To 
learn more
 //! about the status of Arrow in Rust, see `README.md`.
 
-#![feature(type_ascription)]
-#![feature(rustc_private)]
 #![feature(specialization)]
-// required for matching box in lists
-#![feature(box_syntax, box_patterns)]
 #![allow(dead_code)]
 #![allow(non_camel_case_types)]
 
diff --git a/rust/datafusion/Cargo.toml b/rust/datafusion/Cargo.toml
index 0bcbc89..50986d9 100644
--- a/rust/datafusion/Cargo.toml
+++ b/rust/datafusion/Cargo.toml
@@ -40,7 +40,7 @@ fnv = "1.0.3"
 arrow = { path = "../arrow" }
 parquet = { path = "../parquet" }
 datafusion-rustyline = "2.0.0-alpha-20180628"
-serde = { version = "1.0.80", features = ["alloc", "rc"] }
+serde = { version = "1.0.80", features = ["rc"] }
 serde_derive = "1.0.80"
 serde_json = "1.0.33"
 sqlparser = "0.2.0"
diff --git a/rust/parquet/src/lib.rs b/rust/parquet/src/lib.rs
index 2063c56..b01bc72 100644
--- a/rust/parquet/src/lib.rs
+++ b/rust/parquet/src/lib.rs
@@ -15,8 +15,6 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#![feature(type_ascription)]
-#![feature(rustc_private)]
 #![feature(specialization)]
 #![allow(dead_code)]
 #![allow(non_camel_case_types)]

Reply via email to