feat(index): support Utf8View in FTS indices - #8656
Conversation
There was a problem hiding this comment.
❌ 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()), |
There was a problem hiding this comment.
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.
Summary
Utf8Viewsupport to shared string iteration and FTS input validationList, andLargeListfields throughout FTS training and tokenizationTesting
cargo fmt --all -- --checkcargo 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 warningscargo clippy --all --tests --benches -- -D warningscould not reach workspace linting in the local environment becauseopenssl-sysrequires OpenSSL development headers andpkg-config, which are unavailable.Closes #8245