diff --git a/arrow-array/src/numeric.rs b/arrow-array/src/numeric.rs index 30d9a7b5618..a3cd7bde5d3 100644 --- a/arrow-array/src/numeric.rs +++ b/arrow-array/src/numeric.rs @@ -15,7 +15,6 @@ // specific language governing permissions and limitations // under the License. -use crate::types::*; use crate::ArrowPrimitiveType; /// A subtype of primitive type that represents numeric values. diff --git a/arrow-buffer/src/util/bit_util.rs b/arrow-buffer/src/util/bit_util.rs index 36e08e4e768..d2dbf3c8488 100644 --- a/arrow-buffer/src/util/bit_util.rs +++ b/arrow-buffer/src/util/bit_util.rs @@ -153,7 +153,7 @@ mod tests { #[test] fn test_get_bit_raw() { const NUM_BYTE: usize = 10; - let mut buf = vec![0; NUM_BYTE]; + let mut buf = [0; NUM_BYTE]; let mut expected = vec![]; let mut rng = seedable_rng(); for i in 0..8 * NUM_BYTE { diff --git a/arrow-ord/src/comparison.rs b/arrow-ord/src/comparison.rs index eb3181cc7e9..4dbb395192e 100644 --- a/arrow-ord/src/comparison.rs +++ b/arrow-ord/src/comparison.rs @@ -243,34 +243,6 @@ fn make_utf8_scalar(d: &DataType, scalar: &str) -> Result } } -/// Helper function to perform boolean lambda function on values from two array accessors, this -/// version does not attempt to use SIMD. -fn compare_op( - left: T, - right: S, - op: F, -) -> Result -where - F: Fn(T::Item, S::Item) -> bool, -{ - if left.len() != right.len() { - return Err(ArrowError::ComputeError( - "Cannot perform comparison operation on arrays of different length".to_string(), - )); - } - - Ok(BooleanArray::from_binary(left, right, op)) -} - -/// Helper function to perform boolean lambda function on values from array accessor, this -/// version does not attempt to use SIMD. -fn compare_op_scalar(left: T, op: F) -> Result -where - F: Fn(T::Item) -> bool, -{ - Ok(BooleanArray::from_unary(left, op)) -} - /// Perform `left == right` operation on [`StringArray`] / [`LargeStringArray`]. #[deprecated(note = "Use arrow_ord::cmp::eq")] pub fn eq_utf8( @@ -1014,12 +986,13 @@ where } /// Applies an unary and infallible comparison function to a primitive array. +#[deprecated(note = "Use BooleanArray::from_unary")] pub fn unary_cmp(left: &PrimitiveArray, op: F) -> Result where T: ArrowNumericType, F: Fn(T::Native) -> bool, { - compare_op_scalar(left, op) + Ok(BooleanArray::from_unary(left, op)) } /// Perform `left != right` operation on two [`PrimitiveArray`]s. diff --git a/arrow/src/ffi.rs b/arrow/src/ffi.rs index b49f56c9157..5b1073f134e 100644 --- a/arrow/src/ffi.rs +++ b/arrow/src/ffi.rs @@ -471,10 +471,10 @@ mod tests { use arrow_array::{StructArray, UnionArray}; use crate::array::{ - make_array, Array, ArrayData, BooleanArray, Decimal128Array, DictionaryArray, - DurationSecondArray, FixedSizeBinaryArray, FixedSizeListArray, GenericBinaryArray, - GenericListArray, GenericStringArray, Int32Array, MapArray, OffsetSizeTrait, - Time32MillisecondArray, TimestampMillisecondArray, UInt32Array, + make_array, Array, ArrayData, BooleanArray, DictionaryArray, DurationSecondArray, + FixedSizeBinaryArray, FixedSizeListArray, GenericBinaryArray, GenericListArray, + GenericStringArray, Int32Array, MapArray, OffsetSizeTrait, Time32MillisecondArray, + TimestampMillisecondArray, UInt32Array, }; use crate::compute::kernels; use crate::datatypes::{Field, Int8Type}; diff --git a/arrow/src/pyarrow.rs b/arrow/src/pyarrow.rs index 8302f8741b6..9a13cfa493e 100644 --- a/arrow/src/pyarrow.rs +++ b/arrow/src/pyarrow.rs @@ -71,7 +71,7 @@ use crate::datatypes::{DataType, Field, Schema}; use crate::error::ArrowError; use crate::ffi; use crate::ffi::{FFI_ArrowArray, FFI_ArrowSchema}; -use crate::ffi_stream::{export_reader_into_raw, ArrowArrayStreamReader, FFI_ArrowArrayStream}; +use crate::ffi_stream::{ArrowArrayStreamReader, FFI_ArrowArrayStream}; use crate::record_batch::RecordBatch; import_exception!(pyarrow, ArrowException); @@ -377,7 +377,7 @@ impl FromPyArrow for RecordBatch { impl ToPyArrow for RecordBatch { fn to_pyarrow(&self, py: Python) -> PyResult { // Workaround apache/arrow#37669 by returning RecordBatchIterator - let reader = RecordBatchIterator::new(vec![Ok(self.clone())], self.schema().clone()); + let reader = RecordBatchIterator::new(vec![Ok(self.clone())], self.schema()); let reader: Box = Box::new(reader); let py_reader = reader.into_pyarrow(py)?; py_reader.call_method0(py, "read_next_batch") diff --git a/arrow/tests/array_transform.rs b/arrow/tests/array_transform.rs index 74e2a212736..6f5b245b8e3 100644 --- a/arrow/tests/array_transform.rs +++ b/arrow/tests/array_transform.rs @@ -28,6 +28,7 @@ use arrow_data::ArrayData; use arrow_schema::{DataType, Field, Fields}; use std::sync::Arc; +#[allow(unused)] fn create_decimal_array(array: Vec>, precision: u8, scale: i8) -> Decimal128Array { array .into_iter()