Shahzeb-DataEngineer opened a new pull request, #26489:
URL: https://github.com/apache/datafusion/pull/26489

   ## Which issue does this PR close?
   
   - Closes #26307
   
   ## Rationale for this change
   
   The "only month" and "months equals" branches of 
`width_bucket_interval_mdn_exact` duplicated the bucket-number computation: the 
ascending/descending out-of-range checks, the zero/non-finite width null guard, 
and the floor-plus-one bucket clamp. Duplicated numeric edge-case handling like 
this is where a boundary fix ends up in only one copy.
   
   ## What changes are included in this PR?
   
   - Extracted the shared logic into `fn bucket_from_f64(x, l, h, num_buckets, 
ascending) -> Option<i64>` (`None` for null). Each branch now only computes its 
projected `(x, l, h)` and calls the helper.
   - No behavior change: `width_bucket_interval_mdn_exact` keeps the same 
out-of-range values (0 / `num_buckets + 1`), the same null cases, and the same 
clamp.
   
   ## What is the testing strategy for this PR?
   
   No new tests: the existing `width_bucket` module tests 
(`test_width_bucket_interval_mdn_months_only_*`, 
`test_width_bucket_interval_mdn_day_nano_*`, plus the invalid-input cases) 
cover both branches. Verified locally: all 21 tests in the `width_bucket` 
module pass, `cargo fmt` and `cargo clippy -p datafusion-spark --all-targets` 
are clean.
   
   ## Are there any user-facing changes?
   
   No: internal refactor only, no behavior or API change.
   


-- 
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]

Reply via email to