rdblue commented on code in PR #5116:
URL: https://github.com/apache/iceberg/pull/5116#discussion_r907838087
##########
python/src/iceberg/avro/reader.py:
##########
@@ -211,26 +282,39 @@ class MapReader(Reader):
def read(self, decoder: BinaryDecoder) -> dict:
read_items = {}
- block_count = decoder.read_long()
+ block_count = decoder.read_int()
while block_count != 0:
if block_count < 0:
block_count = -block_count
# We ignore the block size for now
- _ = decoder.read_long()
+ _ = decoder.read_int()
for _ in range(block_count):
key = self.key.read(decoder)
read_items[key] = self.value.read(decoder)
- block_count = decoder.read_long()
+ block_count = decoder.read_int()
return read_items
+ def skip(self, decoder: BinaryDecoder) -> None:
+ block_count = decoder.read_int()
+ while block_count != 0:
+ if block_count < 0:
+ block_count = -block_count
+ block_size = decoder.read_int()
+ decoder.skip(block_size)
+ else:
+ for _ in range(block_count):
+ self.key.skip(decoder)
+ self.value.skip(decoder)
+ block_count = decoder.read_int()
Review Comment:
Same here.
Can `MapReader` and `ListReader` be refactored to use the same `skip`
method? Not a big deal to copy this twice, but that would cut down on
inconsistencies.
--
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]