hsdfat opened a new pull request, #3645:
URL: https://github.com/apache/iceberg-rust/pull/3645

   ## Which issue does this PR close?
   
   - Part of #3637. This covers only the `adjust_boundary` overflow. The 
year/month transform range problem is left out, because it overlaps open PR 
#3237.
   
   ## What changes are included in this PR?
   
   `Transform::adjust_boundary` turns `< v` into `<= v - 1` and `> v` into `>= 
v + 1` with unchecked arithmetic. At a type's minimum or maximum, that panics 
in debug builds and wraps in release. For int, long, date and the four 
timestamp types, the shift now uses `checked_sub` / `checked_add`. On overflow 
it returns `Ok(None)`. Callers already treat `None` as "no projection", and the 
predicate can't match any value anyway (nothing is below `i32::MIN`). The 
decimal arms are unchanged; they already go through `try_decrement_number` / 
`try_increment_number`.
   
   ## Are these changes tested?
   
   Yes, with unit tests in `spec/transform.rs`:
   - `test_adjust_boundary_overflow_returns_none` covers `<` at MIN and `>` at 
MAX for each affected type.
   - `test_adjust_boundary_near_extremes` checks that MIN+1 and MAX-1 still 
shift normally.
   - `test_project_strict_comparison_past_extreme_returns_none` goes through 
`Transform::project` for a day transform on a date and a truncate transform on 
a long. Both panicked before this change.
   
   ## AI Disclosure
   
   The change and tests were drafted with AI assistance (Claude). I reviewed 
every line and ran the transform tests, clippy and fmt. Two points a reviewer 
may want to check:
   - On overflow this returns `None` (no projection) rather than an 
always-false predicate. That seemed the smallest change, since the caller 
already handles `None`.
   - Only the inclusive/inclusive projection path is touched. Strict projection 
is unchanged.
   


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