ksaiharshavinay opened a new issue, #4623:
URL: https://github.com/apache/iceberg-python/issues/4623

   ### Apache Iceberg version
   
   main (development)
   
   ### Please describe the bug 🐞
   
   Follow-up to #4618 (fixed for top-level float columns in #4622), as 
requested by @Fokko in the review there.
   
   `_values_differ` in `pyiceberg/table/upsert_util.py` only handles flat 
columns through the pyarrow compute path. For nested types (struct, list, map) 
`pc.equal` raises, so the code falls back to comparing Python lists from 
`to_pylist()`, where two distinct `float('nan')` objects are unequal. A row 
whose only content is a struct or list containing NaN is therefore reported as 
changed on every upsert, and the upsert rewrites it and commits new snapshots 
each time — the same symptom as #4618, through the fallback path.
   
   The same applies to `float16` columns: `pa.types.is_floating` is true for 
them, but `pc.equal` may not support float16 and raises, sending them through 
the same fallback. (Iceberg has no float16 type of its own, so this side is 
lower priority.)
   
   Expected: a row that is unchanged apart from NaN values nested inside a 
struct/list should not count as an update, matching the top-level float 
behavior from #4622. Null handling should stay as it is (null vs NaN is a 
change, in both directions).
   
   I am happy to work on this as a follow-up PR once the approach is agreed — 
one option is a NaN-aware comparison for the fallback path that walks nested 
values.
   
   ### Willingness to contribute
   
   - [x] I can contribute a fix for this bug independently
   - [ ] I would be willing to contribute a fix for this bug with guidance from 
the Iceberg community
   - [ ] I cannot contribute a fix for this bug at this time
   
   Disclosure: I work with AI assistance and review everything myself before 
posting.


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