Skip to content

feat(index): support Utf8View in FTS indices - #8656

Open
dubin555 wants to merge 1 commit into
lance-format:mainfrom
dubin555:contrib/issue-8245-fts-string-view
Open

feat(index): support Utf8View in FTS indices#8656
dubin555 wants to merge 1 commit into
lance-format:mainfrom
dubin555:contrib/issue-8245-fts-string-view

Conversation

@dubin555

Copy link
Copy Markdown

Summary

  • add Utf8View support to shared string iteration and FTS input validation
  • support scalar, List, and LargeList fields throughout FTS training and tokenization
  • use the shared string iterator in flat search and skip null documents
  • preserve the existing index format and query semantics

Testing

  • cargo fmt --all -- --check
  • cargo test -p lance-arrow (98 unit tests and 6 doctests passed)
  • cargo test -p lance-index (1035 unit tests passed, 2 existing ignored, and 8 doctests passed)
  • cargo clippy -p lance-arrow -p lance-index --all-targets -- -D warnings

cargo clippy --all --tests --benches -- -D warnings could not reach workspace linting in the local environment because openssl-sys requires OpenSSL development headers and pkg-config, which are unavailable.

Closes #8245

@github-actions github-actions Bot added A-index Vector index, linalg, tokenizer enhancement New feature or request labels Aug 20, 2026

@lance-gatekeeper lance-gatekeeper Bot 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.

Gate recommendation: request changes.

The central iterator, index builder, and flat-search paths handle Utf8View without changing the stored format, but one supported query surface remains incomplete: distributed flat post-filter plans cannot consume the type this PR now admits.

Please extend the public post-filter fallback with the same representation-agnostic string iteration and cover that constructor path.

DataType::Utf8 => Box::new(arr.as_string::<i32>().iter()),
DataType::LargeUtf8 => Box::new(arr.as_string::<i64>().iter()),
_ => panic!("Expecting Utf8 or LargeUtf8, found {:?}", arr.data_type()),
DataType::Utf8View => Box::new(arr.as_string_view().iter()),

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.

This leaves the public distributed post-filter path unable to query the new type. FlatMatchFilterExec::{new,new_with_document_column,new_with_segments} all set resolved_field=None; that reaches rust/lance/src/io/exec/fts.rs:2013, whose dispatch accepts only Utf8 / LargeUtf8 and returns FTS document column text is not a string for Utf8View. Since this PR now admits and builds these indexes, new_with_segments—the constructor exposed for distributed planning—fails at query time.

Please route that fallback through this shared iterator (or add an equivalent Utf8View arm) and cover the public constructor.

Reproducer

On this head I added a temporary test that passed a StringViewArray stream to FlatMatchFilterExec::build_filter_stream with resolved_field=None and collected the stream. cargo test -p lance gate_reproducer_flat_match_filter_rejects_utf8_view --locked observed the execution error above; the normal new_with_resolved_field scanner path does not.

@lance-gatekeeper lance-gatekeeper Bot added the K-changes Latest Gatekeeper recommendation requests changes. label Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-index Vector index, linalg, tokenizer enhancement New feature or request K-changes Latest Gatekeeper recommendation requests changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support StringView type in FTS indices

1 participant