Refactor scalar min/max dispatch into function-based helpers#22062
Refactor scalar min/max dispatch into function-based helpers#22062kosiew wants to merge 3 commits into
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
| ) -> ScalarValue { | ||
| if lhs.is_null() { | ||
| let mut rhs_copy = rhs.clone(); | ||
| rhs_copy.compact(); |
There was a problem hiding this comment.
It would be good to keep the original comments regarding why only rhs is compacted
|
run benchmark min_max_bytes |
|
run benchmark clickbench_extended |
|
🤖 Criterion benchmark running (GKE) | trigger CPU Details (lscpu)Comparing macro-22061 (5b4b4b6) to cae03c9 (merge-base) diff File an issue against this benchmark runner |
|
🤖 Benchmark running (GKE) | trigger CPU Details (lscpu)Comparing macro-22061 (5b4b4b6) to cae03c9 (merge-base) diff using: clickbench_extended File an issue against this benchmark runner |
|
🤖 Criterion benchmark completed (GKE) | trigger Instance: CPU Details (lscpu)Details
Resource Usagebase (merge-base)
branch
File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Instance: CPU Details (lscpu)Details
Resource Usageclickbench_extended — base (merge-base)
clickbench_extended — branch
File an issue against this benchmark runner |
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.