kosiew opened a new pull request, #22062:
URL: https://github.com/apache/datafusion/pull/22062
## Which issue does this PR close?
* Closes #22061.
## Rationale for this change
The existing `min_max_scalar_impl!` macro combined dispatch, validation,
recursion, and control flow into a large macro expansion, making the logic
difficult to debug, review, and test in isolation.
This change moves scalar min/max dispatch to a function-based implementation
while preserving existing behavior, error messages, and dictionary handling
semantics.
## What changes are included in this PR?
* Replaced the `min_max_scalar_impl!` macro with function-based dispatch
logic.
* Added helper functions to separate responsibilities:
* `min_max_option`
* `min_max_float_option`
* `ensure_decimal_compatibility`
* `min_max_generic_scalar`
* `min_max_interval_scalar`
* `min_max_dictionary_scalar`
* `min_max_scalar_same_variant`
* Kept `min_max_scalar` as the main entry point and delegated behavior
through helper functions.
* Preserved:
* existing min/max behavior across scalar types
* dictionary comparison and rewrapping semantics
* decimal precision/scale validation behavior
* float `NaN` handling via `total_cmp`
* existing error classifications and messages
* compacting behavior for generic scalar comparisons
* Simplified macro usage by retaining only lightweight ordering-selection
macros.
## Are these changes tested?
Yes.
Added unit tests covering:
* core scalar min/max parity behavior
* float `NaN` handling using `total_cmp`
* decimal mismatch error preservation
* fixed-size binary mismatch error preservation
* mixed interval comparison error preservation
Existing dictionary comparison tests are also preserved.
## Are there any user-facing changes?
No. This PR is intended to be a refactor only and preserves existing
externally visible behavior.
## LLM-generated code disclosure
This PR includes LLM-generated code and comments. All LLM-generated content
has been manually reviewed and tested.
--
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]