[FEA] Support `shift` and `diff` in groupby/rolling for cudf-polars
- Dominant language
- C++
- Stars
- 9.8k
- Forks
- 1.1k
- Avg merge
- 3d 6m
- Merged PRs (30d)
- 278
Description
```python
import polars as pl
lf = pl.LazyFrame(
{
"v": [1, 2, 3, 4],
"g": [1, 1, 1, 2],
}
)
with pl.Config() as cfg:
cfg.set_verbose(True)
print(lf.group_by('g').agg((pl.col('v').diff()).sum()).collect(engine='gpu'))
print(lf.group_by('g').agg((pl.col('v') - pl.col('v').shift()).sum()).collect(engine='gpu'))
cfg.set_verbose(True)
print(lf.select((pl.col('v').diff()).sum().over('g')).collect(engine='gpu'))
print(lf.select((pl.col('v')-pl.col('v').shift()).sum().over('g')).collect(engine='gpu'))
"""
shape: (2, 2)
┌─────┬─────┐
│ g ┆ v │
│ --- ┆ --- │
│ i64 ┆ i64 │
╞═════╪═════╡
│ 1 ┆ 2 │
│ 2 ┆ 0 │
└─────┴─────┘
shape: (2, 2)
┌─────┬─────┐
│ g ┆ v │
│ --- ┆ --- │
│ i64 ┆ i64 │
╞═════╪═════╡
│ 1 ┆ 2 │
│ 2 ┆ 0 │
└─────┴─────┘
shape: (4, 1)
┌─────┐
│ v │
│ --- │
│ i64 │
╞═════╡
│ 2 │
│ 2 │
│ 2 │
│ 0 │
└─────┘
shape: (4, 1)
┌─────┐
│ v │
│ --- │
│ i64 │
╞═════╡
│ 2 │
│ 2 │
│ 2 │
│ 0 │
└─────┘
/opt/miniconda3_py312/lib/python3.12/site-packages/polars/lazyframe/frame.py:2335: PerformanceWarning: Query execution with GPU not possible: unsupported operations.
The errors were:
- NotImplementedError: No support for in groupby/rolling
- NotImplementedError: Unary function name='diff'
return wrap_df(ldf.collect(engine, callback))
keys/aggregates are not partitionable: running default HASH AGGREGATION
/opt/miniconda3_py312/lib/python3.12/site-packages/polars/lazyframe/frame.py:2335: PerformanceWarning: Query execution with GPU not possible: unsupported operations.
The errors were:
- NotImplementedError: No support for in groupby/rolling
- NotImplementedError: Unary function name='shift'
return wrap_df(ldf.collect(engine, callback))
keys/aggregates are not partitionable: running default HASH AGGREGATION
"""
```
The cudf_polars version is '25.10.00a364'.
Contributor guide
Assessment
This issue has not been assessed yet.