compiler-segfault opened a new pull request, #3663:
URL: https://github.com/apache/iceberg-rust/pull/3663

   ## Which issue does this PR close?
   
   - Closes #3637
   
   ## What changes are included in this PR?
   
   The `year` and `month` transforms of `date` and `timestamp` values no longer 
go through `chrono`, whose dates stop around ±262,000 years:
   
   - The array transforms compute the civil year/month from the day offset 
directly, which is defined for every `i32` day and every microsecond timestamp. 
Out-of-range values therefore no longer become `null`; a `null` partition value 
is what makes a predicate on the source column prune the file that holds the 
row.
   - `transform_literal` uses the same arithmetic instead of 
`chrono::NaiveDate` plus `unwrap()`, so a `date` literal at 
`i32::MAX`/`i32::MIN` no longer panics and a timestamp literal outside 
`chrono`'s range no longer fails with `DataInvalid`.
   - `Transform::adjust_boundary` uses checked arithmetic, so `x < i32::MIN` or 
`x > i64::MAX` skips the shift (`None`) instead of panicking in debug builds 
and wrapping in release builds.
   
   The resulting values match Iceberg Java, which computes them through 
`java.time`: date `i32::MAX` is 5881580-07-11, i.e. year 5,879,610 and month 
70,555,326; timestamp `i64::MAX` microseconds is 294247-01-10, i.e. year 
292,277 and month 3,507,324.
   
   ## Are these changes tested?
   
   New unit tests in the two touched modules:
   
   - `transform::temporal::out_of_range_tests` pins the year/month values for 
`date` and timestamp (µs and ns) extremes, and checks the literal transforms do 
not panic there.
   - `spec::transform::boundary_overflow_tests` pins `adjust_boundary` at the 
type extremes and checks representable values still shift.
   
   `cargo test -p iceberg --lib` is green (2148 passed) and `cargo clippy -p 
iceberg --all-targets --all-features -- -D warnings` is clean.
   
   ## AI Disclosure
   
   Prepared with an AI coding assistant; I reviewed the diff end to end and 
checked the expected values against Iceberg Java's `java.time` based behaviour, 
and can answer questions about it.
   
   Area to focus on: the `Timestamp(Second)` and `Timestamp(Millisecond)` arms 
of the array transforms are unreachable from Iceberg today (timestamps are 
µs/ns), but `date_part` accepted those units before, so the explicit match 
keeps that behaviour instead of turning it into an `Unexpected` error.
   


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