theirix commented on code in PR #18032:
URL: https://github.com/apache/datafusion/pull/18032#discussion_r2487687364
##########
datafusion/functions/src/math/power.rs:
##########
@@ -68,8 +77,44 @@ impl PowerFunc {
Self {
signature: Signature::one_of(
vec![
+ TypeSignature::Exact(vec![Int32, Int32]),
TypeSignature::Exact(vec![Int64, Int64]),
+ TypeSignature::Exact(vec![Float32, Float32]),
TypeSignature::Exact(vec![Float64, Float64]),
+ // Extra signatures for decimals to avoid casting them to
floats
+ TypeSignature::Exact(vec![
+ Decimal32(DECIMAL32_MAX_PRECISION, 0),
+ Int64,
+ ]),
+ TypeSignature::Exact(vec![
+ Decimal32(DECIMAL32_MAX_PRECISION, 0),
+ Float64,
+ ]),
+ TypeSignature::Exact(vec![
+ Decimal32(DECIMAL64_MAX_PRECISION, 0),
+ Int64,
+ ]),
+ TypeSignature::Exact(vec![
+ Decimal32(DECIMAL64_MAX_PRECISION, 0),
+ Float64,
+ ]),
+ TypeSignature::Exact(vec![
+ Decimal128(DECIMAL128_MAX_PRECISION, 0),
+ Int64,
+ ]),
+ TypeSignature::Exact(vec![
+ Decimal128(DECIMAL128_MAX_PRECISION, 0),
+ Float64,
+ ]),
+ TypeSignature::Exact(vec![
+ Decimal256(DECIMAL256_MAX_PRECISION, 0),
+ Int64,
+ ]),
+ TypeSignature::Exact(vec![
+ Decimal256(DECIMAL256_MAX_PRECISION, 0),
+ Float64,
+ ]),
+ Numeric(2), // Catch-all for all decimals
Review Comment:
@Jefffrey thank you for telling me about that coercion feature, it is very
helpful. I implemented an even more compact version using helpers. Also,
handling of null-to-int coercion became much more simple.
--
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]