edgarrmondragon commented on code in PR #998:
URL: https://github.com/apache/arrow-nanoarrow/pull/998#discussion_r4409154626


##########
python/src/nanoarrow/iterator.py:
##########
@@ -281,6 +281,26 @@ def _list_iter(self, offset, length):
             for start, end in zip(starts, ends):
                 yield list(islice(child_iter, end - start))
 
+    def _map_iter(self, offset: int, length: int):
+        # A map is a list of (key, value) structs, converted to a list of 
tuples
+        view = self._array_view
+        offset += view.offset
+
+        offsets = memoryview(view.buffer(1))[offset : (offset + length + 1)]
+        starts = offsets[:-1]
+        ends = offsets[1:]
+        entries = self._children[0]
+        entries_iter = entries._struct_tuple_iter(starts[0], ends[-1] - 
starts[0])

Review Comment:
   Thank you for the review :D. I added a quick return for the zero-length case 
at the top of the function.
   



-- 
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]

Reply via email to