Jefffrey commented on code in PR #22575:
URL: https://github.com/apache/datafusion/pull/22575#discussion_r3328057422
##########
datafusion/functions/src/math/nanvl.rs:
##########
@@ -64,14 +65,8 @@ impl Default for NanvlFunc {
impl NanvlFunc {
pub fn new() -> Self {
Review Comment:
I think we can also do it like this to avoid user defined signature
```rust
pub fn new() -> Self {
let non_float = Coercion::new_implicit(
TypeSignatureClass::Native(logical_float64()),
vec![TypeSignatureClass::Integer, TypeSignatureClass::Decimal],
NativeType::Float64,
);
let to_float64 = Coercion::new_implicit(
TypeSignatureClass::Native(logical_float64()),
vec![TypeSignatureClass::Numeric],
NativeType::Float64,
);
Self {
signature: Signature::one_of(
vec![
// For non-floats we coerce to f64
TypeSignature::Coercible(vec![non_float.clone(),
to_float64.clone()]),
TypeSignature::Coercible(vec![to_float64.clone(),
non_float.clone()]),
// Otherwise try maintain original floating precision
TypeSignature::Exact(vec![Float16, Float16]),
TypeSignature::Exact(vec![Float32, Float32]),
TypeSignature::Exact(vec![Float64, Float64]),
],
Volatility::Immutable,
),
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]