{"record":{"id":"fc0e5c5b78da9a52","repo":"pathwaycom/pathway","slug":"pathway-supports-indexing-with-pointer-type-only","errorCode":null,"errorMessage":"Pathway supports indexing with Pointer type only. The type used was {key_dtype}.","messagePattern":"Pathway supports indexing with Pointer type only\\. The type used was (.+?)\\.","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"python/pathway/internals/table.py","lineNumber":1497,"sourceCode":"                    expression=expression,\n                    optional=optional,\n                    context=table,\n                    allow_misses=allow_misses,\n                ),\n                expression=expression,\n                qualname=f\"{self}.ix(...)\",\n                name=\"ix\",\n            )\n        restrict_universe = RestrictUniverseDesugaring(context)\n        expression = restrict_universe.eval_expression(expression)\n        key_tab = context.select(tmp=expression)\n        key_col = key_tab.tmp\n        key_dtype = key_tab.eval_type(key_col)\n        supertype = dt.ANY_POINTER\n        if optional:\n            supertype = dt.Optional(supertype)\n        if not dt.dtype_issubclass(key_dtype, supertype):\n            raise TypeError(\n                f\"Pathway supports indexing with Pointer type only. The type used was {key_dtype}.\"\n            )\n        supertype = self._id_column.dtype\n        if optional:\n            supertype = dt.Optional(supertype)\n        if not dt.dtype_issubclass(key_dtype, supertype):\n            raise TypeError(\n                \"Indexing a table with a Pointer type with probably mismatched primary keys.\"\n                + f\" Type used was {key_dtype}. Indexed id type was {supertype}.\"\n            )\n        if optional and isinstance(key_dtype, dt.Optional):\n            self_ = self.update_types(\n                **{name: dt.Optional(self.typehints()[name]) for name in self.keys()}\n            )\n        else:\n            self_ = self\n        if allow_misses:\n            subset = self_._having(key_col)","sourceCodeStart":1479,"sourceCodeEnd":1515,"githubUrl":"https://github.com/pathwaycom/pathway/blob/fa2f74a4649b7c5908690cf60137263d8d80de5f/python/pathway/internals/table.py#L1479-L1515","documentation":"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).","triggerScenarios":"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).","commonSituations":"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.","solutions":["Pass a Pointer-typed key, typically the id column of another table: t.ix(pw.this.id) or t1.ix(t2.id)","If keys are plain values, wrap them with pw.int_as_pointer(...) / pointer construction so the dtype is pw.Pointer","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()","If key_dtype evaluation is unexpected, inspect it via t.eval_type(expr) before calling ix()"],"exampleFix":"// before\nt2 = t1.ix([1, 2, 3])  # plain ints -> TypeError\n\n// after\nimport pathway as pw\nt2 = t1.ix([pw.int_as_pointer(i) for i in [1, 2, 3]])\n# or join on a value column instead of indexing by id","handlingStrategy":"type-guard","validationCode":"import pathway as pw\nfrom pathway.internals import dtype as dt\n\ndef pointer_key_ok(t, expr) -> bool:\n    return dt.dtype_issubclass(t.eval_type(expr), dt.ANY_POINTER)","typeGuard":"def is_pointer_expr(t, expr) -> bool:\n    from pathway.internals import dtype as dt\n    return dt.dtype_issubclass(t.eval_type(expr), dt.ANY_POINTER)","tryCatchPattern":"try:\n    t2 = t1.ix(key)\nexcept TypeError as e:\n    if 'Pointer type only' in str(e):\n        key = [pw.int_as_pointer(k) for k in key]\n        t2 = t1.ix(key)","preventionTips":["Always index with id columns of other tables, not raw values","Inspect t.eval_type(expr) before ix() in notebook experiments","Prefer join() when matching on business keys"],"tags":["pathway","typing","table-indexing","pointer"],"backgroundTag":null,"analyzedSha":"fa2f74a4649b7c5908690cf60137263d8d80de5f","analyzedAt":"2026-08-15T01:48:17.006Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}