Rodrigo-Palma opened a new pull request, #4009: URL: https://github.com/apache/iceberg-python/pull/4009
Closes #4006 # Rationale for this change `EnumReader.skip()` was `pass`, so skipping an enum field left its bytes in the stream and every field after it in the record was decoded from the wrong offset. `read()` already delegates to the wrapped reader; `skip()` now does the same. This is reachable from ordinary reads: the manifest entry schema starts with the `status` enum (field id 0), so any read that projects `status` out decodes the rest of the entry from the enum's bytes. ```python decoder = CythonBinaryDecoder(b"\x02\x18") # enum ordinal 1, then 12 reader = EnumReader(ManifestEntryStatus, IntegerReader()) reader.skip(decoder) IntegerReader().read(decoder) # before: 1 (the enum's own bytes, re-read) # after: 12 ``` # Are these changes tested? Yes, two tests in `tests/avro/test_resolver.py`, each parametrized over `StreamingBinaryDecoder` and `CythonBinaryDecoder` (4 cases, all failing before this change): - `test_enum_reader_skip_advances_the_decoder`: after skipping, the next field reads its own value. - `test_enum_reader_skip_matches_read`: reading and skipping leave the decoder at the same position. `pytest tests/ -m unit --ignore=tests/integration` gives 4215 passed. The 9 failures in `tests/avro/test_decoder.py` are present identically on an unmodified `main` in this checkout (a stale compiled Cython extension) and are unrelated to this change. # Are there any user-facing changes? Yes: reads that skip an enum field now return correct values instead of misaligned ones. No API change. -- 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]
