morningman opened a new issue, #71132:
URL: https://github.com/apache/doris/issues/71132
### Background
A Lance dataset records indexes that Lance writers build: logical indexes
such as an `IVF_PQ` vector index or a `BTree` scalar index, each stored as one
or more physical segments with a UUID and the dataset version it was built at.
branch-4.1 and branch-4.2 let users inspect them: `SHOW INDEX` on a Lance table
(#66637, released in 4.1.4) and the `lance_index_entries("table" =
"ctl.db.tbl")` table function (#66671, released in 4.1.5), both under #66497.
On master, Lance catalogs run as the `fe-connector-lance` plugin, and neither
works.
### Current behavior
On master (`d97993b7256`), with a filesystem Lance catalog `ctl` over the
External pipeline's Lance fixtures:
```sql
SHOW INDEX FROM ctl.doris.vs_ivf_pq_f32;
-- Empty set (also with enable_mysql_compatible_index_metadata = true)
SELECT * FROM lance_index_entries("table" = "ctl.doris.vs_ivf_pq_f32");
-- ERROR 1105 (HY000): errCode = 2, detailMessage = Can not found function
'lance_index_entries'
```
### Expected behavior
As on branch-4.2: `SHOW INDEX` (and `SHOW INDEXES / KEY / KEYS`) returns one
row per index column, here `embedding_ivf_pq_f32` on `embedding`, type
`IVF_PQ`, with its details
`{"compression":{"num_bits":4,"num_sub_vectors":4,"type":"pq"},"metric_type":"L2"}`
in `Properties`; `lance_index_entries` returns one row per physical segment
with `CatalogName, DatabaseName, TableName, IndexName, IndexUuid,
DatasetVersion`. Both read the latest version and need the SHOW privilege on
the table; REST catalogs refuse both, with branch-4.2's messages.
### Proposed design
The same user-visible behavior, through connector SPI that fe-core can serve
for any connector, so that fe-core and the SPI name no Lance concept:
- SHOW INDEX: an optional `ConnectorIndexOps.listIndexes(session, table)` on
the connector's metadata, returning `ConnectorIndex(name, columns, indexType,
properties)`. The engine renders the rows in both SHOW INDEX layouts (the
legacy 13 columns and the MySQL-compatible 16 columns). Not through
`TableKeyMeta`, which also feeds `information_schema` STATISTICS,
KEY_COLUMN_USAGE and TABLE_CONSTRAINTS and SHOW COLUMNS' Key column, so those
would open every Lance dataset.
- `lance_index_entries`: a plugin declares metadata table functions with
`ConnectorProvider#getMetadataTableFunctions()` (name, accepted arguments,
output columns). The engine resolves the name when no built-in table function
owns it, checks the `table` argument and the SHOW privilege at analysis, plans
a meta scan, and on the master FE checks SHOW again for the user the BE relays
before asking `ConnectorMetadataTableOps.listMetadataTableRows` for rows, which
it converts to the declared column types. Plugins cannot claim a built-in
function's name or one another plugin declared.
- BE round trip: a generic call type,
`TMetadataType.CONNECTOR_TABLE_FUNCTION = 17` with
`TConnectorTableFunctionParams`, `TMetaScanRange.20` and
`TMetadataTableRequestParams.17`, relayed by the BE with the querying user. The
BE also keeps branch-4.2's relay of the reserved type 15
(`LANCE_INDEX_ENTRIES`), so a 4.1.5+ or 4.2 FE still gets rows during a
BE-first rolling upgrade.
- Rejected: reusing type 15 from fe-core (Lance-named thrift in fe-core, a
transport only Lance could use); letting plugins build thrift through the SPI;
a system table `t$index_entries` (changes syntax that 4.1.5 ships); computing
the rows at analysis into a constant relation (plans grow with the number of
entries).
### Impact
Users of filesystem Lance catalogs on master, in both deployment modes.
Other catalogs and connectors keep their current SHOW INDEX output.
### Reproduction or evidence
branch-4.2's suites `test_lance_show_index` and `test_lance_index_entries`
and their fixtures, including `doris$nested_index`, which master lacks.
### Scope and non-goals
In scope: `SHOW INDEX` and `lance_index_entries` on filesystem Lance
catalogs, latest version. Not in scope: Lance index DDL (#67201, #67630), since
on branch-4.2 no statement creates or drops a Lance index yet; the index job
framework (#67235), which 4.x removed in #68781; indexes of historical versions
or branches; REST catalogs, which stay refused as on branch-4.2.
### Acceptance criteria
`test_lance_show_index` and `test_lance_index_entries` pass on master with
the same result blocks as branch-4.2's `.out`, and the existing Lance suites
keep passing.
### Risks and compatibility
The connector plugin API goes from 38.0 to 39.0, so connector plugins built
against 38.x must be rebuilt. The thrift additions are optional, with ids
unused on branch-3.1 to branch-4.2. An FE upgraded before its BEs, an order
Doris does not support, gets an empty `lance_index_entries` result from an old
BE instead of an error. Nothing is persisted.
### Related
#66497 (the branch-4.1 issue), #66637 and #66671 (the branch-4.1 /
branch-4.2 implementations, by @u70b3).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]