From 6ae6058b818ebe2ce995b767b4dbdb4486724bd1 Mon Sep 17 00:00:00 2001 From: Raphael Taylor-Davies Date: Tue, 9 May 2023 16:54:44 +0100 Subject: [PATCH] Remove powf_scalar kernel --- arrow-arith/src/arithmetic.rs | 25 ------------------------- arrow-array/src/numeric.rs | 29 ----------------------------- arrow/src/datatypes/mod.rs | 4 +--- 3 files changed, 1 insertion(+), 57 deletions(-) diff --git a/arrow-arith/src/arithmetic.rs b/arrow-arith/src/arithmetic.rs index 40ae3255b98c..42f6e3974301 100644 --- a/arrow-arith/src/arithmetic.rs +++ b/arrow-arith/src/arithmetic.rs @@ -29,7 +29,6 @@ use arrow_array::*; use arrow_buffer::i256; use arrow_buffer::ArrowNativeType; use arrow_schema::*; -use num::traits::Pow; use std::cmp::min; use std::sync::Arc; @@ -1342,18 +1341,6 @@ pub fn negate_checked( try_unary(array, |value| value.neg_checked()) } -/// Raise array with floating point values to the power of a scalar. -pub fn powf_scalar( - array: &PrimitiveArray, - raise: T::Native, -) -> Result, ArrowError> -where - T: ArrowFloatNumericType, - T::Native: Pow, -{ - Ok(unary(array, |x| x.pow(raise))) -} - /// Perform `left * right` operation on two arrays. If either left or right value is null /// then the result is also null. /// @@ -3217,18 +3204,6 @@ mod tests { assert_eq!(expected, actual); } - #[test] - fn test_primitive_array_raise_power_scalar() { - let a = Float64Array::from(vec![1.0, 2.0, 3.0]); - let actual = powf_scalar(&a, 2.0).unwrap(); - let expected = Float64Array::from(vec![1.0, 4.0, 9.0]); - assert_eq!(expected, actual); - let a = Float64Array::from(vec![Some(1.0), None, Some(3.0)]); - let actual = powf_scalar(&a, 2.0).unwrap(); - let expected = Float64Array::from(vec![Some(1.0), None, Some(9.0)]); - assert_eq!(expected, actual); - } - #[test] fn test_primitive_add_wrapping_overflow() { let a = Int32Array::from(vec![i32::MAX, i32::MIN]); diff --git a/arrow-array/src/numeric.rs b/arrow-array/src/numeric.rs index 9d9048085106..afc0e2c33010 100644 --- a/arrow-array/src/numeric.rs +++ b/arrow-array/src/numeric.rs @@ -558,35 +558,6 @@ impl ArrowNumericType for Decimal256Type { } } -/// A subtype of primitive type that represents numeric float values -#[cfg(feature = "simd")] -pub trait ArrowFloatNumericType: ArrowNumericType { - /// SIMD version of pow - fn pow(base: Self::Simd, raise: Self::Simd) -> Self::Simd; -} - -/// A subtype of primitive type that represents numeric float values -#[cfg(not(feature = "simd"))] -pub trait ArrowFloatNumericType: ArrowNumericType {} - -macro_rules! make_float_numeric_type { - ($impl_ty:ty, $simd_ty:ident) => { - #[cfg(feature = "simd")] - impl ArrowFloatNumericType for $impl_ty { - #[inline] - fn pow(base: Self::Simd, raise: Self::Simd) -> Self::Simd { - base.powf(raise) - } - } - - #[cfg(not(feature = "simd"))] - impl ArrowFloatNumericType for $impl_ty {} - }; -} - -make_float_numeric_type!(Float32Type, f32x16); -make_float_numeric_type!(Float64Type, f64x8); - #[cfg(all(test, feature = "simd"))] mod tests { use super::*; diff --git a/arrow/src/datatypes/mod.rs b/arrow/src/datatypes/mod.rs index 74dad6b4a8c8..840e98ab0ded 100644 --- a/arrow/src/datatypes/mod.rs +++ b/arrow/src/datatypes/mod.rs @@ -23,9 +23,7 @@ //! * [`DataType`](crate::datatypes::DataType) to describe the type of a field. pub use arrow_array::types::*; -pub use arrow_array::{ - ArrowFloatNumericType, ArrowNativeTypeOp, ArrowNumericType, ArrowPrimitiveType, -}; +pub use arrow_array::{ArrowNativeTypeOp, ArrowNumericType, ArrowPrimitiveType}; pub use arrow_buffer::{i256, ArrowNativeType, ToByteSlice}; pub use arrow_data::decimal::*; pub use arrow_schema::{