adiranjan25 commented on issue #19218:
URL: https://github.com/apache/iceberg/issues/19218#issuecomment-7290070844

   I independently investigated the arithmetic boundaries and found an 
additional correctness concern with using 
Math.addExact(Math.multiplyExact(millis, 1_000_000L), nanos) directly.
   
   For example:
   
   - millis = -9223372036855L
   - nanosOfMillisecond = 224192
   - mathematically correct result = Long.MIN_VALUE
   
   Although the final result is representable, the intermediate multiplication 
overflows. Consequently, the straightforward checked-arithmetic approach would 
incorrectly reject a valid timestamp.
   
   The same problem affects other valid timestamps within the earliest 
representable millisecond.
   
   A boundary-safe conversion should reject genuinely unrepresentable values 
while preserving the complete signed int64 nanosecond range.
   
   I also identified similar unchecked arithmetic in RowDataWrapper and 
RowDataToAvroConverters that may warrant additional investigation.


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