rdblue commented on code in PR #5116:
URL: https://github.com/apache/iceberg/pull/5116#discussion_r907837529
##########
python/src/iceberg/avro/reader.py:
##########
@@ -192,17 +252,28 @@ class ListReader(Reader):
def read(self, decoder: BinaryDecoder) -> list:
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):
read_items.append(self.element.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.element.skip(decoder)
+ block_count = decoder.read_int()
Review Comment:
I think this should be aligned with the `if` / `else`. Otherwise, the `if`
case doesn't read the next `block_count` and is an infinite loop.
--
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]