linzch3 opened a new pull request, #3726:
URL: https://github.com/apache/iceberg-rust/pull/3726
## Which issue does this PR close?
- Closes #3725.
## What changes are included in this PR?
**Background.** `Datum::to` returns a datum with
`PrimitiveLiteral::AboveMax` / `BelowMin` when a value is out of range for the
target type (e.g. a long bigger than `i32::MAX` converted to int). Formatting
one with `{}` panicked, and since binding `IN` keeps these literals (#3716), a
bound predicate can carry one into an error message or a log line.
**Root cause.** `impl Display for Datum` had no arm for `AboveMax` /
`BelowMin`, so they fell through to `(_, _) => unreachable!()`.
**Fix.** Two new arms print `AboveMax` and `BelowMin`, matching the `Debug`
output of the literal. Nothing else changes.
## Are these changes tested?
Yes. `test_datum_display_above_max_and_below_min` formats the results of
out-of-range long -> int (above and below) and double -> float conversions. It
panics without the fix.
Ran locally: `cargo test -p iceberg --lib` (2271 passed), `cargo clippy -p
iceberg --all-targets --all-features -- -D warnings`, `cargo fmt --all --
--check`.
**Limitations.** The catch-all `unreachable!()` is still there for other
type/literal mismatches, I kept this PR to the two cases in the issue. If u'd
rather print something like `<type>(<literal>)` for those too, happy to do that
here.
## AI Disclosure
This change was prepared with an AI coding assistant; the tests above were
run locally and I've reviewed the changes myself.
Opening as a draft only because I'm at the 3 open non-draft PR limit for
non-committers. Happy to adjust the wording of the output or the approach if u
prefer something else.
--
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]