pathwaycom/pathway · error · TypeError

Arguments ({', '.join(parameters.keys())}) have to be of typ

Error message

Arguments ({', '.join(parameters.keys())}) have to be of types {expected_types_string} but are of types {tuple(types.values())}.

What it means

check_joint_types verifies that a group of columns handed to a temporal stdlib function form one of the allowed dtype combinations: (int, int), (float, float), or (datetime, timedelta) for a (time, interval) pair. The loop tries each expected combination using dt.dtype_issubclass; if none matches all arguments simultaneously, it raises TypeError listing the expected combinations and the actual dtypes. It fires at graph-construction time, before any data is processed.

Source

Thrown at python/pathway/stdlib/temporal/utils.py:79

        expected_types.append(
            {
                name: _get_possible_types(expected_type)[i]
                for name, (_variable, expected_type) in parameters.items()
            }
        )
    for ex_types in expected_types:
        if all(
            [
                dt.dtype_issubclass(dtype, ex_dtype)
                for (dtype, ex_dtype) in zip(types.values(), ex_types.values())
            ]
        ):
            break
    else:
        expected_types_string = " or ".join(
            repr(tuple(ex_types.values())) for ex_types in expected_types
        )
        raise TypeError(
            f"Arguments ({', '.join(parameters.keys())}) have to be of types "
            + f"{expected_types_string} but are of types {tuple(types.values())}."
        )

View on GitHub (pinned to fa2f74a464)

Solutions

  1. Cast the mismatched columns so the pair matches: both int/float, or both datetime with a timedelta duration, e.g. table.dt.cast(dt.DATE_TIME_NAIVE) or table.dt.to_datetime() on the epoch column
  2. Convert int durations to timedelta with .dt.to_duration() (or apply(lambda ms: datetime.timedelta(milliseconds=ms)))
  3. Print table.schema_types() or pathway's dt.eval_type() on each argument to see which column has the wrong dtype before the call

Example fix

# before (int epoch vs datetime)
t2 = t2.with_columns(t2.ts.dt.to_datetime(unit='ms'))
t1.interval_asof_join(t2, t1.ts, t2.ts, t1.delta, t2.delta, ...)

# after (both datetime, durations already timedelta)
t1.interval_asof_join(t2, t1.ts, t2.ts, t1.delta, t2.delta, ...)
Defensive patterns

Strategy: validation

Validate before calling

from pathway import dt
allowed = [(dt.INT, dt.INT), (dt.FLOAT, dt.FLOAT), (dt.DATE_TIME_NAIVE, dt.DURATION)]
types = {n: dt.eval_type(c) for n, c in cols.items()}
assert any(all(dt.dtype_issubclass(types[n], ex[n]) for n in types) for ex in allowed), f'bad dtype combo: {types}'

Type guard

def joint_temporal_types_ok(cols: dict[str, Any]) -> bool:
    from pathway import dt
    types = {n: dt.eval_type(c) for n, c in cols.items()}
    combos = [(dt.INT, dt.INT), (dt.FLOAT, dt.FLOAT), (dt.DATE_TIME_NAIVE, dt.DURATION), (dt.DATE_TIME_UTC, dt.DURATION)]
    return any(all(dt.dtype_issubclass(t, e) for t, e in zip(types.values(), combo)) for combo in combos)

Try / catch

try:
    result = temporal_fn(...)
except TypeError as e:
    if 'have to be of types' in str(e):
        raise TypeError(f'dtype mismatch, fix casts: {e}') from e
    raise

Prevention

When it happens

Trigger: Mixing time representations, e.g. interval_asof_join with self_time as int and other_time as datetime.datetime; passing an int duration against a datetime timestamp; passing a float duration with a DATE_TIME_NAIVE time; one argument wrapped in an Optional/any dtype that is not a subclass of any allowed dtype.

Common situations: Joining tables whose timestamp columns were inferred differently (one parsed as int epoch, the other as datetime); passing Python ints as durations where the time column is datetime; schema drift after a source connector change (e.g. CSV column re-parsed as string); upgrading data pipelines where duration columns were previously timedelta and are now int.

Related errors


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