Repository navigation
GPU rejects a column expression as the start offset to str.slice #30187
Description
Checks
- I have checked that this issue has not already been reported.
- I have confirmed this bug exists on the latest version of Polars.
Reproducible example
import polars as pl
t0 = pl.LazyFrame({"c0": [0]})
result = t0.select(pl.lit("xh").str.slice(pl.col("c0"), 1).alias("c1"))
print("CPU Result:")
print(result.collect())
print("GPU Result:")
print(result.collect(engine=pl.GPUEngine(raise_on_fail=True)))Log output
CPU Result:
shape: (1, 1)
┌─────┐
│ c1 │
│ --- │
│ str │
╞═════╡
│ x │
└─────┘
GPU Result:
Traceback (most recent call last):
File "/test.py", line 11, in <module>
print(result.collect(engine=pl.GPUEngine(raise_on_fail=True)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/envs/polars-gpu/lib/python3.11/site-packages/polars/_utils/deprecation.py", line 97, in wrapper
return function(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/envs/polars-gpu/lib/python3.11/site-packages/polars/lazyframe/opt_flags.py", line 361, in wrapper
return function(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/envs/polars-gpu/lib/python3.11/site-packages/polars/lazyframe/frame.py", line 2591, in collect
return engine_.collect(
^^^^^^^^^^^^^^^^
File "/opt/conda/envs/polars-gpu/lib/python3.11/site-packages/polars/lazyframe/engine.py", line 443, in collect
return wrap_df(ldf.collect(self.name, callback))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
polars.exceptions.ComputeError: 'cuda' conversion failed: NotImplementedError: ('Query execution with GPU not possible: unsupported operations.\nThe errors were:\n- NotImplementedError: Slice only supports literal start and stop values', [NotImplementedError('Slice only supports literal start and stop values')])Issue description
Slicing the literal string "xh" with pl.col("c0") as the start offset and a literal length of 1 succeeds with CPU collection but fails when the same lazy query is collected with pl.GPUEngine(raise_on_fail=True). The input contains a single offset value, 0.
CPU collection returns a String column c1 containing "x". GPU collection instead raises polars.exceptions.ComputeError wrapping a NotImplementedError, with the diagnostic Slice only supports literal start and stop values.
This example isolates the GPU limitation for a column-based string-slice offset under strict GPU execution. The length is a literal; the start offset is a column expression.
Expected behavior
The GPU execution path should support the column-based string-slice offset and return the same schema and value as CPU collection. Slicing "xh" from offset 0 with length 1 should produce "x":
shape: (1, 1)
┌─────┐
│ c1 │
│ --- │
│ str │
╞═════╡
│ x │
└─────┘
Installed versions
Details
--------Version info---------
Polars: 1.44.2
Index type: UInt32
Platform: Linux-6.17.0-29-generic-x86_64-with-glibc2.39
Python: 3.11.17 (main, Oct 7 2026, 00:02:24) [GCC 15.3.0]
Runtime: rt32
----Optional dependencies----
Azure CLI <not installed>
adbc_driver_manager <not installed>
altair <not installed>
azure.identity <not installed>
boto3 <not installed>
cloudpickle <not installed>
connectorx <not installed>
deltalake <not installed>
fastexcel <not installed>
fsspec <not installed>
gevent <not installed>
google.auth <not installed>
great_tables <not installed>
matplotlib <not installed>
numpy 2.4.6
openpyxl <not installed>
pandas 3.0.6
polars_cloud <not installed>
pyarrow <not installed>
pydantic <not installed>
pyiceberg <not installed>
sqlalchemy <not installed>
torch <not installed>
xlsx2csv <not installed>
xlsxwriter <not installed>
cuda-bindings 12.9.9
cuda-core 1.2.1
cuda-pathfinder 1.8.3
cuda-toolkit 12.9.2.0
cudf-polars-cu12 26.10.0
cudf-streaming-cu12 26.10.0
cupy-cuda12x 14.2.0
kvikio-cu12 26.10.0
libcudf-cu12 26.10.0
libcudf-streaming-cu12 26.10.0
libkvikio-cu12 26.10.0
librapidsmpf-cu12 26.10.0
librmm-cu12 26.10.0
libucx-cu12 1.21.0
libucxx-cu12 0.52.0
nvidia-cublas-cu12 12.9.2.10
nvidia-cuda-nvrtc-cu12 12.9.86
nvidia-cuda-runtime-cu12 12.9.79
nvidia-cufft-cu12 11.4.1.4
nvidia-cufile-cu12 1.14.1.1
nvidia-curand-cu12 10.3.10.19
nvidia-cusolver-cu12 11.7.5.82
nvidia-cusparse-cu12 12.5.10.65
nvidia-libnvcomp-cu12 5.3.0.16
nvidia-ml-py 13.615.71
nvidia-nvjitlink-cu12 12.9.86
nvtx 0.2.16
polars 1.44.2
polars-runtime-32 1.44.2
pylibcudf-cu12 26.10.0
rapids-logger 0.3.0
rapidsmpf-cu12 26.10.0
rmm-cu12 26.10.0
Activity