sjhddh opened a new pull request, #22832: URL: https://github.com/apache/datafusion/pull/22832
## Which issue does this PR close? Part of #19144. ## Rationale for this change Spark's `rint` and `expm1` are null-intolerant `UnaryMathExpression`s: the result is NULL exactly when the input is NULL, and never otherwise. Both functions only implemented `return_type`, so they fell back to the default field nullability of `true` and reported a nullable output even when the input is non-nullable. This is the class of nullability bug tracked in #19144, and matches what was already fixed for `abs`, `floor`, and `bitwise_not`. ## What changes are included in this PR? - Implement `return_field_from_args` for `SparkRint` and `SparkExpm1` so the output field inherits the child's nullability (`return_type` now returns an internal error, consistent with the sibling functions). - Add unit tests covering nullable and non-nullable inputs for both functions (`expm1` previously had no tests). ## Are these changes tested? Yes: - `cargo test -p datafusion-spark --lib` (255 passing, including the two new nullability tests) - `rint.slt` and `expm1.slt` sqllogictests pass unchanged (no value-level behavior change) - `cargo fmt` and `cargo clippy --all-targets --all-features` clean ## Are there any user-facing changes? No functional/value changes. Only the reported output nullability is corrected: `rint`/`expm1` over a non-nullable column now produce a non-nullable result field, as Spark does. -- 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]
