martin-g commented on code in PR #18968:
URL: https://github.com/apache/datafusion/pull/18968#discussion_r2568834332
##########
datafusion/functions/src/math/power.rs:
##########
@@ -67,8 +67,27 @@ impl Default for PowerFunc {
impl PowerFunc {
pub fn new() -> Self {
+ let integer = Coercion::new_implicit(
+ TypeSignatureClass::Native(logical_int64()),
+ vec![TypeSignatureClass::Integer],
+ NativeType::Int64,
+ );
+ let decimal = Coercion::new_exact(TypeSignatureClass::Decimal);
+ let float = Coercion::new_implicit(
+ TypeSignatureClass::Native(logical_float64()),
+ vec![TypeSignatureClass::Numeric],
+ NativeType::Float64,
+ );
Self {
- signature: Signature::user_defined(Volatility::Immutable),
+ signature: Signature::one_of(
+ vec![
+ TypeSignature::Coercible(vec![integer.clone(),
integer.clone()]),
+ TypeSignature::Coercible(vec![decimal.clone(),
integer.clone()]),
+ TypeSignature::Coercible(vec![decimal.clone(),
float.clone()]),
Review Comment:
How does this work for `power(base::decimal(38, 0), exponent::decimal(38,
0))` ?
I see this test case below but I don't see where the exponent is casted to a
Float64.
In the old code it was done at
https://github.com/apache/datafusion/pull/18968/files#diff-598356e1af0ad23287c968ebf6310366e5127b91a037e076bc264dac3a55e768L192
##########
datafusion/functions/src/math/power.rs:
##########
Review Comment:
```suggestion
/// 1. Power(a, 0) ===> 1
```
--
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]