[C++] utf8_slice_codeunits doesn't support stop/step array type
- Dominant language
- C++
- Stars
- 17.1k
- Forks
- 4.3k
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 91
Description
### Describe the enhancement requested
Currently arrow compute `utf8_slice_codeunits` doesn't stop/step parameters with array type. When running following code, it'll raise `TypeError`
```python
import pyarrow as pa
import pyarrow.compute as pc
animals = pa.array(["A11A", "Horse", "Brittle stars", "Centipede"])
pc.utf8_slice_codeunits(animals, start=0, stop=pa.array([1, 2, 3, 4]))
```
Exception:
```
Traceback (most recent call last):
File "/Users/chaokunyang/anaconda3/envs/py3.8/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3460, in run_code
File "/var/folders/zz/mnr4zfjn45j2d_vl88bz8hm80000gp/T/ipykernel_13874/31766106.py", line 1, in
pc.utf8_slice_codeunits(animals, start=0, stop=pa.array([1, 2, 3, 4]))
File "/Users/chaokunyang/anaconda3/envs/py3.8/lib/python3.8/site-packages/pyarrow/compute.py", line 252, in wrapper
File "/Users/chaokunyang/anaconda3/envs/py3.8/lib/python3.8/site-packages/pyarrow/compute.py", line 215, in _handle_options
def _wrap_function(name, func):
File "pyarrow/_compute.pyx", line 1168, in pyarrow._compute.SliceOptions.__init__
File "pyarrow/_compute.pyx", line 1147, in pyarrow._compute._SliceOptions._set_options
TypeError: an integer is required
```
It would be nice to add such support into arrow compute.
### Component(s)
C++
Contributor guide
Research direction
Start with the pyarrow.compute.utf8_slice_codeunits entry point and the SliceOptions handling named in the traceback. Reproduce the example with an array-valued stop, then investigate the corresponding Arrow compute path and add regression coverage for array-valued stop and step parameters. Done means the example no longer raises TypeError and produces the expected sliced array.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- data-engineering
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100