Umer-Butt07 commented on code in PR #1046:
URL: https://github.com/apache/arrow-nanoarrow/pull/1046#discussion_r4782911857


##########
python/src/nanoarrow/iterator.py:
##########
@@ -284,6 +285,30 @@ def _list_iter(self, offset, length):
             for start, end in zip(starts, ends):
                 yield list(islice(child_iter, end - start))
 
+    def _run_end_encoded_iter(self, offset, length):
+        if length == 0:
+            return
+
+        offset += self._array_view.offset
+        stop = offset + length
+        run_ends = iter(self._children[0])
+        values = self._children[1]
+        for run_index, run_end in enumerate(run_ends):
+            if run_end <= offset:
+                continue
+
+            # Start at the first overlapping run without converting skipped 
values.
+            value_iter = values._iter_chunk(
+                run_index, len(values._array_view) - run_index
+            )

Review Comment:
   thanks, i switched the slice lookup to binary search on the run ends and 
limited the value iterator to just the runs that overlap the slice. the python 
tests and doctests passed locally.



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