Skip to content

fix(fts): validate complete parameters across segments - #8050

Closed
BubbleCal wants to merge 2 commits into
mainfrom
yang/fts-segment-param-consistency
Closed

fix(fts): validate complete parameters across segments#8050
BubbleCal wants to merge 2 commits into
mainfrom
yang/fts-segment-param-consistency

Conversation

@BubbleCal

@BubbleCal BubbleCal commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

What is the bug?

Segmented FTS query planning compared InvertedIndexDetails from each index manifest. That representation is intentionally lossy and omits tokenizer state such as custom_stop_words, so segments with different persisted tokenizer configurations could be combined and queried with inconsistent semantics.

What incorrect behavior does the bug cause?

A segmented index could silently collapse distinct states such as omitted custom stop words, an explicit empty list, and a non-empty replacement list. A first implementation fixed correctness by reading every segment's metadata before execution, but that bypassed the scalar-index cache and added two I/O operations to both cold and fully prewarmed queries.

How does this PR fix the problem?

  • Keep manifest InvertedIndexDetails validation in planning for capability checks such as positions.
  • Open every selected FTS segment through the existing scalar-index cache before choosing a tokenizer.
  • Compare the complete persisted InvertedIndexParams from the opened indexes, including custom_stop_words.
  • Fail closed with both segment IDs when any complete parameter set differs.
  • Cover Match, FlatMatch, Phrase, and FlatMatchFilter paths through the same validation boundary.
  • Preserve shallow-clone base_id behavior through the public index-store path.
  • Add actual multi-segment query coverage for None versus [], [] versus non-empty lists, legacy details, and shallow clones.

Validation

  • cargo fmt --all -- --check
  • cargo clippy --all --tests --benches -- -D warnings
  • Prewarmed FTS query I/O regression: 1 passed, 0 reads after prewarm
  • Cold inverted-index I/O regression: 1 passed, below the existing 18-read bound
  • cargo test -p lance segment_params -- --nocapture (4 passed)
  • cargo test -p lance canonicalize_inverted_details_accepts_legacy_empty_details -- --nocapture (1 passed)
  • cargo test -p lance-index params_legacy -- --nocapture (2 passed)
  • FlatMatchFilter persisted-tokenizer regression: 1 passed

Coordination

This is the canonical latest-main fix. Sophon currently pins Lance v10.0.0-beta.5, so its parent PR uses the same patch backported onto that exact pin instead of upgrading the full Lance dependency set.

@github-actions github-actions Bot added the bug Something isn't working label Jul 28, 2026
Validate complete persisted FTS parameters from scalar indexes that are already opened for execution. This preserves cross-segment custom stop-word checks without bypassing the index cache or adding query I/O.
@codecov

codecov Bot commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 56.75676% with 16 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
rust/lance/src/io/exec/fts.rs 56.75% 13 Missing and 3 partials ⚠️

📢 Thoughts on this report? Let us know!

@BubbleCal BubbleCal closed this Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant