HyukjinKwon opened a new pull request, #48769:
URL: https://github.com/apache/arrow/pull/48769

   ### Rationale for this change
   
   Closes ARROW-18281, which has been open since 2022. The `list_slice` kernel 
currently rejects `start == stop`, but should return empty lists instead 
(following Python slicing semantics).
   
   The underlying implementation already handles this case correctly. When 
ARROW-18282 added step support, the formula `bit_util::CeilDiv(stop - start, 
step)` naturally returns 0 for `start == stop`, producing empty lists. The only 
issue was an overly restrictive validation check (`start >= stop`) that 
prevented this from working.
   
   ### What changes are included in this PR?
   
   - Changed validation from `start >= stop` to `start > stop` 
   - Updated error message
   - Added test cases
   
   ### Are these changes tested?
   
   Yes, tests were added.
   
   ### Are there any user-facing changes?
   
   Yes.
   
   ```python
   import pyarrow as pa
   pc.list_slice([[1,2,3]], 0, 0)
   ```
   
   Before:
   
   ```
   pyarrow.lib.ArrowInvalid: `start`(0) should be greater than 0 and smaller 
than `stop`(0)
   ```
   
   After:
   
   ```
   <pyarrow.lib.ListArray object at 0x1a01b8b20>
   [
     []
   ]
   ```


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