Jefffrey commented on code in PR #17023: URL: https://github.com/apache/datafusion/pull/17023#discussion_r2338310502
########## datafusion/functions/src/math/log.rs: ########## @@ -58,21 +64,91 @@ impl Default for LogFunc { impl LogFunc { pub fn new() -> Self { - use DataType::*; Self { signature: Signature::one_of( vec![ - Exact(vec![Float32]), - Exact(vec![Float64]), - Exact(vec![Float32, Float32]), - Exact(vec![Float64, Float64]), + Numeric(1), + Numeric(2), + Exact(vec![DataType::Float32]), + Exact(vec![DataType::Float64]), + Exact(vec![DataType::Float32, DataType::Float32]), + Exact(vec![DataType::Float64, DataType::Float64]), + Exact(vec![ + DataType::Int64, + DataType::Decimal128(DECIMAL128_MAX_PRECISION, 0), + ]), + Exact(vec![ + DataType::Float32, + DataType::Decimal128(DECIMAL128_MAX_PRECISION, 0), + ]), + Exact(vec![ + DataType::Float64, + DataType::Decimal128(DECIMAL128_MAX_PRECISION, 0), + ]), + Exact(vec![ + DataType::Int64, + DataType::Decimal256(DECIMAL256_MAX_PRECISION, 0), + ]), + Exact(vec![ + DataType::Float32, + DataType::Decimal256(DECIMAL256_MAX_PRECISION, 0), + ]), + Exact(vec![ + DataType::Float64, + DataType::Decimal256(DECIMAL256_MAX_PRECISION, 0), + ]), Review Comment: Hmm, good point. It also seems to make queries like this fail: ``` 1. query failed: DataFusion error: Error during planning: Internal error: Function 'log' failed to match any signature, errors: Error during planning: Function 'log' expects 1 arguments but received 2,Error during planning: For function 'log' Decimal128(3, 1) and Decimal256(76, 0) are not coercible to a common numeric type. This issue was likely caused by a bug in DataFusion's code. Please help us to resolve this by filing a bug report in our issue tracker: https://github.com/apache/datafusion/issues No function matches the given name and argument types 'log(Decimal128(3, 1), Decimal256(76, 0))'. You might need to add explicit type casts. Candidate functions: log(Numeric(1)) log(Numeric(2)) [SQL] select log(10.0, 100000000000000000000000000000000000::decimal(76,0)); at /Users/jeffrey/Code/datafusion/datafusion/sqllogictest/test_files/decimal.slt:836 ``` I'll try look at the coercion code a bit and try to understand what's going on here 🤔 (I'm assuming `Numeric(2)` actually means coerce to a common type) -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org