fallintoplace opened a new pull request, #3405:
URL: https://github.com/apache/iceberg-python/pull/3405

   ## Summary
   
   Fixes precision loss when converting large integral strings in two runtime 
paths:
   
   - `StringLiteral.to(IntegerType/LongType)`
   - `partition_to_py(...)` for integral and time-based partition values backed 
by integers
   
   ## Root cause
   
   Both paths were converting through `float` before converting to `int`, which 
loses precision for values outside the IEEE-754 exact integer range.
   
   That caused valid 64-bit integers like `LongType.max` and `9007199254740993` 
to be corrupted.
   
   ## What changed
   
   - Replaced `int(float(...))` with exact integer parsing in `partition_to_py`
   - Replaced float-based string-to-int/long literal conversion with 
decimal-based truncation that preserves the existing `"3.141" -> 3` behavior
   - Added regression tests for `LongType.max` and `9007199254740993`
   
   ## Validation
   
   - `uv run pytest tests/expressions/test_literals.py 
tests/test_conversions.py`
   
   Closes #3404.
   


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