You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Deduplicate bucket computation in width_bucket_interval_mdn_exact #26307
the ascending/descending out-of-range checks (bucket 0 or num_buckets + 1),
the bucket-width computation with its zero / non-finite null guard,
the floor-plus-one bucket clamp.
They differ only in how x, l and h are projected to f64 (months vs. day/nanosecond offset relative to l). Duplicated numeric edge-case handling like this is where a boundary fix ends up in only one copy.
Describe the solution you'd like
Extract fn bucket_from_f64(x: f64, l: f64, h: f64, num_buckets: i64, ascending: bool) -> Option<i64> (returning None for null). Each branch then only computes its projected (x, l, h) and calls it. Optionally move the per-row body into a helper returning Option<i64> so the continue chains disappear. The existing width_bucket tests cover the behaviour.
Describe alternatives you've considered
None.
Additional context
This is small and self-contained, a good first issue. Line references are pinned to commit 0d79252.
Hi @andygrove, I noticed #26307 is available again. I'd like to extract the shared bucket calculation into bucket_from_f64, preserve existing behavior, and run the width_bucket tests. Would that scope be appropriate?
Activity
nightcityblade commentedon Oct 14, 2026
Hi, I'd like to work on this. I'll submit a PR shortly.
nightcityblade commentedon Oct 14, 2026
untake
med9110 commentedon Oct 14, 2026
Hi @andygrove, I noticed #26307 is available again. I'd like to extract the shared bucket calculation into bucket_from_f64, preserve existing behavior, and run the width_bucket tests. Would that scope be appropriate?
Shahzeb-DataEngineer commentedon Oct 19, 2026
I would like to take this one. I will extract the shared
bucket_from_f64helper and keep the existing width_bucket tests passing.refactor(spark): deduplicate bucket computation in width_bucket_inter…