Yuvraj-cyborg opened a new pull request, #19372:
URL: https://github.com/apache/datafusion/pull/19372

   ## Which issue does this PR close?
   Closes #19347 
   
   ## Rationale for this change
   #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 non-integer bases, as the implementation using ilog can't handle them. 
This is technically a regression as previously we could handle them via casting 
to float before doing the log.
   
   ## What changes are included in this PR?
   - Modified log_decimal128 to fallback to f64 computation for non-integer 
bases
   - For integer bases >= 2, continues to use the efficient ilog algorithm
   - For non-integer bases, converts the decimal value to f64 and uses standard 
log(base)
   - Updated error message from "non-integer base" to "non-finite base" since 
non-integer is now supported
   - Added sqllogictest for non-integer base case
   
   ## Are these changes tested?
   Yes:
   
   - Existing unit tests for log_decimal128 continue to pass
   - Added SQL logic test in decimal.slt for non-integer base: log(2.5, 
100::decimal(38,0))
   
   ## Are there any user-facing changes?
   Yes. The following queries now work instead of returning errors:
   ```sql
   -- Non-integer base
   SELECT log(2.5, 100::decimal(38,0));  -- Returns 5.025883189464
   
   -- Fractional bases work
   SELECT log(1.5, 10::decimal(38,0));   -- Returns 5.678935662314


-- 
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]

Reply via email to