pathwaycom/pathway · error · TypeError
Pathway does not support using reducer {self} on column of t
Error message
Pathway does not support using reducer {self} on column of type {arg_type}.
What it means
The sum reducer (pathway.reducers.sum) only accepts columns whose dtype is a float subtype or an array subtype (checked via dt.dtype_issubclass against dt.FLOAT and ANY_ARRAY; ints are handled separately in engine_reducer_unary). If the aggregated column is e.g. str, bool, Pointer, or a duration/complex type, return_type_unary raises this TypeError at expression-building time.
Source
Thrown at python/pathway/internals/reducers.py:120
warnings.warn(
f"{self.name} reducer uses processing time to choose elements"
+ " while windowby uses data time to assign entries to windows."
+ " Maybe it is not the behavior you want. To choose elements according"
+ f" to their data time, you may use {self.alternative} reducer.",
stacklevel=12,
)
class SumReducer(UnaryReducer):
def __init__(self, name: str, strict: bool) -> None:
super().__init__(name=name)
self.strict = strict
def return_type_unary(self, arg_type: dt.DType, id_type: dt.DType) -> dt.DType:
for allowed_dtype in [dt.FLOAT, dt.ANY_ARRAY]:
if dt.dtype_issubclass(arg_type, allowed_dtype):
return arg_type
raise TypeError(
f"Pathway does not support using reducer {self}"
+ f" on column of type {arg_type}.\n"
)
def engine_reducer_unary(self, arg_type: dt.DType) -> api.Reducer:
if arg_type == dt.INT:
if self.strict:
raise ValueError(
"Setting strict=True in pathway.reducers.sum when the column has type int is not allowed"
)
return api.Reducer.INT_SUM
elif isinstance(arg_type, dt.Array):
return api.Reducer.array_sum(self.strict)
else:
return api.Reducer.float_sum(self.strict)
class SortedTupleWrappingReducer(UnaryReducerWithDefault):View on GitHub (pinned to fa2f74a464)
Solutions
- Cast the column to numeric before reducing: pw.reducers.sum(pw.this.col.astype(float)) (or int, which selects INT_SUM).
- Fix ingestion so the column is parsed as int/float (e.g. input_format / schema with dtype=float in pw.io.csv.read or pw.io.jsonl.read).
- If the column is genuinely non-numeric, use a different reducer (tuple, count, min/max on comparable types) — summing text is not supported.
Example fix
# before agg = table.groupby(pw.this.key).reduce(total=pw.reducers.sum(pw.this.price)) # price is str # after agg = table.groupby(pw.this.key).reduce(total=pw.reducers.sum(pw.this.price.astype(float)))
Defensive patterns
Strategy: validation
Validate before calling
import pathway as pw
from pathway.internals import dtype as dt
def column_is_summable(table: pw.Table, name: str) -> bool:
d = table.schema._dtypes()[name]
return dt.dtype_issubclass(d, dt.FLOAT) or dt.dtype_issubclass(d, dt.ANY_ARRAY) or d == dt.INT Type guard
import pathway as pw
from pathway.internals import dtype as dt
def is_numeric_column(table: pw.Table, name: str) -> bool:
d = table.schema._dtypes()[name]
return dt.dtype_issubclass(d, dt.FLOAT) or d == dt.INT Prevention
- Declare numeric dtypes explicitly in read schemas instead of relying on auto-detection.
- Cast with .astype(float) when summing columns that connectors may deliver as strings.
When it happens
Trigger: table.reduce(s=pw.reducers.sum(t.col)) where col has dtype str, bool, Optional[str], json, or any non-numeric non-array type; equivalently table.groupby(...).reduce(sum=pw.reducers.sum(...)) on a text column.
Common situations: CSV columns auto-typed as str that hold numbers ('price' parsed as string); aggregating a json column; trying to sum boolean flags.
Related errors
- Pathway does not support using reducer {self.name} on column
- Pathway does not support using binary operator {expression._
- Incompatible types in for a binary operator. The types are:
- {role} {col._name!r} must be of type str, got {col._column.d
- Cannot flatten column of type {dtype}.
AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15).
Data as JSON: /api/errors/4b203b59d2679823.
Report an issue: GitHub.