From e4dc0b8bd39330b536d2c7e5d663b9af9743444e Mon Sep 17 00:00:00 2001 From: Jorge Leitao Date: Tue, 21 Dec 2021 17:08:34 +0000 Subject: [PATCH] Avoid importing Array (#697) --- examples/csv_write_parallel.rs | 2 +- examples/parquet_write_record.rs | 2 +- src/array/equal/primitive.rs | 5 +---- src/array/primitive/mod.rs | 3 ++- src/compute/arithmetics/basic/add.rs | 2 +- src/compute/arithmetics/basic/mod.rs | 5 +---- src/compute/arithmetics/basic/mul.rs | 2 +- src/compute/arithmetics/basic/pow.rs | 2 +- src/compute/arithmetics/basic/sub.rs | 2 +- src/compute/arithmetics/decimal/add.rs | 2 +- src/compute/arithmetics/decimal/div.rs | 2 +- src/compute/arithmetics/decimal/mul.rs | 2 +- src/compute/arithmetics/decimal/sub.rs | 2 +- src/compute/arithmetics/time.rs | 2 +- src/compute/bitwise.rs | 2 +- src/compute/sort/primitive/sort.rs | 2 +- 16 files changed, 17 insertions(+), 22 deletions(-) diff --git a/examples/csv_write_parallel.rs b/examples/csv_write_parallel.rs index 5bdcb0f5dc5..54e8453fcfa 100644 --- a/examples/csv_write_parallel.rs +++ b/examples/csv_write_parallel.rs @@ -4,7 +4,7 @@ use std::sync::Arc; use std::thread; use arrow2::{ - array::{Array, Int32Array}, + array::Int32Array, datatypes::{Field, Schema}, error::Result, io::csv::write, diff --git a/examples/parquet_write_record.rs b/examples/parquet_write_record.rs index 4a3a6180e4e..290e20ab102 100644 --- a/examples/parquet_write_record.rs +++ b/examples/parquet_write_record.rs @@ -2,7 +2,7 @@ use std::fs::File; use std::sync::Arc; use arrow2::{ - array::{Array, Int32Array}, + array::Int32Array, datatypes::{Field, Schema}, error::Result, io::parquet::write::{ diff --git a/src/array/equal/primitive.rs b/src/array/equal/primitive.rs index 32733eb953d..c848a37776c 100644 --- a/src/array/equal/primitive.rs +++ b/src/array/equal/primitive.rs @@ -1,7 +1,4 @@ -use crate::{ - array::{Array, PrimitiveArray}, - types::NativeType, -}; +use crate::{array::PrimitiveArray, types::NativeType}; pub(super) fn equal(lhs: &PrimitiveArray, rhs: &PrimitiveArray) -> bool { lhs.data_type() == rhs.data_type() && lhs.len() == rhs.len() && lhs.iter().eq(rhs.iter()) diff --git a/src/array/primitive/mod.rs b/src/array/primitive/mod.rs index c2d57b88f7a..9a33385ced2 100644 --- a/src/array/primitive/mod.rs +++ b/src/array/primitive/mod.rs @@ -135,8 +135,9 @@ impl PrimitiveArray { self.validity.as_ref() } + /// The arrays' logical type #[inline] - fn data_type(&self) -> &DataType { + pub fn data_type(&self) -> &DataType { &self.data_type } diff --git a/src/compute/arithmetics/basic/add.rs b/src/compute/arithmetics/basic/add.rs index d1002ab97d5..81f5b7bb039 100644 --- a/src/compute/arithmetics/basic/add.rs +++ b/src/compute/arithmetics/basic/add.rs @@ -4,7 +4,7 @@ use std::ops::Add; use num_traits::{ops::overflowing::OverflowingAdd, CheckedAdd, SaturatingAdd, WrappingAdd}; use crate::{ - array::{Array, PrimitiveArray}, + array::PrimitiveArray, bitmap::Bitmap, compute::{ arithmetics::{ diff --git a/src/compute/arithmetics/basic/mod.rs b/src/compute/arithmetics/basic/mod.rs index 32f52cea6d4..22ed09baf6e 100644 --- a/src/compute/arithmetics/basic/mod.rs +++ b/src/compute/arithmetics/basic/mod.rs @@ -22,10 +22,7 @@ use std::ops::Neg; use num_traits::{CheckedNeg, WrappingNeg}; -use crate::{ - array::{Array, PrimitiveArray}, - types::NativeType, -}; +use crate::{array::PrimitiveArray, types::NativeType}; use super::super::arity::{unary, unary_checked}; diff --git a/src/compute/arithmetics/basic/mul.rs b/src/compute/arithmetics/basic/mul.rs index c986403ae67..a3b405b845f 100644 --- a/src/compute/arithmetics/basic/mul.rs +++ b/src/compute/arithmetics/basic/mul.rs @@ -4,7 +4,7 @@ use std::ops::Mul; use num_traits::{ops::overflowing::OverflowingMul, CheckedMul, SaturatingMul, WrappingMul}; use crate::{ - array::{Array, PrimitiveArray}, + array::PrimitiveArray, bitmap::Bitmap, compute::{ arithmetics::{ diff --git a/src/compute/arithmetics/basic/pow.rs b/src/compute/arithmetics/basic/pow.rs index 71138893070..1b67970a030 100644 --- a/src/compute/arithmetics/basic/pow.rs +++ b/src/compute/arithmetics/basic/pow.rs @@ -2,7 +2,7 @@ use num_traits::{checked_pow, CheckedMul, One, Pow}; use crate::{ - array::{Array, PrimitiveArray}, + array::PrimitiveArray, compute::arity::{unary, unary_checked}, }; diff --git a/src/compute/arithmetics/basic/sub.rs b/src/compute/arithmetics/basic/sub.rs index 4358db32990..c2c84cae6ee 100644 --- a/src/compute/arithmetics/basic/sub.rs +++ b/src/compute/arithmetics/basic/sub.rs @@ -4,7 +4,7 @@ use std::ops::Sub; use num_traits::{ops::overflowing::OverflowingSub, CheckedSub, SaturatingSub, WrappingSub}; use crate::{ - array::{Array, PrimitiveArray}, + array::PrimitiveArray, bitmap::Bitmap, compute::{ arithmetics::{ diff --git a/src/compute/arithmetics/decimal/add.rs b/src/compute/arithmetics/decimal/add.rs index bbb71101e52..360dca818f6 100644 --- a/src/compute/arithmetics/decimal/add.rs +++ b/src/compute/arithmetics/decimal/add.rs @@ -1,6 +1,6 @@ //! Defines the addition arithmetic kernels for [`PrimitiveArray`] representing decimals. use crate::{ - array::{Array, PrimitiveArray}, + array::PrimitiveArray, buffer::Buffer, compute::{ arithmetics::{ArrayAdd, ArrayCheckedAdd, ArraySaturatingAdd}, diff --git a/src/compute/arithmetics/decimal/div.rs b/src/compute/arithmetics/decimal/div.rs index f6ca1533e2e..93ce6daca62 100644 --- a/src/compute/arithmetics/decimal/div.rs +++ b/src/compute/arithmetics/decimal/div.rs @@ -2,7 +2,7 @@ //! `PrimitiveArrays`. use crate::{ - array::{Array, PrimitiveArray}, + array::PrimitiveArray, buffer::Buffer, compute::{ arithmetics::{ArrayCheckedDiv, ArrayDiv}, diff --git a/src/compute/arithmetics/decimal/mul.rs b/src/compute/arithmetics/decimal/mul.rs index df3d77cef86..8eb97a70bcd 100644 --- a/src/compute/arithmetics/decimal/mul.rs +++ b/src/compute/arithmetics/decimal/mul.rs @@ -2,7 +2,7 @@ //! `PrimitiveArrays`. use crate::{ - array::{Array, PrimitiveArray}, + array::PrimitiveArray, buffer::Buffer, compute::{ arithmetics::{ArrayCheckedMul, ArrayMul, ArraySaturatingMul}, diff --git a/src/compute/arithmetics/decimal/sub.rs b/src/compute/arithmetics/decimal/sub.rs index 6cedf2fe74b..05a505c2e63 100644 --- a/src/compute/arithmetics/decimal/sub.rs +++ b/src/compute/arithmetics/decimal/sub.rs @@ -1,7 +1,7 @@ //! Defines the subtract arithmetic kernels for Decimal `PrimitiveArrays`. use crate::{ - array::{Array, PrimitiveArray}, + array::PrimitiveArray, buffer::Buffer, compute::{ arithmetics::{ArrayCheckedSub, ArraySaturatingSub, ArraySub}, diff --git a/src/compute/arithmetics/time.rs b/src/compute/arithmetics/time.rs index 2bfd672694c..b960dde2ff9 100644 --- a/src/compute/arithmetics/time.rs +++ b/src/compute/arithmetics/time.rs @@ -14,7 +14,7 @@ use std::ops::{Add, Sub}; use num_traits::AsPrimitive; use crate::{ - array::{Array, PrimitiveArray}, + array::PrimitiveArray, compute::arity::{binary, unary}, datatypes::{DataType, TimeUnit}, error::{ArrowError, Result}, diff --git a/src/compute/bitwise.rs b/src/compute/bitwise.rs index 6d227f0aa40..4a9d981f33e 100644 --- a/src/compute/bitwise.rs +++ b/src/compute/bitwise.rs @@ -1,7 +1,7 @@ //! Contains bitwise operators: [`or`], [`and`], [`xor`] and [`not`]. use std::ops::{BitAnd, BitOr, BitXor, Not}; -use crate::array::{Array, PrimitiveArray}; +use crate::array::PrimitiveArray; use crate::compute::arity::{binary, unary}; use crate::types::NativeType; diff --git a/src/compute/sort/primitive/sort.rs b/src/compute/sort/primitive/sort.rs index 144b96cc19a..51724a16506 100644 --- a/src/compute/sort/primitive/sort.rs +++ b/src/compute/sort/primitive/sort.rs @@ -18,7 +18,7 @@ use crate::bitmap::Bitmap; use crate::buffer::{Buffer, MutableBuffer}; use crate::{ - array::{Array, PrimitiveArray}, + array::PrimitiveArray, bitmap::{utils::SlicesIterator, MutableBitmap}, types::NativeType, };