Skip to content

ivf: incrementally scan expanded batch probe ranges - #73

Merged
jerry-024 merged 1 commit into
apache:mainfrom
shyjsarah:codex/ivf-batch-incremental-expansion
Aug 12, 2026
Merged

ivf: incrementally scan expanded batch probe ranges#73
jerry-024 merged 1 commit into
apache:mainfrom
shyjsarah:codex/ivf-batch-incremental-expansion

Conversation

@shyjsarah

@shyjsarah shyjsarah commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

This is a follow-up to #72. After #72 removes completed queries from later automatic IVF batch rounds, incomplete queries still rerun the full larger nprobe and rescan old lists. This PR makes those retries incremental: a 16 -> 32 -> 64 expansion scans [16,32) and then [32,64) instead of rescanning [0,32) and [0,64).

Changes

  • pass half-open probe ranges through automatic batch expansion for IVF-FLAT, IVF-SQ, IVF-PQ, and IVF-RQ
  • seed each expansion round with the query's accumulated Top-K so prior heap results are retained
  • scan only newly added lists in filtered and unfiltered batch paths
  • preserve ivf: Retry only incomplete queries in automatic batch search #72's bounded retry buffers when packing active queries and their Top-K seeds
  • preserve aggregate IVF-RQ search statistics across progressive rounds
  • keep fixed-width/scalar searches, storage formats, public APIs, and the C ABI unchanged

Logging and JNI diagnostic bridging are intentionally excluded from this PR and handled separately by #75.

Testing

  • cargo fmt --all -- --check
  • cargo test -p paimon-vindex-core
    • 451 passed, 1 ignored
  • cargo clippy -p paimon-vindex-core --all-targets -- -D warnings
  • focused coverage for:
    • half-open probe ranges across multiple expansion rounds
    • carrying accumulated Top-K seeds between rounds
    • bounding packed query and seed buffers during partial retries
    • preserving a valid row ID of -1 via its finite distance
    • IVF-PQ range partitioning and seeded result equivalence with a one-shot search
    • aggregate IVF-RQ statistics across progressive rounds

Notes

@shyjsarah
shyjsarah marked this pull request as draft August 10, 2026 06:44
@shyjsarah

Copy link
Copy Markdown
Contributor Author

Diagnostic follow-up:

  • Confirmed the PR ivf: incrementally scan expanded batch probe ranges #73 IVF-PQ batch diagnostic path was executing in EMR Spark, including the filtered batch route across all 14 shards.
  • Root cause of the missing messages: the EMR log collector did not capture writes made directly to the Rust/native stderr descriptor.
  • Added a JNI bridge that captures the opt-in IVF-PQ diagnostic line on the search thread and mirrors the same line through Java System.err, while retaining the existing native stderr write.
  • EMR smoke job jr-375b9ff8d65f53f3 succeeded: 14/14 filtered batch searches emitted complete diagnostics and there were no native errors.
  • The smoke showed nq=100, k=3, fixed nprobe=16, and incomplete_queries=0 on all 14 shards. Payload read time dominated filter and PQ scan time.

Minimal validation after cleanup:

  • cargo fmt --all -- --check
  • focused diagnostic capture tests (3 passed)
  • cargo check -p paimon-vindex-jni
  • mvn -f java/pom.xml test

The final change is contained in paimon-vector-index; no Paimon source change is required.

@shyjsarah
shyjsarah force-pushed the codex/ivf-batch-incremental-expansion branch from 2db756b to 0c0b9f9 Compare August 12, 2026 04:31
@shyjsarah
shyjsarah marked this pull request as ready for review August 12, 2026 04:31
@jerry-024

Copy link
Copy Markdown
Contributor

New: 2; still open: 0; fixed candidates: 0.

Comment thread core/src/ivfpq.rs

@jerry-024 jerry-024 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@jerry-024
jerry-024 merged commit cf0506d into apache:main Aug 12, 2026
9 checks passed
jerry-024 added a commit to jerry-024/paimon-vector-index that referenced this pull request Aug 12, 2026
* upstream/main:
  ivf: incrementally scan expanded batch probe ranges (apache#73)
  ivf: Retry only incomplete queries in automatic batch search (apache#72)

# Conflicts:
#	core/src/ivfpq.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants