Skip to content

[FEA] Support rolling-by expressions inside over() in cuDF-Polars #23591

Description

@rjzamora

Grouped rolling-by expressions inside over(...) are not currently supported by cudf-polars. We should add both in-memory and streaming support for this expression family.

This issue should cover the common rolling_*_by(...).over(...) variants:

  • rolling_sum_by(...).over(...)
  • rolling_mean_by(...).over(...)
  • rolling_min_by(...).over(...)
  • rolling_max_by(...).over(...)

Example

def test_rolling_sum_by_over(engine: GPUEngine) -> None:
    """``rolling_sum_by(...).over(...)``.

    Status
    ------
    - In-memory NOT supported
    - Streaming NOT supported
    """
    lf = pl.LazyFrame(
        {
            "g": ["A", "A", "A", "B", "B"],
            "ts": [
                "2025-01-01 09:00:00",
                "2025-01-01 09:01:00",
                "2025-01-01 09:04:00",
                "2025-01-01 09:00:00",
                "2025-01-01 09:03:00",
            ],
            "x": [10.0, 20.0, 30.0, 40.0, 50.0],
        }
    ).with_columns(pl.col("ts").str.to_datetime())

    q = lf.select(
        pl.col("x").rolling_sum_by("ts", window_size="5m").over("g").alias("rs")
    )
    assert_gpu_result_equal(q, engine=engine)

Metadata

Metadata

Assignees

No one assigned

    Labels

    cudf-polarsIssues specific to cudf-polarsfeature requestNew feature or request

    Type

    No type

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions