[FEA] cudf-polars: `str.slice` rejects a column or expression as the offset

Open Beginner friendly
#24,982 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

@AVS0703 is already working on this.

Since Nov 4, 2026.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
62/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
data

Research direction

The check lives in StringFunction.__init__ in dsl/expressions/string.py, where slice arguments after the first must be a non-float Literal. Start there and find the branch that raises the misleading 'does not support float literal start and stop values' message for a column or expression offset. At minimum, change the error text to say that only literal offsets are supported, then run the repro from the issue to confirm the new message appears. Per-row offsets would need a libcudf change and are a separate, larger task.

Written by the indexing model from the issue text.

Description

cudf-polars feature request good first issue

StringFunction.__init__ in dsl/expressions/string.py requires every slice argument after the first to be a Literal that is not a float, and otherwise raises Slice does not support float literal start and stop values. A column offset trips the same check, so the message is misleading: nothing about it is a float.

Repro is:

import polars as pl

t0 = pl.LazyFrame({"c0": [0]})
t0.select(pl.lit("xh").str.slice(pl.col("c0"), 1).alias("c1")).collect(engine=pl.GPUEngine(raise_on_fail=True))

At minimum the error text should say that only literal offsets are supported. Supporting per-row offsets needs a libcudf call that takes column starts and stops, which I have not looked for.

Related: pola-rs/polars#30187.

Environment: Polars 2.1.0, cudf-polars 26.12.00a616 (nightly wheels), Tesla V100, driver 535.161.08.

Tools: Claude Code

Dominant language
C++
Stars
9.8k
Forks
1.2k
Avg merge
3d 17h
Merged PRs (30d)
306

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from NVIDIA/cudf

All issues in NVIDIA/cudf

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.