pathwaycom/pathway · error · NotImplementedError

Currently, brute force knn index is supported only in the as

Error message

Currently, brute force knn index is supported only in the as-of-now variant

What it means

The brute-force KNN index (BruteForceKnnIndex) computes exact nearest neighbors but, like the USearch variant, only supports the as-of-now query flavor: results reflect the index state at the current minibatch without awaiting pending updates. The inherited-style query() method is declared for interface parity and always raises NotImplementedError.

Source

Thrown at python/pathway/stdlib/indexing/nearest_neighbors.py:213

    metric: BruteForceKnnMetricKind
    embedder: pw.UDF | None = None

    # data column after applying embeddings. It is calculated during initialization and
    # cannot be set in the constructor.
    _data_column: pw.ColumnReference = field(init=False)

    def __post_init__(self):
        _data_column = _calculate_embeddings(self.data_column, self.embedder)
        object.__setattr__(self, "_data_column", _data_column)

    def query(
        self,
        query_column: pw.ColumnReference,
        number_of_matches: pw.ColumnExpression | int = 3,
        metadata_filter: pw.ColumnExpression | None = None,
    ) -> pw.Table:
        """Currently, brute force knn index is supported only in the as-of-now variant"""
        raise NotImplementedError(
            "Currently, brute force knn index is supported only in the as-of-now variant"
        )

    @check_arg_types
    def query_as_of_now(
        self,
        query_column: pw.ColumnReference,
        number_of_matches: pw.ColumnExpression | int = 3,
        metadata_filter: pw.ColumnExpression | None = None,
    ) -> pw.Table:
        index = self._data_column.table

        query_column = _calculate_embeddings(query_column, self.embedder)
        queries = query_column.table

        check_default_knn_column_types(
            self._data_column,
            query_column,

View on GitHub (pinned to fa2f74a464)

Solutions

  1. Call query_as_of_now(query_column, number_of_matches=...) instead.
  2. Standardize all index call sites in the codebase on query_as_of_now for consistency across Pathway index types.
  3. Track Pathway releases if blocking-consistent query() becomes available for brute-force KNN.

Example fix

# before
results = index.query(query_table.query, number_of_matches=3)

# after
results = index.query_as_of_now(query_table.query, number_of_matches=3)
Defensive patterns

Strategy: try-catch

Try / catch

try:
    res = index.query(query_col, number_of_matches=3)
except NotImplementedError:
    res = index.query_as_of_now(query_col, number_of_matches=3)

Prevention

When it happens

Trigger: Calling .query(...) on a BruteForceKnnIndex (built directly or via BruteForceKnnFactory.build_inner_index()) rather than .query_as_of_now(...).

Common situations: Small-dataset pipelines that chose brute-force search for exactness, with call sites copied from generic index examples using .query(); shared retrieval wrappers that call .query() on whatever index object they receive.

Related errors


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