pathwaycom/pathway · error · TypeError

Pathway supports indexing with Pointer type only. The type u

Error message

Pathway supports indexing with Pointer type only. The type used was {key_dtype}.

What it means

Raised by Table.ix() when the key expression's dtype is not a Pointer (or Optional[Pointer] if optional=True). Pathway row lookups are keyed by table IDs, which are Pointer-typed values, so ix() refuses plain ints/strings/etc. The check uses dt.dtype_issubclass(key_dtype, dt.ANY_POINTER).

Source

Thrown at python/pathway/internals/table.py:1497

                    expression=expression,
                    optional=optional,
                    context=table,
                    allow_misses=allow_misses,
                ),
                expression=expression,
                qualname=f"{self}.ix(...)",
                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)

View on GitHub (pinned to fa2f74a464)

Solutions

  1. Pass a Pointer-typed key, typically the id column of another table: t.ix(pw.this.id) or t1.ix(t2.id)
  2. If keys are plain values, wrap them with pw.int_as_pointer(...) / pointer construction so the dtype is pw.Pointer
  3. If you want to match rows by a value column rather than by id, use Table.join/t.join(t2, t2.key == t.key) instead of ix()
  4. If key_dtype evaluation is unexpected, inspect it via t.eval_type(expr) before calling ix()

Example fix

// before
t2 = t1.ix([1, 2, 3])  # plain ints -> TypeError

// after
import pathway as pw
t2 = t1.ix([pw.int_as_pointer(i) for i in [1, 2, 3]])
# or join on a value column instead of indexing by id
Defensive patterns

Strategy: type-guard

Validate before calling

import pathway as pw
from pathway.internals import dtype as dt

def pointer_key_ok(t, expr) -> bool:
    return dt.dtype_issubclass(t.eval_type(expr), dt.ANY_POINTER)

Type guard

def is_pointer_expr(t, expr) -> bool:
    from pathway.internals import dtype as dt
    return dt.dtype_issubclass(t.eval_type(expr), dt.ANY_POINTER)

Try / catch

try:
    t2 = t1.ix(key)
except TypeError as e:
    if 'Pointer type only' in str(e):
        key = [pw.int_as_pointer(k) for k in key]
        t2 = t1.ix(key)

Prevention

When it happens

Trigger: Calling table.ix(keys) where keys is an int, str, or a column/expression whose evaluated dtype is not a Pointer subtype (e.g. t.ix(pw.this.some_int_column), t2 = t.ix([1,2,3]) without pointer conversion).

Common situations: Loading a table with integer/string ids from markdown or CSV and trying to look up rows by those raw ids; passing a join key column instead of the id column; migrating code that assumed Python-dict-style indexing.

Related errors


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