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

   ## Which issue does this PR close?
   
   - Closes #3503.
   
   ## What changes are included in this PR?
   
   Follow-up to #3483. With v3 type promotion a `date` column can become 
`timestamp` or `timestamp_ns`, but the reader left old date partition values 
and column bounds as day counts, so they were compared against micros/nanos.
   
   - `PrimitiveLiteral::promote_to` / `Datum::promote_to` now convert a date 
(days from epoch) to `timestamp` (micros) and `timestamp_ns` (nanos). The 
conversion uses checked multiplication, and a date outside the target range 
returns a `DataInvalid` error instead of wrapping. Because of that, 
`promote_to` now returns `Result<Option<_>>`.
   - `InclusiveMetricsEvaluator` promotes date lower/upper bounds before 
comparing them to a timestamp predicate, and propagates the overflow error.
   - `DataFile::promoted_partition` converts date partition values, and the 
scan's `partition_types_differ` check now treats date to timestamp / 
timestamp_ns as a promotion, so equality-delete and deletion-vector matching 
see the promoted partition.
   
   `timestamptz` targets are left alone, since date to timestamptz isn't an 
allowed promotion.
   
   ## Are these changes tested?
   
   Yes, new unit tests:
   
   - `spec::values::tests`: date to timestamp / timestamp_ns (including a 
negative date), and the overflow error (year 3000 overflows `timestamp_ns` but 
fits in `timestamp`).
   - `inclusive_metrics_evaluator`: bound pruning for `<`/`>`, `=`, and `IN` 
against promoted date bounds, plus the overflow error only when the overflowing 
bound is read.
   - `data_file`: `promoted_partition` converts date partition values to 
micros/nanos and errors on overflow.
   
   `cargo test -p iceberg --lib` passes, and `cargo clippy -p iceberg 
--all-targets -- -D warnings` and `cargo fmt --check` are clean.
   
   ## AI Disclosure
   
   I used an AI coding assistant to help write the code and tests. I reviewed 
the changes and ran the tests locally.
   


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