akmhatey-ai opened a new pull request, #22276: URL: https://github.com/apache/datafusion/pull/22276
## Which issue does this PR close? - Closes #22271. ## Rationale for this change DataFusion currently returns `NaN` for negative `ln` inputs. PostgreSQL raises an error for the same case, and issue #22271 tracks aligning `ln((-1.0)::float8)` with that behavior. This keeps the existing `ln(0)` behavior unchanged. ## What changes are included in this PR? - Move `ln` from the shared unary math macro to a dedicated `LnFunc` implementation. - Return a compute error when `ln` receives a negative `Float32` or `Float64` value. - Update `scalar.slt` to cover positive column inputs plus negative scalar and column error cases. ## Are these changes tested? Yes. I ran: - `cargo fmt --check -- datafusion/functions/src/math/mod.rs datafusion/functions/src/math/ln.rs` - `cargo check -p datafusion-functions` - `cargo test -p datafusion-functions math::ln --lib` - `cargo test -p datafusion-sqllogictest --test sqllogictests -- scalar:586` - `cargo test -p datafusion-sqllogictest --test sqllogictests -- scalar:593` - `cargo test -p datafusion-sqllogictest --test sqllogictests -- scalar:597` - `git diff --check` I also ran `cargo test -p datafusion-sqllogictest --test sqllogictests -- scalar`. The changed `ln` records passed, but the full file failed later at `scalar.slt:1546+` because local `aggregate_test_100` data was empty in this checkout; those failures were unrelated to this change. ## Are there any user-facing changes? Yes. `ln` now errors on negative inputs instead of returning `NaN`. -- 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]
