2626
2727namespace paimon {
2828// / Reads and evaluates filter predicates against a global file index.
29- // / `GlobalIndexReader` is an implementation of the `FunctionVisitor` interface
30- // / specialized to produce `std::shared_ptr<GlobalIndexResult>` objects.
3129// /
3230// / Derived classes are expected to implement the visitor methods (e.g., `VisitEqual`,
3331// / `VisitIsNull`, etc.) to return index-based results that indicate which
3432// / row satisfy the given predicate.
33+ // /
34+ // / @note All `GlobalIndexResult` objects returned by implementations of this class use **local row
35+ // / ids** that start from 0 — not global row ids in the entire table.
36+ // / The `GlobalIndexResult` can be converted to global row ids by calling `AddOffset()`.
3537class PAIMON_EXPORT GlobalIndexReader : public FunctionVisitor<std::shared_ptr<GlobalIndexResult>> {
3638 public:
3739 // / TopKPreFilter: A lightweight pre-filtering function applied **before** similarity scoring.
38- // / It operates solely on row_id and is typically driven by other global index, such as bitmap,
39- // / or range index. This filter enables early pruning of irrelevant candidates (e.g., "only
40- // / consider rows with label X"), significantly reducing the search space. Returns true to
40+ // / It operates solely on **local row ids** and is typically driven by other global index, such
41+ // / as bitmap, or range index. This filter enables early pruning of irrelevant candidates (e.g.,
42+ // / "only consider rows with label X"), significantly reducing the search space. Returns true to
4143 // / include the row in Top-K computation; false to exclude it.
4244 // /
4345 // / @note Must be thread-safe.
@@ -47,7 +49,8 @@ class PAIMON_EXPORT GlobalIndexReader : public FunctionVisitor<std::shared_ptr<G
4749 // /
4850 // / @param k Number of top results to return.
4951 // / @param query The query vector (must match the dimensionality of the indexed vectors).
50- // / @param filter A pre-filter based on row_id, implemented by leveraging other global index
52+ // / @param filter A pre-filter based on **local row ids**, implemented by leveraging other
53+ // / global index
5154 // / structures (e.g., bitmap index) for efficient candidate pruning.
5255 // / @param predicate A runtime filtering condition that may involve graph traversal of
5356 // / structured attributes. **Using this parameter often yields better
@@ -58,7 +61,8 @@ class PAIMON_EXPORT GlobalIndexReader : public FunctionVisitor<std::shared_ptr<G
5861 // / context-aware filtering at query time.
5962 // / @note All fields referenced in the predicate must have been materialized
6063 // / in the index during build to ensure availability.
61- // / @note `VisitTopK` is thread-safe while other `VisitXXX` is not.
64+ // / @note `VisitTopK` is thread-safe (not coroutine-safe) while other `VisitXXX` is not
65+ // / thread-safe.
6266 virtual Result<std::shared_ptr<TopKGlobalIndexResult>> VisitTopK (
6367 int32_t k, const std::vector<float >& query, TopKPreFilter filter,
6468 const std::shared_ptr<Predicate>& predicate) = 0;
0 commit comments