AP24110011695 opened a new issue, #4286:
URL: https://github.com/apache/iceberg-python/issues/4286
### Apache Iceberg version
main (0.12.0)
### Please describe the bug this is related to
`float('inf')` is accepted as a valid float/double literal (NaN is rejected
at construction, but infinity is a representable Iceberg double value).
Converting such a literal to a `DecimalType` crashes with a bare
`decimal.InvalidOperation` from inside `Decimal.quantize`, instead of the
`ValueError("Could not convert X into a Y")` that every other impossible
conversion in `pyiceberg/expressions/literals.py` raises:
- `FloatLiteral.to(DecimalType)`
- `DoubleLiteral.to(DecimalType)`
### Describe how to reproduce the bug
```python
from pyiceberg.expressions.literals import DoubleLiteral
from pyiceberg.types import DecimalType
DoubleLiteral(float("inf")).to(DecimalType(10, 2))
# decimal.InvalidOperation: [<class 'decimal.InvalidOperation'>]
```
### Willingness to contribute
- [x] Yes. I will be willing to submit a PR for this bug.
---
_Transparent disclosure: this issue was investigated and filed with AI
assistance (reproduction verified locally on main @ e3564a5)._
--
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]