raushanprabhakar1 opened a new pull request, #22277: URL: https://github.com/apache/datafusion/pull/22277
## Which issue does this PR close? - Closes #22272 ## Rationale for this change PostgreSQL rejects `power(0::float8, negative::float8)` because zero raised to a negative power is undefined. DataFusion used `f64::powf`, which returns infinity for that case. This aligns float (and related decimal float paths) with PostgreSQL’s domain semantics. ## What changes are included in this PR? - Added `float64_power_checked` to error when `base == 0.0` and `exp < 0.0` with message `zero raised to a negative power is undefined`. - Wired it into `Float64`/`Float64` `power`, decimal array-exponent float fallback, and `compute_pow_f64_result`. - Updated `math.slt` expectations for `pow(0, -0.5)` and added coverage for `power(0.0::float8, -1.0::float8)`. - Added unit tests in `power.rs`. ## Are these changes tested? Yes. Unit tests in `datafusion/functions/src/math/power.rs`, and SQL logic tests in `datafusion/sqllogictest/test_files/math.slt` (including the regression for #22272). ## Are there any user-facing changes? Yes. Queries that previously returned positive infinity for `power` / `pow` with a zero base and negative exponent now return a runtime error (compute error) with that message, matching PostgreSQL for this case. No public Rust API signature changes; treat as SQL/runtime behavior only unless your process labels SQL semantics as API. -- 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]
