NVIDIA / NVIDIA/cudf

[FEA] Support `polars.Expr.str.extract_all` in `cudf-polars`

Open
#18,990 0 comments 0 reactions 0 assignees View on GitHub
cudf-polars feature request Python
Dominant language
C++
Stars
9.8k
Forks
1.1k
Avg merge
3d 6m
Merged PRs (30d)
278

Description

**Is your feature request related to a problem? Please describe.**
Today on `branch-25.08`, we lack support for [polars.Expr.str.extract_all](https://docs.pola.rs/api/python/stable/reference/expressions/api/polars.Expr.str.extract_all.html). Running a simplified the example from the docs that removes the need for structs, the `unnest` function, etc, yields:
```
import polars as pl
engine = pl.GPUEngine(raise_on_fail=True)

df = pl.DataFrame(
data={
"email": [
"real.email@spam.com",
"some_account@somewhere.net",
"abc.def.ghi.jkl@uvw.xyz.co.uk",
]
}
).lazy()
df = df.with_columns(
pl.col("email")
.str.extract_all(
r"""(?xi) # activate 'verbose' and 'case-insensitive' flags
[ # (start character group)
A-Z # letters
0-9 # digits
._%+\- # special chars
] # (end character group)
+ # 'one or more' quantifier
"""
)
)
res = df.collect(engine=engine)
print(res)
```

```
NotImplementedError: String function
```

**Describe the solution you'd like**
I'd like the above code to be able to execute using the polars GPU backend. The bigger blocker for this one is that it returns a `list[str]` dtype, which we don't support. Next we'd have to figure out how to hammer the output of `cudf::strings::extract` (which is logically similar but returns a column for each group) into the list type that polars returns.

**Describe alternatives you've considered**
N/A

**Additional context**
https://github.com/rapidsai/cudf/issues/16480

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.