You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
upsert rewrites unchanged rows that contain NaN on every call #4618
upsert treats an unchanged row as updated when a float column holds NaN. Upserting the exact data that is already in the table reports rows_updated=1 and commits two snapshots every time: an overwrite that rewrites the data file and an append.
Without the NaN row the same script prints rows_updated=0 and the table stays at 1 snapshot.
_values_differ in pyiceberg/table/upsert_util.py compares with pc.equal, and NaN never equals NaN there. Two nulls are already treated as equal (both_null), but two NaNs are not. The description of #4334 says two NaN values in the same column compare equal, but the code doesn't do that yet and there is no NaN test.
A fix could OR is_nan(source) & is_nan(target) into both_null for floating-point columns, with a test in tests/table/test_upsert.py. I can open a PR with that if it sounds right.
Willingness to contribute
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
Plan: reproduce with the script from the report, then fix the upsert row-matching so a NaN in a float column compares equal to NaN for matching purposes (checking how scans handled the analogous NaN case in #4346 for the house pattern), so re-upserting identical data reports no updates and commits no new snapshots. I'll add a regression test based on the repro.
Disclosure: I work with AI assistance and review everything myself before posting.
Activity
ksaiharshavinay commentedon Dec 4, 2026
I'd like to take this one.
Plan: reproduce with the script from the report, then fix the upsert row-matching so a NaN in a float column compares equal to NaN for matching purposes (checking how scans handled the analogous NaN case in #4346 for the house pattern), so re-upserting identical data reports no updates and commits no new snapshots. I'll add a regression test based on the repro.
Disclosure: I work with AI assistance and review everything myself before posting.
KartikGupta2007 commentedon Dec 4, 2026
As mentioned in the report, I'd planned to send the fix and a test for this myself. I'll wait for a maintainer to say which way they'd like it to go.