pathwaycom/pathway · error · TypeError
Indexing a table with a Pointer type with probably mismatche
Error message
Indexing a table with a Pointer type with probably mismatched primary keys. Type used was {key_dtype}. Indexed id type was {supertype}. What it means
Raised by Table.ix() when the key is Pointer-typed but its id dtype does not match the indexed table's id column dtype (self._id_column.dtype). Pathway needs the pointer's id type to be compatible with the table's primary key type to guarantee lookups resolve. With optional=True both sides are wrapped in dt.Optional before comparison.
Source
Thrown at python/pathway/internals/table.py:1504
name="ix",
)
restrict_universe = RestrictUniverseDesugaring(context)
expression = restrict_universe.eval_expression(expression)
key_tab = context.select(tmp=expression)
key_col = key_tab.tmp
key_dtype = key_tab.eval_type(key_col)
supertype = dt.ANY_POINTER
if optional:
supertype = dt.Optional(supertype)
if not dt.dtype_issubclass(key_dtype, supertype):
raise TypeError(
f"Pathway supports indexing with Pointer type only. The type used was {key_dtype}."
)
supertype = self._id_column.dtype
if optional:
supertype = dt.Optional(supertype)
if not dt.dtype_issubclass(key_dtype, supertype):
raise TypeError(
"Indexing a table with a Pointer type with probably mismatched primary keys."
+ f" Type used was {key_dtype}. Indexed id type was {supertype}."
)
if optional and isinstance(key_dtype, dt.Optional):
self_ = self.update_types(
**{name: dt.Optional(self.typehints()[name]) for name in self.keys()}
)
else:
self_ = self
if allow_misses:
subset = self_._having(key_col)
new_key_col = key_tab.restrict(subset).tmp
fill = key_tab.difference(subset).select(
**{name: None for name in self.column_names()}
)
return Table.concat(
self_._ix(new_key_col, optional=optional), fill
).with_universe_of(key_tab)View on GitHub (pinned to fa2f74a464)
Solutions
- Align id dtypes before indexing: t1.update_id_type(pw.Pointer()) on one side, or cast the key column so both are the same Pointer subtype
- Build both tables' ids from the same underlying value type (e.g. both from pw.int_as_pointer or both from strings)
- Verify the mismatch first: print t1._id_column.dtype and t2._id_column.dtype
- If you are matching on a business key rather than table ids, switch to join()
Example fix
// before t3 = t1.ix(t2.id) # Pointer[str] vs Pointer[int] -> TypeError // after t1_generic = t1.update_id_type(pw.Pointer()) t3 = t1_generic.ix(t2.id)
Defensive patterns
Strategy: validation
Validate before calling
from pathway.internals import dtype as dt
def ids_compatible(t1, t2) -> bool:
a, b = t1._id_column.dtype, t2._id_column.dtype
return dt.dtype_issubclass(a, b) or dt.dtype_issubclass(b, a) Type guard
def same_id_dtype(t1, t2) -> bool:
return t1._id_column.dtype == t2._id_column.dtype Try / catch
try:
t3 = t1.ix(t2.id)
except TypeError as e:
if 'mismatched primary keys' in str(e):
t3 = t1.update_id_type(pw.Pointer()).ix(t2.id) Prevention
- Build ids for related tables from the same value type
- Print _id_column.dtype when wiring tables from different connectors
- Standardize on pw.Pointer for cross-source lookups
When it happens
Trigger: t1.ix(t2.id) where t1's ids are Pointer[int] and t2's ids are Pointer[str] (or vice versa); tables built from different connectors whose id dtypes differ; indexing after update_id_type changed one side.
Common situations: Mixing tables from different sources (CSV ids vs. Kafka keys); using pointer_from_string on one table and integer ids on another; after schema changes in connectors between versions.
Related errors
- Pathway supports indexing with Pointer type only. The type u
- Pathway supports reindexing Tables with Pointer type only. T
- 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/b2965e575003e344.
Report an issue: GitHub.