pathwaycom/pathway · error · ValueError

At least one of the parameters [predicate, max_gap] should b

Error message

At least one of the parameters [predicate, max_gap] should be provided.

What it means

Error "At least one of the parameters [predicate, max_gap] should be provided." thrown in pathwaycom/pathway.

Source

Thrown at python/pathway/stdlib/temporal/_window.py:555

    >>> result = t.windowby(
    ...     t.t, window=pw.temporal.session(predicate=lambda a, b: abs(a-b) <= 1), instance=t.instance
    ... ).reduce(
    ... pw.this._pw_instance,
    ... pw.this._pw_window_start,
    ... pw.this._pw_window_end,
    ... min_t=pw.reducers.min(pw.this.t),
    ... max_v=pw.reducers.max(pw.this.v),
    ... count=pw.reducers.count(),
    ... )
    >>> pw.debug.compute_and_print(result, include_id=False)
    _pw_instance | _pw_window_start | _pw_window_end | min_t | max_v | count
    0            | 1                | 2              | 1     | 10    | 2
    0            | 4                | 4              | 4     | 3     | 1
    0            | 8                | 10             | 8     | 8     | 3
    1            | 1                | 2              | 1     | 16    | 2
    """
    if predicate is None and max_gap is None:
        raise ValueError(
            "At least one of the parameters [predicate, max_gap] should be provided."
        )
    elif predicate is not None and max_gap is not None:
        raise ValueError("Cannot provide both [predicate, max_gap] at the same time.")
    return _SessionWindow(predicate=predicate, max_gap=max_gap)


@check_arg_types
@trace_user_frame
def sliding(
    hop: int | float | datetime.timedelta,
    duration: int | float | datetime.timedelta | None = None,
    ratio: int | None = None,
    origin: int | float | datetime.datetime | None = None,
) -> Window:
    """Allows grouping together elements within a window of a given length sliding
    across ordered time-like data column according to a specified interval (hop)
    starting from a given origin.

View on GitHub (pinned to fa2f74a464)

Solutions

  1. Provide exactly one of predicate or max_gap to sessionby().

Example fix

pw.temporal.sessionby(max_gap=timedelta(minutes=5))

When it happens

Trigger: Thrown at python/pathway/stdlib/temporal/_window.py:555 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15). Data as JSON: /api/errors/f4d822ac4a00e695. Report an issue: GitHub.