[feature](lance) Add index inspection TVFs and REST metadata - #66671
Draft
u70b3 wants to merge 14 commits into
Draft
[feature](lance) Add index inspection TVFs and REST metadata#66671u70b3 wants to merge 14 commits into
u70b3 wants to merge 14 commits into
Conversation
### What problem does this PR solve? Issue Number: apache#66497 Related PR: apache#65730 Problem Summary: Lance external tables can contain logical vector and scalar indexes, but SHOW INDEX currently only handles internal OlapTable metadata and returns an empty result for Lance tables. Read authoritative logical index descriptions from one latest Directory Dataset snapshot, resolve field IDs from the same snapshot schema, and expose deterministic bounded metadata through the existing 13-column SHOW INDEX result without changing internal-table behavior. ### Release note Support SHOW INDEX for Lance filesystem/Directory Catalog tables. Lance REST index inspection remains unsupported in this phase. ### Check List (For Author) - Test: Unit Test and Regression test - Behavior changed: Yes. SHOW INDEX now returns logical indexes for Lance Directory tables and explicitly rejects Lance REST catalogs. - Does this need documentation: Yes. Document the supported Directory-only scope and REST limitation.
- Reject tables that are not LanceExternalTable with AnalysisException instead of failing on a raw ClassCastException. - Narrow getLanceIndexRows to throw AnalysisException only. - Add unit coverage for the non-Lance table guard. ### Release note Support SHOW INDEX for Lance filesystem/Directory Catalog tables.
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
A full mvn test run (checkstyle validate phase) flagged two violations in the PR2 test files that focused surefire runs had skipped: - Restore the single lexicographic third-party import group in LanceRestIndexMetadataProviderTest. - Replace unicode escapes with the literal character in LanceIndexTableValuedFunctionTest; the runtime value is unchanged. ### Release note None.
…hecks End-to-end verification against a dataset built by the regression fixture exposed false MISMATCH classifications that failed the whole logical view with LANCE_INDEX_METADATA_INCONSISTENT. On the pinned SDK (9.1.0-beta.3), a fresh IVF_PQ index reads back as umbrella VECTOR through getIndexes() while describeIndices() derives IVF_PQ from the details, and a BTREE index reads back as BTREE versus BTree. Strict string equality therefore misclassified healthy indexes. Compare normalized types (case and underscore insensitive) and accept the observed umbrella families: physical VECTOR may pair with any vector algorithm, physical SCALAR with any scalar algorithm. Internal types (FRAGMENT_REUSE, MEM_WAL) are never family members and still classify as MISMATCH, so the check stays fail-closed for genuinely corrupt metadata. The physical TVF keeps reporting the raw physical type, so the regression golden now shows VECTOR for the fixture dataset. ### Release note None.
- test_lance_show_index still asserted the PR1-era rejection "SHOW INDEX is not supported for Lance REST catalogs", which this PR removes. Replace it with a golden assertion that locks the new REST SHOW INDEX output against the deterministic mock. - test_lance_index_inspection's unprivileged user could not open a session on a fresh cluster because it held no grant on the default database, so the privilege-denial section never ran. Grant SELECT on regression_test like the sibling suite does; the Lance table privileges stay denied and remain what the assertions exercise. Both suites passed in verify mode against a fresh local cluster backed by the docker MinIO and REST mock environment. ### Release note None.
The read executor intentionally converts provider failures to stable tokens and drops the raw cause, and the generator logged only the table identity, leaving production failures undiagnosable. Log the wrapper as well: provider failures arrive already tokenized or wrapped with sanitized messages by the catalog, and initialization failures were already logged raw by makeSureInitialized, so this adds no new exposure. The client-visible message is unchanged. ### Release note None.
Note on the provider class that the rolling stats window pipelines submissions through the bounded executor while every provider call still holds the namespace lock for its full duration. The window bounds outstanding per-catalog admissions under one shared deadline; it does not create parallel wire I/O, and holding up to MAX_STATS_IN_FLIGHT slots for the read's duration is the intended trade-off. ### Release note None.
The pinned 9.1.0-beta.3 list path returns reserved system index entries unfiltered (load_indices filters only by index version), and a fragment-reuse entry carries no fields. On datasets that went through compaction, the __lance_frag_reuse entry would either fail structural validation (empty field IDs) and brick every inspection surface, or surface a system index that the logical model must exclude. Drop the reserved names __lance_frag_reuse and __lance_mem_wal at the normalization boundary of both the logical and the physical views. Also lock the remaining internal-type path: a non-system name carrying an internal index type still classifies as MISMATCH and fails the strict logical view. ### Release note None.
12 tasks
Contributor
Author
|
Author note — review-fix round pushed (7167bfa..9121087):
Verification: focused FE suites green with checkstyle; FE package and BE ASAN builds pass; both Lance regression suites pass in verify mode on a fresh local cluster (docker MinIO + REST mock). Full external regression suite not run. |
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.
What problem does this PR solve?
Issue Number: #66497
Related PR: #66637
Problem Summary:
This is PR2 of the Lance index lifecycle work and depends on #66637. Do not merge this PR before #66637. After PR1 is merged, this branch will be rebased onto
branch-4.1with only the four PR2 commits retained.This PR adds bounded, read-only inspection of Lance logical and physical index metadata:
lance_indexes("table" = "catalog.db.table")exposes the strict logical view.lance_index_entries("table" = "catalog.db.table")exposes physical diagnostic entries.SHOW INDEXnow uses the same provider-neutral logical snapshot for Directory and REST catalogs.Datasetsnapshot and never callsgetIndexStatistics().SHOWprivilege before catalog initialization or provider access.The feature is independently releasable and strictly read-only. Lance index mutation remains disabled and no mutation route is added.
User-visible schemas:
lance_indexes:CatalogName,DatabaseName,TableName,IndexName,Columns,IndexType, nullableRowsIndexed,PhysicalEntryCount,Properties.lance_index_entries:CatalogName,DatabaseName,TableName,IndexName,IndexUuid,Columns, nullableIndexType, nullableDatasetVersion, nullableProviderStatus,MetadataConsistency.Columnsis a deterministic JSON string array so commas, quotes, and Unicode column names remain unambiguous.Safety bounds include 256 logical names, 10,000 physical entries, 64 columns per index, 1,000 REST entries per page, 100 pages, four stats requests in flight, bounded external strings/properties, exact-case grouping, repeated-token detection, and all-or-error logical reads.
Release note
Add read-only Lance logical and physical index inspection through
lance_indexes,lance_index_entries, and REST-backedSHOW INDEX.Check List (For Author)
Test
test_lance_show_indexandtest_lance_index_inspectionpassed in verify mode against a fresh local FE+BE cluster backed by the docker MinIO and REST mock environment.meta_scanner.cpp.ocompilation passed.build.sh --fepackage and BE ASANbuild.sh --beboth passed. The full Docker regression suite (all external suites) has not been run.Behavior changed:
SHOW INDEXthrough the shared logical snapshot.Does this need documentation?
Check List (For Reviewer who merge this PR)