pathwaycom/pathway · error · TypeError
Pathway supports reindexing Tables with Pointer type only. T
Error message
Pathway supports reindexing Tables with Pointer type only. The type used was {index_type}. What it means
Raised by Table._with_new_index() (backs reindex/set-id style operations such as Table.reindex / update_id paths) when the new index expression's evaluated dtype is not an instance of dt.Pointer. Table ids must be Pointer-typed, so reindexing with a plain value column is rejected. Note it requires exactly dt.Pointer (via isinstance), not just any pointer-like dtype.
Source
Thrown at python/pathway/internals/table.py:2001
new_index = self.select(
ref_column=self.pointer_from(*args, instance=instance)
).ref_column
return self._with_new_index(
new_index=new_index,
)
@trace_user_frame
@contextualized_operator
@check_arg_types
def _with_new_index(
self,
new_index: expr.ColumnExpression,
) -> Table:
self._validate_expression(new_index)
index_type = self.eval_type(new_index)
if not isinstance(index_type, dt.Pointer):
raise TypeError(
f"Pathway supports reindexing Tables with Pointer type only. The type used was {index_type}."
)
reindex_column = self._eval(new_index)
assert self._universe == reindex_column.universe
context = clmn.ReindexContext(reindex_column)
return self._table_with_context(context)
@trace_user_frame
@desugar
@contextualized_operator
@check_arg_types
def rename_columns(self, **kwargs: str | expr.ColumnReference) -> Table:
"""Rename columns according to kwargs.
Columns not in keys(kwargs) are not changed. New name of a column must not be `id`.
View on GitHub (pinned to fa2f74a464)
Solutions
- Convert the key to a pointer: use pw.this.make_ptr(...) / pointer constructors so the expression is Pointer-typed before reindexing
- Verify the dtype first: print(t.eval_type(pw.this.key)); if it shows Optional[Pointer] or a plain type, fix the expression
- If the intent is dedup-by-key rather than reindex, use t.deduplicate(...) or groupby-style reduction instead
- Check the exact API you called (reindex vs update_id) and use the one accepting your expression's type
Example fix
# before t2 = t1.reindex(pw.this.user_id) # int column -> TypeError # after (wrap key as pointer, e.g. via the provided pointer helper) t2 = t1.reindex(pw.this.make_ptr(pw.this.user_id))
Defensive patterns
Strategy: type-guard
Validate before calling
from pathway.internals import dtype as dt
def reindex_key_ok(t, expr) -> bool:
return isinstance(t.eval_type(expr), dt.Pointer) Type guard
def is_pointer_dtype(t, expr) -> bool:
from pathway.internals import dtype as dt
return isinstance(t.eval_type(expr), dt.Pointer) Try / catch
try:
t2 = t1.reindex(expr)
except TypeError as e:
if 'reindexing Tables with Pointer type only' in str(e):
t2 = t1.reindex(pw.this.make_ptr(expr)) Prevention
- Convert business keys to pointers before reindexing
- Check eval_type on the index expression first
- Avoid Optional-wrapped pointers for index expressions
When it happens
Trigger: Calling the reindex-path API with an expression like pw.this.user_id (int) or pw.this.email (str): index_type = self.eval_type(new_index) is not a dt.Pointer instance.
Common situations: Reindexing a table by a business key (user id, email) without converting it to a pointer; feeding a column that is Optional[Pointer] instead of Pointer; refactors that changed the index expression's dtype.
Related errors
- Pathway supports indexing with Pointer type only. The type u
- Indexing a table with a Pointer type with probably mismatche
- Incompatible types in for a binary operator. The types are:
- Table.update_types() argument name has to be an existing tab
- Cannot change type from {right} to {left}.\nTable.update_typ
AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15).
Data as JSON: /api/errors/940e3699a37ac546.
Report an issue: GitHub.