#79430·starrocks

[Feature] Support Paimon Global Index for vector, full-text, and hybrid retrieval

Author: wxl24lifeCreated Sep 21, 2026Updated Sep 28, 2026
Labelstype/feature-request

Background

Paimon Global Index can turn a query into snapshot-scoped row IDs or scored candidates, but StarRocks needs one coherent path from SQL and optimizer decisions to index evaluation, global reduction, and Paimon row fetch. This child issue tracks that retrieval path: scalar filtering and Vector Top-N are the initial contribution target; FTS and hybrid retrieval reuse the same framework later.

This is narrower than the Paimon multimodal umbrella in #77026. It covers consuming Paimon Global Index at query time, not index construction or maintenance.

Dependencies and current state

  • #79390 is merged and provides the Paimon Java 2.0.0 baseline.
  • #79853 is the open prerequisite BugFix for Paimon's existing automatic Global Index behavior: safe IndexedSplit routing, FULL scalar search, empty-snapshot handling, and real-index regression coverage. It intentionally adds no StarRocks Global Index configuration.
  • #79483 is the connector-neutral planning framework. It is stacked on #79853 and remains Draft while the prerequisite is unmerged.
  • #79643 and #79729 are the downstream implementation PRs for distributed execution and Vector ANN Top-N.

High-level architecture

mermaid
flowchart LR
    Query["Scalar filter / Vector Top-N / FTS"] --> Plan["Planning framework<br/>snapshot capabilities + normalized condition"]
    Plan --> Exec["Distributed Global Index executor<br/>snapshot + shard scheduling"]
    Exec --> Native["paimon-cpp shard evaluation<br/>row IDs or local scored candidates"]
    Native --> Reduce["Global reduction<br/>row-ID union or scored Top-N"]
    Reduce --> Guard["Snapshot and table-type guard"]
    Guard --> Fetch["IndexedSplit + Paimon row fetch<br/>residual predicate on same snapshot"]
    Query --> Auto["Paimon automatic Global Index planning"]
    Auto --> Fetch
    Plan -. unsupported / unavailable .-> Scan["Ordinary Paimon scan policy"]
    Guard -. stale / incompatible .-> Scan

An ordinary Paimon scan may itself use a Global Index when global-index.enabled is on. Therefore, fallback means returning control to Paimon's ordinary scan policy. The single StarRocks-side runtime control is introduced with #79643 as paimon_global_index_scan_stage: stage 0 disables Global Index, stage 1 keeps Paimon SDK planning and remains the default, and stage 2 enables distributed execution.

Contribution plan

  1. Prerequisite BugFix -- existing automatic IndexedSplit correctness (#79853). Fix current-main planning and reader failures when Paimon 2.0 automatically returns IndexedSplit. Route row ranges through JNI, use FULL scalar search by default to include post-index rows, avoid passing an invalid snapshot sentinel for empty append-only, Data Evolution, and Primary Key tables, and cover the behavior with a real BTree index plus Java-reader E2E. This PR intentionally adds no StarRocks Global Index configuration; branch-4.1 receives a separate minimal backport after the main fix merges.

  2. Planning framework (#79616, implementation #79483). Add snapshot-bound connector descriptors, production wrapper delegation, and Paimon 2.0 provider discovery. Bind query columns to current field IDs, resolve metric/dimension from persisted index metadata, normalize scalar and Vector Top-N requests, and classify index/partition/residual predicates explicitly. Discovery follows snapshot/branch/tag time travel and is cached by table location, branch, snapshot, and manifest without UUID I/O. The PR is planner-only: it preserves the original query operators and deliberately has no result SPI or execution consumer.

  3. Distributed Paimon Global Index execution (#79643). Add the Paimon execution service, snapshot and shard preparation, virtual index scan or internal SQL path, typed FE-to-BE contract, paimon-cpp evaluation, row-ID aggregation, and the typed result/application SPI. This PR owns the single stage 0/1/2 runtime control, snapshot compatibility, PK versus Data-Evolution checks, uncovered-range requirements, and consumption of the physical condition introduced by #79483.

  4. Scored Top-N and Paimon Vector ANN (#79729). Complete the scored request/result flow: metric and ordering semantics, NULL handling, residual-filter candidate budgeting, parallel local candidates, global Top-N reduction, score handoff, packaging checks, and multi-shard end-to-end correctness tests.

  5. FTS retrieval. Reuse the same snapshot, execution, result, and fallback contracts for Paimon full-text search, with independent relevance and score tests. This is planned but is not part of the initial contribution milestone.

  6. Filtered/hybrid retrieval and optimization. Compose scalar, Vector, and FTS retrieval with explicit prefilter/residual semantics, then add recall, cache, profile, and performance work without delaying the initial scalar and Vector path.

Initial scope and invariants

  • The initial contribution milestone ends after PR 4: automatic scalar correctness, the reusable planning/execution framework, and Vector Top-N.
  • Paimon Java 2.0.0 is provided by #79390. Version 1.4.2 is only a comparison baseline, not a drop-in fallback for the scored path.
  • Correctness requires one pinned snapshot, branch/table identity isolation, field-ID schema binding, residual-predicate preservation, globally correct Vector ordering, and safe handling of absent, stale, or incompatible external index results.
  • Index construction, maintenance, and the broader Paimon multimodal surface are outside this issue.

Related work

  • #77026 -- Paimon multimodal umbrella; this issue contributes the Global Index retrieval track.
  • #79390 -- Paimon Java 2.0.0 dependency and multimodal Paimon foundation.
  • #73046 -- existing BE Vector Search interface to reuse for distributed candidate execution.
  • #78189 -- paimon-cpp native reader foundation.
  • #78563 -- optional paimon-cpp native-library loading and packaging work.
  • #73048 -- points to paimon-cpp and is not a competing workstream.