Refactor scalar min/max dispatch into function-based helpers#22062
Open
kosiew wants to merge 3 commits intoapache:mainfrom
Open
Refactor scalar min/max dispatch into function-based helpers#22062kosiew wants to merge 3 commits intoapache:mainfrom
kosiew wants to merge 3 commits intoapache:mainfrom
Conversation
- Removed `min_max_scalar_impl!` - Added function dispatch for: - `min_max_scalar_same_variant` - `min_max_dictionary_scalar` - `ensure_decimal_compatibility` - scalar helper functions - Preserved dictionary unwrap/rewrap behavior - Added parity/regression tests for: - core scalar min/max - float NaN total comparison - decimal mismatch error - fixed-size-binary mismatch error
…d improve error messages - Merged min_max_option and min_max_clone_option - Replaced clone helper call sites - Shortened dictionary arms using .map(Some) - Updated decimal compatibility arguments to (precision, scale) tuples - Simplified assertions in error test messages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
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_optionmin_max_float_optionensure_decimal_compatibilitymin_max_generic_scalarmin_max_interval_scalarmin_max_dictionary_scalarmin_max_scalar_same_variantKept
min_max_scalaras the main entry point and delegated behavior through helper functions.Preserved:
NaNhandling viatotal_cmpSimplified macro usage by retaining only lightweight ordering-selection macros.
Are these changes tested?
Yes.
Added unit tests covering:
NaNhandling usingtotal_cmpExisting 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.