You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ks...@apache.org on 2019/06/26 11:03:48 UTC
[arrow] branch master updated: ARROW-5721: [Rust] Move array
related code into a separate module
This is an automated email from the ASF dual-hosted git repository.
kszucs 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 47719df ARROW-5721: [Rust] Move array related code into a separate module
47719df is described below
commit 47719df6eac07b3ef73c13c107d4c1b7dae8300a
Author: Chao Sun <su...@apache.org>
AuthorDate: Wed Jun 26 13:03:36 2019 +0200
ARROW-5721: [Rust] Move array related code into a separate module
This moves all array related code into a separate module `array`, and re-export public interfaces.
This allows us to:
1. Split array related implementations into multiple files (e.g., equality, display, etc).
2. Via re-exporting, we can keep the common structs/traits under the `arrow::array` namespace. So,
instead of saying:
```rust
import arrow::builder::Int32Builder;
```
We can say:
```rust
import arrow::array::Int32Builder;
```
which is more accurate.
Author: Chao Sun <su...@apache.org>
Author: Chao Sun <su...@uber.com>
Closes #4687 from sunchao/ARROW-5721 and squashes the following commits:
9cf953206 <Chao Sun> Fix lint
266d36e6d <Chao Sun> Fix array_data and test warnings
14b8fcb0c <Chao Sun> Rename array_data.rs to data.rs
1083d3660 <Chao Sun> Move array related code into a separate module
---
rust/arrow/examples/builders.rs | 2 +-
rust/arrow/examples/dynamic_types.rs | 2 +-
rust/arrow/src/{ => array}/array.rs | 69 +----------
rust/arrow/src/{ => array}/builder.rs | 47 --------
rust/arrow/src/{array_data.rs => array/data.rs} | 0
rust/arrow/src/array/mod.rs | 152 ++++++++++++++++++++++++
rust/arrow/src/buffer.rs | 2 +-
rust/arrow/src/compute/array_ops.rs | 1 -
rust/arrow/src/compute/kernels/arithmetic.rs | 2 -
rust/arrow/src/compute/kernels/boolean.rs | 3 +-
rust/arrow/src/compute/kernels/cast.rs | 2 -
rust/arrow/src/compute/kernels/comparison.rs | 2 -
rust/arrow/src/compute/kernels/temporal.rs | 1 -
rust/arrow/src/csv/reader.rs | 3 +-
rust/arrow/src/json/reader.rs | 1 -
rust/arrow/src/lib.rs | 2 -
rust/arrow/src/record_batch.rs | 1 -
rust/arrow/src/tensor.rs | 2 +-
rust/datafusion/src/datasource/parquet.rs | 5 +-
rust/datafusion/src/execution/aggregate.rs | 1 -
rust/datafusion/src/execution/context.rs | 3 +-
rust/datafusion/tests/sql.rs | 4 +-
rust/parquet/src/util/bit_util.rs | 4 +-
23 files changed, 168 insertions(+), 143 deletions(-)
diff --git a/rust/arrow/examples/builders.rs b/rust/arrow/examples/builders.rs
index c1aede8..69cad50 100644
--- a/rust/arrow/examples/builders.rs
+++ b/rust/arrow/examples/builders.rs
@@ -18,7 +18,7 @@
///! Many builders are available to easily create different types of arrow arrays
extern crate arrow;
-use arrow::builder::Int32Builder;
+use arrow::array::Int32Builder;
fn main() {
// Primitive Arrays
diff --git a/rust/arrow/examples/dynamic_types.rs b/rust/arrow/examples/dynamic_types.rs
index 2f361f4..0c07689 100644
--- a/rust/arrow/examples/dynamic_types.rs
+++ b/rust/arrow/examples/dynamic_types.rs
@@ -46,7 +46,7 @@ fn main() -> Result<()> {
let nested = StructArray::from(vec![
(
Field::new("a", DataType::Utf8, false),
- Arc::new(BinaryArray::from(vec!["a", "b", "c", "d", "e"])) as Arc<Array>,
+ Arc::new(BinaryArray::from(vec!["a", "b", "c", "d", "e"])) as Arc<dyn Array>,
),
(
Field::new("b", DataType::Float64, false),
diff --git a/rust/arrow/src/array.rs b/rust/arrow/src/array/array.rs
similarity index 96%
rename from rust/arrow/src/array.rs
rename to rust/arrow/src/array/array.rs
index 274a2b9..f4af117 100644
--- a/rust/arrow/src/array.rs
+++ b/rust/arrow/src/array/array.rs
@@ -15,45 +15,6 @@
// specific language governing permissions and limitations
// under the License.
-//! Defines public types representing Apache Arrow arrays. Arrow's specification defines
-//! an array as "a sequence of values with known length all having the same type." For
-//! example, the type `Int16Array` represents an Apache Arrow array of 16-bit integers.
-//!
-//! ```
-//! extern crate arrow;
-//!
-//! use arrow::array::Int16Array;
-//!
-//! // Create a new builder with a capacity of 100
-//! let mut builder = Int16Array::builder(100);
-//!
-//! // Append a single primitive value
-//! builder.append_value(1).unwrap();
-//!
-//! // Append a null value
-//! builder.append_null().unwrap();
-//!
-//! // Append a slice of primitive values
-//! builder.append_slice(&[2, 3, 4]).unwrap();
-//!
-//! // Build the array
-//! let array = builder.finish();
-//!
-//! assert_eq!(
-//! 5,
-//! array.len(),
-//! "The array has 5 values, counting the null value"
-//! );
-//!
-//! assert_eq!(2, array.value(2), "Get the value with index 2");
-//!
-//! assert_eq!(
-//! array.value_slice(3, 2),
-//! &[3, 4],
-//! "Get slice of len 2 starting at idx 3"
-//! )
-//! ```
-
use std::any::Any;
use std::convert::From;
use std::fmt;
@@ -63,9 +24,8 @@ use std::sync::Arc;
use chrono::prelude::*;
-use crate::array_data::{ArrayData, ArrayDataRef};
+use super::*;
use crate::buffer::{Buffer, MutableBuffer};
-use crate::builder::*;
use crate::datatypes::*;
use crate::memory;
use crate::util::bit_util;
@@ -131,7 +91,7 @@ pub type ArrayRef = Arc<Array>;
/// Constructs an array using the input `data`. Returns a reference-counted `Array`
/// instance.
-pub(crate) fn make_array(data: ArrayDataRef) -> ArrayRef {
+pub fn make_array(data: ArrayDataRef) -> ArrayRef {
// TODO: here data_type() needs to clone the type - maybe add a type tag enum to
// avoid the cloning.
match data.data_type().clone() {
@@ -234,30 +194,6 @@ pub struct PrimitiveArray<T: ArrowPrimitiveType> {
raw_values: RawPtrBox<T::Native>,
}
-pub type BooleanArray = PrimitiveArray<BooleanType>;
-pub type Int8Array = PrimitiveArray<Int8Type>;
-pub type Int16Array = PrimitiveArray<Int16Type>;
-pub type Int32Array = PrimitiveArray<Int32Type>;
-pub type Int64Array = PrimitiveArray<Int64Type>;
-pub type UInt8Array = PrimitiveArray<UInt8Type>;
-pub type UInt16Array = PrimitiveArray<UInt16Type>;
-pub type UInt32Array = PrimitiveArray<UInt32Type>;
-pub type UInt64Array = PrimitiveArray<UInt64Type>;
-pub type Float32Array = PrimitiveArray<Float32Type>;
-pub type Float64Array = PrimitiveArray<Float64Type>;
-
-pub type TimestampSecondArray = PrimitiveArray<TimestampSecondType>;
-pub type TimestampMillisecondArray = PrimitiveArray<TimestampMillisecondType>;
-pub type TimestampMicrosecondArray = PrimitiveArray<TimestampMicrosecondType>;
-pub type TimestampNanosecondArray = PrimitiveArray<TimestampNanosecondType>;
-pub type Date32Array = PrimitiveArray<Date32Type>;
-pub type Date64Array = PrimitiveArray<Date64Type>;
-pub type Time32SecondArray = PrimitiveArray<Time32SecondType>;
-pub type Time32MillisecondArray = PrimitiveArray<Time32MillisecondType>;
-pub type Time64MicrosecondArray = PrimitiveArray<Time64MicrosecondType>;
-pub type Time64NanosecondArray = PrimitiveArray<Time64NanosecondType>;
-// TODO add interval
-
impl<T: ArrowPrimitiveType> Array for PrimitiveArray<T> {
fn as_any(&self) -> &Any {
self
@@ -1041,7 +977,6 @@ mod tests {
use std::sync::Arc;
use std::thread;
- use crate::array_data::ArrayData;
use crate::buffer::Buffer;
use crate::datatypes::{DataType, Field};
use crate::memory;
diff --git a/rust/arrow/src/builder.rs b/rust/arrow/src/array/builder.rs
similarity index 94%
rename from rust/arrow/src/builder.rs
rename to rust/arrow/src/array/builder.rs
index 11d5f3c..b0b97c2 100644
--- a/rust/arrow/src/builder.rs
+++ b/rust/arrow/src/array/builder.rs
@@ -25,7 +25,6 @@ use std::mem;
use std::sync::Arc;
use crate::array::*;
-use crate::array_data::ArrayData;
use crate::buffer::{Buffer, MutableBuffer};
use crate::datatypes::*;
use crate::error::{ArrowError, Result};
@@ -38,29 +37,6 @@ pub struct BufferBuilder<T: ArrowPrimitiveType> {
_marker: PhantomData<T>,
}
-pub type BooleanBufferBuilder = BufferBuilder<BooleanType>;
-pub type Int8BufferBuilder = BufferBuilder<Int8Type>;
-pub type Int16BufferBuilder = BufferBuilder<Int16Type>;
-pub type Int32BufferBuilder = BufferBuilder<Int32Type>;
-pub type Int64BufferBuilder = BufferBuilder<Int64Type>;
-pub type UInt8BufferBuilder = BufferBuilder<UInt8Type>;
-pub type UInt16BufferBuilder = BufferBuilder<UInt16Type>;
-pub type UInt32BufferBuilder = BufferBuilder<UInt32Type>;
-pub type UInt64BufferBuilder = BufferBuilder<UInt64Type>;
-pub type Float32BufferBuilder = BufferBuilder<Float32Type>;
-pub type Float64BufferBuilder = BufferBuilder<Float64Type>;
-
-pub type TimestampSecondBufferBuilder = BufferBuilder<TimestampSecondType>;
-pub type TimestampMillisecondBufferBuilder = BufferBuilder<TimestampMillisecondType>;
-pub type TimestampMicrosecondBufferBuilder = BufferBuilder<TimestampMicrosecondType>;
-pub type TimestampNanosecondBufferBuilder = BufferBuilder<TimestampNanosecondType>;
-pub type Date32BufferBuilder = BufferBuilder<Date32Type>;
-pub type Date64BufferBuilder = BufferBuilder<Date64Type>;
-pub type Time32SecondBufferBuilder = BufferBuilder<Time32SecondType>;
-pub type Time32MillisecondBufferBuilder = BufferBuilder<Time32MillisecondType>;
-pub type Time64MicrosecondBufferBuilder = BufferBuilder<Time64MicrosecondType>;
-pub type Time64NanosecondBufferBuilder = BufferBuilder<Time64NanosecondType>;
-
// Trait for buffer builder. This is used mainly to offer separate implementations for
// numeric types and boolean types, while still be able to call methods on buffer builder
// with generic primitive type.
@@ -255,29 +231,6 @@ pub struct PrimitiveBuilder<T: ArrowPrimitiveType> {
bitmap_builder: BooleanBufferBuilder,
}
-pub type BooleanBuilder = PrimitiveBuilder<BooleanType>;
-pub type Int8Builder = PrimitiveBuilder<Int8Type>;
-pub type Int16Builder = PrimitiveBuilder<Int16Type>;
-pub type Int32Builder = PrimitiveBuilder<Int32Type>;
-pub type Int64Builder = PrimitiveBuilder<Int64Type>;
-pub type UInt8Builder = PrimitiveBuilder<UInt8Type>;
-pub type UInt16Builder = PrimitiveBuilder<UInt16Type>;
-pub type UInt32Builder = PrimitiveBuilder<UInt32Type>;
-pub type UInt64Builder = PrimitiveBuilder<UInt64Type>;
-pub type Float32Builder = PrimitiveBuilder<Float32Type>;
-pub type Float64Builder = PrimitiveBuilder<Float64Type>;
-
-pub type TimestampSecondBuilder = PrimitiveBuilder<TimestampSecondType>;
-pub type TimestampMillisecondBuilder = PrimitiveBuilder<TimestampMillisecondType>;
-pub type TimestampMicrosecondBuilder = PrimitiveBuilder<TimestampMicrosecondType>;
-pub type TimestampNanosecondBuilder = PrimitiveBuilder<TimestampNanosecondType>;
-pub type Date32Builder = PrimitiveBuilder<Date32Type>;
-pub type Date64Builder = PrimitiveBuilder<Date64Type>;
-pub type Time32SecondBuilder = PrimitiveBuilder<Time32SecondType>;
-pub type Time32MillisecondBuilder = PrimitiveBuilder<Time32MillisecondType>;
-pub type Time64MicrosecondBuilder = PrimitiveBuilder<Time64MicrosecondType>;
-pub type Time64NanosecondBuilder = PrimitiveBuilder<Time64NanosecondType>;
-
impl<T: ArrowPrimitiveType> ArrayBuilder for PrimitiveBuilder<T> {
/// Returns the builder as an non-mutable `Any` reference.
fn as_any(&self) -> &Any {
diff --git a/rust/arrow/src/array_data.rs b/rust/arrow/src/array/data.rs
similarity index 100%
rename from rust/arrow/src/array_data.rs
rename to rust/arrow/src/array/data.rs
diff --git a/rust/arrow/src/array/mod.rs b/rust/arrow/src/array/mod.rs
new file mode 100644
index 0000000..aa14f0f
--- /dev/null
+++ b/rust/arrow/src/array/mod.rs
@@ -0,0 +1,152 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! Defines public types representing Apache Arrow arrays. Arrow's specification defines
+//! an array as "a sequence of values with known length all having the same type." For
+//! example, the type `Int16Array` represents an Apache Arrow array of 16-bit integers.
+//!
+//! ```
+//! extern crate arrow;
+//!
+//! use arrow::array::Int16Array;
+//!
+//! // Create a new builder with a capacity of 100
+//! let mut builder = Int16Array::builder(100);
+//!
+//! // Append a single primitive value
+//! builder.append_value(1).unwrap();
+//!
+//! // Append a null value
+//! builder.append_null().unwrap();
+//!
+//! // Append a slice of primitive values
+//! builder.append_slice(&[2, 3, 4]).unwrap();
+//!
+//! // Build the array
+//! let array = builder.finish();
+//!
+//! assert_eq!(
+//! 5,
+//! array.len(),
+//! "The array has 5 values, counting the null value"
+//! );
+//!
+//! assert_eq!(2, array.value(2), "Get the value with index 2");
+//!
+//! assert_eq!(
+//! array.value_slice(3, 2),
+//! &[3, 4],
+//! "Get slice of len 2 starting at idx 3"
+//! )
+//! ```
+
+mod array;
+mod builder;
+mod data;
+
+pub use self::array::Array;
+pub use self::array::ArrayRef;
+pub use self::data::ArrayData;
+pub use self::data::ArrayDataBuilder;
+pub use self::data::ArrayDataRef;
+
+use crate::datatypes::*;
+
+pub use self::builder::BufferBuilder;
+pub use self::builder::BufferBuilderTrait;
+
+pub type BooleanBufferBuilder = BufferBuilder<BooleanType>;
+pub type Int8BufferBuilder = BufferBuilder<Int8Type>;
+pub type Int16BufferBuilder = BufferBuilder<Int16Type>;
+pub type Int32BufferBuilder = BufferBuilder<Int32Type>;
+pub type Int64BufferBuilder = BufferBuilder<Int64Type>;
+pub type UInt8BufferBuilder = BufferBuilder<UInt8Type>;
+pub type UInt16BufferBuilder = BufferBuilder<UInt16Type>;
+pub type UInt32BufferBuilder = BufferBuilder<UInt32Type>;
+pub type UInt64BufferBuilder = BufferBuilder<UInt64Type>;
+pub type Float32BufferBuilder = BufferBuilder<Float32Type>;
+pub type Float64BufferBuilder = BufferBuilder<Float64Type>;
+
+pub type TimestampSecondBufferBuilder = BufferBuilder<TimestampSecondType>;
+pub type TimestampMillisecondBufferBuilder = BufferBuilder<TimestampMillisecondType>;
+pub type TimestampMicrosecondBufferBuilder = BufferBuilder<TimestampMicrosecondType>;
+pub type TimestampNanosecondBufferBuilder = BufferBuilder<TimestampNanosecondType>;
+pub type Date32BufferBuilder = BufferBuilder<Date32Type>;
+pub type Date64BufferBuilder = BufferBuilder<Date64Type>;
+pub type Time32SecondBufferBuilder = BufferBuilder<Time32SecondType>;
+pub type Time32MillisecondBufferBuilder = BufferBuilder<Time32MillisecondType>;
+pub type Time64MicrosecondBufferBuilder = BufferBuilder<Time64MicrosecondType>;
+pub type Time64NanosecondBufferBuilder = BufferBuilder<Time64NanosecondType>;
+
+pub use self::builder::PrimitiveBuilder;
+pub type BooleanBuilder = PrimitiveBuilder<BooleanType>;
+pub type Int8Builder = PrimitiveBuilder<Int8Type>;
+pub type Int16Builder = PrimitiveBuilder<Int16Type>;
+pub type Int32Builder = PrimitiveBuilder<Int32Type>;
+pub type Int64Builder = PrimitiveBuilder<Int64Type>;
+pub type UInt8Builder = PrimitiveBuilder<UInt8Type>;
+pub type UInt16Builder = PrimitiveBuilder<UInt16Type>;
+pub type UInt32Builder = PrimitiveBuilder<UInt32Type>;
+pub type UInt64Builder = PrimitiveBuilder<UInt64Type>;
+pub type Float32Builder = PrimitiveBuilder<Float32Type>;
+pub type Float64Builder = PrimitiveBuilder<Float64Type>;
+
+pub type TimestampSecondBuilder = PrimitiveBuilder<TimestampSecondType>;
+pub type TimestampMillisecondBuilder = PrimitiveBuilder<TimestampMillisecondType>;
+pub type TimestampMicrosecondBuilder = PrimitiveBuilder<TimestampMicrosecondType>;
+pub type TimestampNanosecondBuilder = PrimitiveBuilder<TimestampNanosecondType>;
+pub type Date32Builder = PrimitiveBuilder<Date32Type>;
+pub type Date64Builder = PrimitiveBuilder<Date64Type>;
+pub type Time32SecondBuilder = PrimitiveBuilder<Time32SecondType>;
+pub type Time32MillisecondBuilder = PrimitiveBuilder<Time32MillisecondType>;
+pub type Time64MicrosecondBuilder = PrimitiveBuilder<Time64MicrosecondType>;
+pub type Time64NanosecondBuilder = PrimitiveBuilder<Time64NanosecondType>;
+
+pub use self::builder::BinaryBuilder;
+pub use self::builder::ListBuilder;
+pub use self::builder::StructBuilder;
+
+pub use self::array::BinaryArray;
+pub use self::array::ListArray;
+pub use self::array::PrimitiveArray;
+pub use self::array::StructArray;
+
+pub(crate) use self::array::make_array;
+
+pub type BooleanArray = PrimitiveArray<BooleanType>;
+pub type Int8Array = PrimitiveArray<Int8Type>;
+pub type Int16Array = PrimitiveArray<Int16Type>;
+pub type Int32Array = PrimitiveArray<Int32Type>;
+pub type Int64Array = PrimitiveArray<Int64Type>;
+pub type UInt8Array = PrimitiveArray<UInt8Type>;
+pub type UInt16Array = PrimitiveArray<UInt16Type>;
+pub type UInt32Array = PrimitiveArray<UInt32Type>;
+pub type UInt64Array = PrimitiveArray<UInt64Type>;
+pub type Float32Array = PrimitiveArray<Float32Type>;
+pub type Float64Array = PrimitiveArray<Float64Type>;
+
+pub type TimestampSecondArray = PrimitiveArray<TimestampSecondType>;
+pub type TimestampMillisecondArray = PrimitiveArray<TimestampMillisecondType>;
+pub type TimestampMicrosecondArray = PrimitiveArray<TimestampMicrosecondType>;
+pub type TimestampNanosecondArray = PrimitiveArray<TimestampNanosecondType>;
+pub type Date32Array = PrimitiveArray<Date32Type>;
+pub type Date64Array = PrimitiveArray<Date64Type>;
+pub type Time32SecondArray = PrimitiveArray<Time32SecondType>;
+pub type Time32MillisecondArray = PrimitiveArray<Time32MillisecondType>;
+pub type Time64MicrosecondArray = PrimitiveArray<Time64MicrosecondType>;
+pub type Time64NanosecondArray = PrimitiveArray<Time64NanosecondType>;
+// TODO add interval
diff --git a/rust/arrow/src/buffer.rs b/rust/arrow/src/buffer.rs
index 71ef42e..eea000f 100644
--- a/rust/arrow/src/buffer.rs
+++ b/rust/arrow/src/buffer.rs
@@ -29,7 +29,7 @@ use std::ops::{BitAnd, BitOr, Not};
use std::slice::{from_raw_parts, from_raw_parts_mut};
use std::sync::Arc;
-use crate::builder::{BufferBuilderTrait, UInt8BufferBuilder};
+use crate::array::{BufferBuilderTrait, UInt8BufferBuilder};
use crate::datatypes::ArrowNativeType;
use crate::error::{ArrowError, Result};
use crate::memory;
diff --git a/rust/arrow/src/compute/array_ops.rs b/rust/arrow/src/compute/array_ops.rs
index d9de6d7..2ac7339 100644
--- a/rust/arrow/src/compute/array_ops.rs
+++ b/rust/arrow/src/compute/array_ops.rs
@@ -199,7 +199,6 @@ pub fn limit(array: &ArrayRef, num_elements: usize) -> Result<ArrayRef> {
mod tests {
use super::*;
use crate::array::*;
- use crate::array_data::ArrayData;
use crate::buffer::Buffer;
use crate::datatypes::{Field, ToByteSlice};
use crate::util::bit_util;
diff --git a/rust/arrow/src/compute/kernels/arithmetic.rs b/rust/arrow/src/compute/kernels/arithmetic.rs
index bd26d44..abfdc1d 100644
--- a/rust/arrow/src/compute/kernels/arithmetic.rs
+++ b/rust/arrow/src/compute/kernels/arithmetic.rs
@@ -30,9 +30,7 @@ use std::sync::Arc;
use num::Zero;
use crate::array::*;
-use crate::array_data::ArrayData;
use crate::buffer::MutableBuffer;
-use crate::builder::PrimitiveBuilder;
use crate::compute::util::apply_bin_op_to_option_bitmap;
use crate::datatypes;
use crate::error::{ArrowError, Result};
diff --git a/rust/arrow/src/compute/kernels/boolean.rs b/rust/arrow/src/compute/kernels/boolean.rs
index 56f873f..8aaf7a1 100644
--- a/rust/arrow/src/compute/kernels/boolean.rs
+++ b/rust/arrow/src/compute/kernels/boolean.rs
@@ -24,8 +24,7 @@
use std::sync::Arc;
-use crate::array::{Array, BooleanArray};
-use crate::array_data::ArrayData;
+use crate::array::{Array, ArrayData, BooleanArray};
use crate::buffer::Buffer;
use crate::compute::util::apply_bin_op_to_option_bitmap;
use crate::datatypes::DataType;
diff --git a/rust/arrow/src/compute/kernels/cast.rs b/rust/arrow/src/compute/kernels/cast.rs
index 9491bca..42e0cc0 100644
--- a/rust/arrow/src/compute/kernels/cast.rs
+++ b/rust/arrow/src/compute/kernels/cast.rs
@@ -38,9 +38,7 @@
use std::sync::Arc;
use crate::array::*;
-use crate::array_data::ArrayData;
use crate::buffer::Buffer;
-use crate::builder::*;
use crate::compute::kernels::arithmetic::{divide, multiply};
use crate::datatypes::*;
use crate::error::{ArrowError, Result};
diff --git a/rust/arrow/src/compute/kernels/comparison.rs b/rust/arrow/src/compute/kernels/comparison.rs
index 2b44bdc..5d4ae81 100644
--- a/rust/arrow/src/compute/kernels/comparison.rs
+++ b/rust/arrow/src/compute/kernels/comparison.rs
@@ -25,8 +25,6 @@
use std::sync::Arc;
use crate::array::*;
-use crate::array_data::ArrayData;
-use crate::builder::{BooleanBufferBuilder, BufferBuilderTrait};
use crate::compute::util::apply_bin_op_to_option_bitmap;
use crate::datatypes::{ArrowNumericType, BooleanType, DataType};
use crate::error::{ArrowError, Result};
diff --git a/rust/arrow/src/compute/kernels/temporal.rs b/rust/arrow/src/compute/kernels/temporal.rs
index 6e68975..4319294 100644
--- a/rust/arrow/src/compute/kernels/temporal.rs
+++ b/rust/arrow/src/compute/kernels/temporal.rs
@@ -20,7 +20,6 @@
use chrono::Timelike;
use crate::array::*;
-use crate::builder::Int32Builder;
use crate::datatypes::*;
use crate::error::Result;
diff --git a/rust/arrow/src/csv/reader.rs b/rust/arrow/src/csv/reader.rs
index cf28e38..a031e19 100644
--- a/rust/arrow/src/csv/reader.rs
+++ b/rust/arrow/src/csv/reader.rs
@@ -48,8 +48,7 @@ use std::sync::Arc;
use csv as csv_crate;
-use crate::array::ArrayRef;
-use crate::builder::*;
+use crate::array::{ArrayRef, BinaryBuilder, PrimitiveBuilder};
use crate::datatypes::*;
use crate::error::{ArrowError, Result};
use crate::record_batch::RecordBatch;
diff --git a/rust/arrow/src/json/reader.rs b/rust/arrow/src/json/reader.rs
index 467a89a..0547b7c 100644
--- a/rust/arrow/src/json/reader.rs
+++ b/rust/arrow/src/json/reader.rs
@@ -51,7 +51,6 @@ use std::sync::Arc;
use serde_json::Value;
use crate::array::*;
-use crate::builder::*;
use crate::datatypes::*;
use crate::error::{ArrowError, Result};
use crate::record_batch::RecordBatch;
diff --git a/rust/arrow/src/lib.rs b/rust/arrow/src/lib.rs
index a7ef817..899bb62 100644
--- a/rust/arrow/src/lib.rs
+++ b/rust/arrow/src/lib.rs
@@ -27,10 +27,8 @@
#![allow(bare_trait_objects)]
pub mod array;
-pub mod array_data;
pub mod bitmap;
pub mod buffer;
-pub mod builder;
pub mod compute;
pub mod csv;
pub mod datatypes;
diff --git a/rust/arrow/src/record_batch.rs b/rust/arrow/src/record_batch.rs
index b166951..e718118 100644
--- a/rust/arrow/src/record_batch.rs
+++ b/rust/arrow/src/record_batch.rs
@@ -120,7 +120,6 @@ unsafe impl Sync for RecordBatch {}
mod tests {
use super::*;
- use crate::array_data::*;
use crate::buffer::*;
#[test]
diff --git a/rust/arrow/src/tensor.rs b/rust/arrow/src/tensor.rs
index 6657228..5382ca1 100644
--- a/rust/arrow/src/tensor.rs
+++ b/rust/arrow/src/tensor.rs
@@ -221,8 +221,8 @@ impl<'a, T: ArrowPrimitiveType> Tensor<'a, T> {
mod tests {
use super::*;
+ use crate::array::*;
use crate::buffer::Buffer;
- use crate::builder::*;
#[test]
fn test_compute_row_major_strides() {
diff --git a/rust/datafusion/src/datasource/parquet.rs b/rust/datafusion/src/datasource/parquet.rs
index b7482c7..0ba3289 100644
--- a/rust/datafusion/src/datasource/parquet.rs
+++ b/rust/datafusion/src/datasource/parquet.rs
@@ -21,8 +21,9 @@ use std::fs::File;
use std::string::String;
use std::sync::{Arc, Mutex};
-use arrow::array::{Array, PrimitiveArray};
-use arrow::builder::{BinaryBuilder, PrimitiveBuilder, TimestampNanosecondBuilder};
+use arrow::array::{
+ Array, BinaryBuilder, PrimitiveArray, PrimitiveBuilder, TimestampNanosecondBuilder,
+};
use arrow::datatypes::*;
use arrow::record_batch::RecordBatch;
diff --git a/rust/datafusion/src/execution/aggregate.rs b/rust/datafusion/src/execution/aggregate.rs
index 28fc9e8..11e766a 100644
--- a/rust/datafusion/src/execution/aggregate.rs
+++ b/rust/datafusion/src/execution/aggregate.rs
@@ -24,7 +24,6 @@ use std::str;
use std::sync::Arc;
use arrow::array::*;
-use arrow::builder::*;
use arrow::compute;
use arrow::datatypes::{DataType, Schema};
use arrow::record_batch::RecordBatch;
diff --git a/rust/datafusion/src/execution/context.rs b/rust/datafusion/src/execution/context.rs
index 88a52d6..1a31b9a 100644
--- a/rust/datafusion/src/execution/context.rs
+++ b/rust/datafusion/src/execution/context.rs
@@ -26,8 +26,7 @@ use std::sync::Arc;
use arrow::datatypes::*;
-use crate::arrow::array::ArrayRef;
-use crate::arrow::builder::BooleanBuilder;
+use crate::arrow::array::{ArrayRef, BooleanBuilder};
use crate::datasource::csv::CsvFile;
use crate::datasource::TableProvider;
use crate::error::{ExecutionError, Result};
diff --git a/rust/datafusion/tests/sql.rs b/rust/datafusion/tests/sql.rs
index d4deb61..34a3b0f 100644
--- a/rust/datafusion/tests/sql.rs
+++ b/rust/datafusion/tests/sql.rs
@@ -353,7 +353,7 @@ fn register_csv(
ctx.register_csv(name, filename, &schema, true);
}
-fn load_parquet_table(name: &str) -> Rc<TableProvider> {
+fn load_parquet_table(name: &str) -> Rc<dyn TableProvider> {
let testdata = env::var("PARQUET_TEST_DATA").expect("PARQUET_TEST_DATA not defined");
let filename = format!("{}/{}", testdata, name);
let table = ParquetTable::try_new(&filename).unwrap();
@@ -367,7 +367,7 @@ fn execute(ctx: &mut ExecutionContext, sql: &str) -> String {
result_str(&results)
}
-fn result_str(results: &Rc<RefCell<Relation>>) -> String {
+fn result_str(results: &Rc<RefCell<dyn Relation>>) -> String {
let mut relation = results.borrow_mut();
let mut str = String::new();
while let Some(batch) = relation.next().unwrap() {
diff --git a/rust/parquet/src/util/bit_util.rs b/rust/parquet/src/util/bit_util.rs
index 92a20c1..4305675 100644
--- a/rust/parquet/src/util/bit_util.rs
+++ b/rust/parquet/src/util/bit_util.rs
@@ -938,8 +938,8 @@ mod tests {
for s in SIZE {
for i in 0..33 {
match i {
- 0...8 => test_get_batch_helper::<u8>(*s, i),
- 9...16 => test_get_batch_helper::<u16>(*s, i),
+ 0..=8 => test_get_batch_helper::<u8>(*s, i),
+ 9..=16 => test_get_batch_helper::<u16>(*s, i),
_ => test_get_batch_helper::<u32>(*s, i),
}
}