This is an automated email from the ASF dual-hosted git repository.
tustvold pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
The following commit(s) were added to refs/heads/master by this push:
new d67142d43 Remove powf_scalar kernel (#4187)
d67142d43 is described below
commit d67142d43881681a2782476587de69d4e072247b
Author: Raphael Taylor-Davies <[email protected]>
AuthorDate: Tue May 9 19:23:40 2023 +0100
Remove powf_scalar kernel (#4187)
---
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 40ae3255b..42f6e3974 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<T: ArrowNumericType>(
try_unary(array, |value| value.neg_checked())
}
-/// Raise array with floating point values to the power of a scalar.
-pub fn powf_scalar<T>(
- array: &PrimitiveArray<T>,
- raise: T::Native,
-) -> Result<PrimitiveArray<T>, ArrowError>
-where
- T: ArrowFloatNumericType,
- T::Native: Pow<T::Native, Output = T::Native>,
-{
- 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 9d9048085..afc0e2c33 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 74dad6b4a..840e98ab0 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::{