pathwaycom/pathway · error · ValueError

lower_bound has to be less than or equal to the upper_bound

Error message

lower_bound has to be less than or equal to the upper_bound in the Table.interval_join().

What it means

Error "lower_bound has to be less than or equal to the upper_bound in the Table.interval_join()." thrown in pathwaycom/pathway.

Source

Thrown at python/pathway/stdlib/temporal/_interval_join.py:207

        right_instance: pw.ColumnReference | None = None,
    ) -> IntervalJoinResult:
        """Creates an IntervalJoinResult. To perform an interval join uses it uses two
        tumbling windows of size `lower_bound` + `upper_bound` and then filters the result.
        """
        check_joint_types(
            {
                "self_time_expression": (left_time_expression, TimeEventType),
                "other_time_expression": (right_time_expression, TimeEventType),
                "lower_bound": (interval.lower_bound, IntervalType),
                "upper_bound": (interval.upper_bound, IntervalType),
            }
        )
        if left == right:
            raise ValueError(
                "Cannot join table with itself. Use <table>.copy() as one of the arguments of the join."
            )
        if interval.lower_bound > interval.upper_bound:  # type: ignore[operator]
            raise ValueError(
                "lower_bound has to be less than or equal to the upper_bound in the Table.interval_join()."
            )

        if interval.lower_bound == interval.upper_bound:
            cls: type[IntervalJoinResult] = _ZeroDifferenceIntervalJoinResult
        else:
            cls = _NonZeroDifferenceIntervalJoinResult
        return cls._interval_join(
            left,
            right,
            left_time_expression,
            right_time_expression,
            interval,
            *on,
            behavior=behavior,
            mode=mode,
            left_instance=left_instance,
            right_instance=right_instance,

View on GitHub (pinned to fa2f74a464)

Solutions

  1. Pass a lower_bound that is less than or equal to upper_bound (use non-positive lower_bound and non-negative upper_bound).

Example fix

t1.interval_join(t2, t1.t, t2.t, lower_bound=timedelta(seconds=-10), upper_bound=timedelta(seconds=10))

When it happens

Trigger: Thrown at python/pathway/stdlib/temporal/_interval_join.py:207 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/fe02eed8af471c2f. Report an issue: GitHub.