LucasG0 commented on code in PR #40682:
URL: https://github.com/apache/arrow/pull/40682#discussion_r1536944021
##########
python/pyarrow/array.pxi:
##########
@@ -549,41 +549,9 @@ def _normalize_slice(object arrow_obj, slice key):
Py_ssize_t start, stop, step
Py_ssize_t n = len(arrow_obj)
- step = key.step or 1
-
- if key.start is None:
- if step < 0:
- start = n - 1
- else:
- start = 0
- elif key.start < 0:
- start = key.start + n
- if start < 0:
- start = 0
- elif key.start >= n:
- start = n
- else:
- start = key.start
-
- if step < 0 and (key.stop is None or key.stop < -n):
- stop = -1
- elif key.stop is None:
- stop = n
- elif key.stop < 0:
- stop = key.stop + n
- if stop < 0: # step > 0 in this case.
- stop = 0
- elif key.stop >= n:
- stop = n
- else:
- stop = key.stop
-
- if step != 1:
- indices = np.arange(start, stop, step)
- return arrow_obj.take(indices)
- else:
- length = max(stop - start, 0)
- return arrow_obj.slice(start, length)
Review Comment:
Ok, I added it back
--
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]