You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem or challenge?
#17023 introduced handling of decimals for log natively; previously we'd cast the input to float before performing the log.
It introduced a condition against negative scale decimals, as the implementation couldn't yet handle them. This is technically a regression as previously we could handle them via casting to float before doing the log.
Describe the solution you'd like
Short term solution: for negative scale decimals, cast to float to perform log
Long term/proper solution: improve decimal log code to handle negative scales
Hey @Jefffrey i have opened another PR , please review . Also i am not sure if the calculation shown in example doc for power function at datafusion/functions/src/math/power.rs is correct ?
``text the example doc
/// b^e * 10^(-s * e) * 10^s = b^e / 10^(s * (e-1))
/// ```
/// Example of 2.5 ^ 4 = 39:
/// 2.5 is represented as 25 with scale 1
/// The unscaled result is 25^4 = 390625
/// Scale it back to 1: 390625 / 10^4 = 39
Thanks @Jefffrey -- I was asking because this issue is (rightly) listed as needed for the 52.0.0 release, which we are gearing up for next week. @shifluxxc do you think you will have time to complete the rest of the work? Maybe even writing some .slt tests that show the current behavior / errors would be valuable
Activity
[-]Allow log on negative scale decimals[/-][+]Allow log/pow on negative scale decimals[/+]shifluxxc commentedon Dec 13, 2025
take
shifluxxc commentedon Dec 14, 2025
@Jefffrey please review .
Fix regression for negative-scale decimal128 in log (#19315)
Jefffrey commentedon Dec 19, 2025
Still pending:
shifluxxc commentedon Dec 19, 2025
Hey @Jefffrey i have opened another PR , please review . Also i am not sure if the calculation shown in example doc for power function at
datafusion/functions/src/math/power.rsis correct ?added support for negative scale for log decimal32/64 and power (#19409)
alamb commentedon Dec 31, 2025
Now that we have merged the following PRs, shall we close this one?
Jefffrey commentedon Dec 31, 2025
I think there are still some checks to fix from a cursory glance at the code:
datafusion/datafusion/functions/src/utils.rs
Lines 202 to 206 in f1e5c94
datafusion/datafusion/functions/src/utils.rs
Lines 219 to 223 in f1e5c94
datafusion/datafusion/functions/src/utils.rs
Lines 236 to 240 in f1e5c94
alamb commentedon Dec 31, 2025
Thanks @Jefffrey -- I was asking because this issue is (rightly) listed as needed for the 52.0.0 release, which we are gearing up for next week. @shifluxxc do you think you will have time to complete the rest of the work? Maybe even writing some .slt tests that show the current behavior / errors would be valuable
shifluxxc commentedon Dec 31, 2025
@alamb i will try to raise a PR today itself addressing these issues, Thank you .
Jefffrey commentedon Jan 6, 2026
Update: this is fine, callers guard against passing in negative scale so this is intended
alamb commentedon Jan 7, 2026
Thank you for double checknig @Jefffrey and for your help getting this resolved @shifluxxc