Repository navigation
[core] Support centroid-sharded vector global indexes - #1491
Merged
JingsongLi merged 7 commits intoNov 22, 2026
Merged
Conversation
This was referenced Nov 22, 2026
JingsongLi
marked this pull request as ready for review
November 22, 2026 05:19
leaves12138
approved these changes
Nov 22, 2026
leaves12138
left a comment
There was a problem hiding this comment.
Reviewed the full diff at head ccdd72f against main (29 files, +2365/-83), cross-checked against the Java contracts in CentroidIndexMeta, VectorTrainingModelIO, and NativeCentroidRoutedIndexReader (apache/paimon#11249 lineage). Part of #1490.
Core / generic semantics touched (flagging per review policy):
- New on-disk format readers/writers:
centroid_index.rsimplements the Java-sharedPAIMCENTdescriptor andPVROUT01routing model, plus generation grouping/completeness rules used at commit time (index_commit.rs), overlap validation, and query planning. This is a cross-language storage contract. - Generic index build/commit plumbing:
GlobalIndexBuildPlan.replacement_messages()(new public API, also exposed through the Python binding),PartitionFilter::matches_entry_for_removal, spill/route/partition refactor inindex_build/vector.rs, and auto-index maintenance now standing down for routed columns (auto_index/planning.rs). - Generic vector query path:
de_vector_read.rsrenames the file-work executor, adds centroid planning/routing (de_vector_read/centroid.rs), applies deletion-vector live-row masks before routing, strips deleted rows before reranking, and adds thevector-index-centroiddistributed task kind;vector_search_common.rsandsearch_scan_split.rslearn empty-router semantics.
What I verified:
- Format compatibility: descriptor header is 22 bytes (magic + version + role + 3 big-endian i32), matching Java
CentroidIndexMeta.wrapbyte-for-byte including the -1 absent-payload sentinel; version/role pairs (1|2 router/shard, 2 bitmap) match Java's VERSION/SCALAR_INDEX_VERSION gates. Router envelope is big-endian length + camelCase JSON (version/shardMode/modelId, "centroid-based") with the 65536 envelope cap, matchingVectorTrainingModelIO; the PVROUT01 payload is little-endian dim/nlist/metric with metric codes 0/1/2 = l2/inner_product/cosine, matchinglegacyMetric. The Java-written binary fixture (router + two IVF-FLAT shards) is read end-to-end with labels rebased to range [2,5], and an out-of-range native label is rejected. - Routing parity:
automatic_widthmatches JavaautomaticWidth(floor 3/4/8 for nlist 4/8/other, ceil(nlist/16) minimum, 4-candidates-per-result budget, inverse-selectivity scaling with u128 avoiding Java's BigDecimal overflow concern, matching==0 -> 1); inner product probes all centroids; automatic doubling widening stops at nlist and is disabled by explicitcentroid.nprobe; the DiskANN +ivf.nproberejection mirrors Java. Coarse assignment is Euclidean after cosine normalization, consistent with native training. - Generation completeness is enforced at both ends:
group()requires exactly one router, nlist distinct shards with id < nlist, consistent model/version/source_meta/extra_field_ids, vector_count <= range length, and non-empty generations to have vectors; commit validates groups when centroid deletions are present and folds generations to their routers for overlap validation, so a partial replacement cannot leave a mixed-generation overlap. - Replacement atomicity:
replacement_messages()groups removals per partition/bucket intodeleted_index_files, the plan serializes them (serde(default)keeps old plans loadable),execute()appends them to the built-shard messages in one snapshot-guarded commit, and failed builds abort private outputs. Filtered replacement remaps the predicate to partition fields and fails closed on undecodable partitions (regression covered); untouched partitions survive. - DV/live-row semantics: for centroid ranges the deleted-row slack is not added to the index limit; instead local live-row bitmaps restrict candidates before routing (both shared and per-query include sets), and merged results are stripped of deleted rows before reranking. The regression verifies a deleted nearest neighbor does not consume the Top-1 budget, identically on the local and transported-executor paths.
- Distributed compatibility:
centroid_filesisserde(default, skip_serializing_if empty)and the new task kindvector-index-centroidmakes older workers reject rather than silently ignore routed work, following the existingvector-index-filteredpattern; empty routers do not define raw-scoring metric/type (regressions cover the raw fallback for appended rows). - Build path: one router per maximal contiguous range (rows_per_shard effectively unbounded for centroid builds), router trained via IVF-FLAT with exact coarse assignment, per-centroid spill partitions preserve input row order, local
nlistcapped at the shard's training sample count, empty centroids write thePCEMPTY1sentinel with row_count 0, and outer-only options (sharding,centroid.nlist, DiskANN's outer train cap) are stripped from native shard options. Auto range maintenance stands down when the column is routed, preventing partial rebuilds from retiring routed siblings.
No findings. CI is fully green at this head (15/15 checks). The PR description still says "Draft for review" but the PR is marked ready; assuming that line is stale.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Part of #1490. Align Rust Data Evolution vector indexes with the centroid layout introduced by apache/paimon#11249.
Brief change log
PAIMCENTdescriptors andPVROUT01routing models. Build local indexes over sparse row labels relative to their source range and atomically replace the selected partitions' index files.centroid.nprobe, automatic widening, and shard-local IVF or DiskANN options. Check manifest generation completeness at commit and query time.Tests
API and Format
Adds centroid build and search options and a build-plan accessor for the index removals that accompany a replacement. Existing range indexes retain their format.
Documentation
Documents explicit centroid builds, replacement, and probe options. Draft for review of the routing and manifest assumptions.