pathwaycom/pathway · error · ValueError

Cannot join table with itself. Use <table>.copy() as one of

Error message

Cannot join table with itself. Use <table>.copy() as one of the arguments of the join.

What it means

Error "Cannot join table with itself. Use <table>.copy() as one of the arguments of the join." thrown in pathwaycom/pathway.

Source

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

        *on: pw.ColumnExpression,
        behavior: CommonBehavior | None = None,
        mode: pw.JoinMode,
        left_instance: pw.ColumnReference | None = None,
        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,

View on GitHub (pinned to fa2f74a464)

Solutions

  1. Use <table>.copy() as one of the join arguments when you need to join a table with itself.

Example fix

t.interval_join(t.copy(), ...)

When it happens

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