Repository navigation
Conversation
_added_data_files and _deleted_data_files return iterators. Both validators called any() on the iterator and then built the error message from the same, now partially consumed, iterator. any() stops at the first truthy element, so the set comprehension saw only what remained: with a single conflicting entry it produced an empty set, and with several it silently dropped the first. The result was a ValidationException that could not name the snapshot it conflicted with -- 'Added data files were found matching the filter for snapshots set()!' -- which makes a real conflict hard to diagnose. Materialise the entries once before testing them. The existing tests did not catch this because they patch the helpers with a list, which can be iterated twice. The new tests patch with an iterator, as the real helpers return, and assert every conflicting snapshot id reaches the message.
|
This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that's incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the [email protected] list. Thank you for your contributions. |
|
This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that's incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the [email protected] list. Thank you for your contributions. |
Rationale for this change
_added_data_filesand_deleted_data_filesreturnIterator[ManifestEntry]. Both validators callany()on the iterator and then build the error message from that same, now partially consumed, iterator:any()stops at the first truthy element, so the set comprehension only sees what is left:set()The single-entry case is the common one, and it produces a
ValidationExceptionthat cannot name the snapshot it conflicted with:I hit this on a concurrent
Table.overwritewith anoverwrite_filter, where two writers do a read-modify-write of the same key. The validation itself is correct — there genuinely was a conflicting file — but the message gives nothing to debug with, and "snapshots set()" reads like an internal error rather than a real conflict.Affects
_validate_added_data_filesand_validate_deleted_data_files. Both are fixed here.Are these changes tested?
Yes. Two tests added to
tests/table/test_validate.py, one per validator. Both fail onmainand pass with the fix:With the fix,
tests/table/test_validate.pyis 18 passed.The existing
test_validate_added_data_files_raises_on_conflictdid not catch this because it patches the helper with a list, which can be iterated twice. The new tests patch with aniter(...), matching what the real helpers return, and assert that every conflicting snapshot id reaches the message — including the multi-entry case, which covers the silent drop as well as the empty set.Are there any user-facing changes?
Only the exception message, which now names the conflicting snapshots as it was always meant to. No behavioural change to when validation raises.