Anurag-S1ngh opened a new pull request, #4462:
URL: https://github.com/apache/iceberg-python/pull/4462

   Part of #4078.
   
   # Rationale for this change
   
   JSON single-value conversion had no handler for `timestamp_ns` and 
`timestamptz_ns`, so loading a V3 metadata file with a nanosecond 
`initial-default` raised `TypeError: Cannot deserialize bytes, type 
timestamp_ns not supported`.
   
   Python `datetime` cannot hold nanoseconds, so these values are parsed as 
nanoseconds since epoch and formatted back as ISO-8601 with nine fractional 
digits. This preserves the exact value instead of truncating to microseconds.
   
   ## Are these changes tested?
   
   Yes. The JSON conversion tests cover formatting, round trips, and parsing 
for both nanosecond types, including values supplied as `datetime` where the 
last three digits are zero. A field default test confirms that a nanosecond 
`initial-default` loads as an integer and serializes back unchanged. 
`tests/test_conversions.py` and `tests/test_types.py` pass.
   
   ## Are there any user-facing changes?
   
   No API change. V3 metadata with nanosecond timestamp defaults can now be 
loaded and serialized.
   


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