-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem or challenge?
Currently iszero() and isnan() coerce inputs to float to compute:
datafusion/datafusion/functions/src/math/iszero.rs
Lines 61 to 71 in a02e683
| pub fn new() -> Self { | |
| // Accept any numeric type and coerce to float | |
| let float = Coercion::new_implicit( | |
| TypeSignatureClass::Float, | |
| vec![TypeSignatureClass::Numeric], | |
| NativeType::Float64, | |
| ); | |
| Self { | |
| signature: Signature::coercible(vec![float], Volatility::Immutable), | |
| } | |
| } |
datafusion/datafusion/functions/src/math/nans.rs
Lines 57 to 67 in a02e683
| pub fn new() -> Self { | |
| // Accept any numeric type and coerce to float | |
| let float = Coercion::new_implicit( | |
| TypeSignatureClass::Float, | |
| vec![TypeSignatureClass::Numeric], | |
| NativeType::Float64, | |
| ); | |
| Self { | |
| signature: Signature::coercible(vec![float], Volatility::Immutable), | |
| } | |
| } |
Describe the solution you'd like
Consider refactoring these to accept numeric types without coercing to float; the implementations should be simple (albeit verbose/tedious). For example, isnan() should return false for any numeric inputs that aren't float type, which might be a slight optimization.
Describe alternatives you've considered
If we prefer to keep the code simple we can leave it as is
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request