feat(sdk): add typed data prewarm previews (#5075)

LanceDB SDKs can submit data prewarm jobs, but callers have to issue SQL
directly to inspect a plan before warming. The existing text response
does not provide a typed pruning contract. This adds metadata-only
preview helpers across Rust, Python sync/async, and TypeScript, using a
compatible Enterprise server’s structured SQL response.

This was accomplished with the following changes:
- Add `explain_prewarm_data(PrewarmDataOptions)`, Python
`explain_prewarm_data(...)`, and TypeScript
`explainPrewarmData(options)`.
- Expose `PrewarmDataPlan` and `PrewarmPruningSummary`, preserving zero
versus unknown counts and future pruning-mode strings.
- Reuse submission options, identifier/filter validation, namespace and
branch context, and Azure source-account hint handling.
- Validate the versioned JSON response without parsing display text,
submitting a warming job, polling HTTP job APIs, or falling back to
REST.
- Add API documentation, Flight SQL transport tests, Python sync/async
response tests, and an opt-in live-service integration test.

### Usage and behaviour

```python
plan = table.explain_prewarm_data(["payload"], filter="quality > 0.7")
print(plan.table_version, plan.pruning.selected_fragments)
```

The helper returns a plan directly. It requires table Select plus
database/namespace Usage and a server supporting `EXPLAIN (FORMAT JSON)
PREWARM`. It reads metadata without creating a warming job. Selected
ranges are conservative physical candidates; unknown counts remain
`None`/`null`. A later submission resolves and plans its own snapshot.
Historical-version and Embedded table handles are unsupported.
This commit is contained in:
Bruno Ramirez
2026-11-18 09:14:14 -08:00
committed by GitHub
parent 96c25bd6b9
commit 3907a492c0
26 changed files with 1070 additions and 18 deletions
+18
View File
@@ -1913,6 +1913,24 @@ impl Table {
})
}
#[pyo3(signature = (columns=None, *, filter=None, concurrency=None))]
pub fn explain_prewarm_data<'py>(
self_: PyRef<'py, Self>,
columns: Option<Vec<String>>,
filter: Option<String>,
concurrency: Option<&Bound<'py, PyAny>>,
) -> PyResult<Bound<'py, PyAny>> {
let inner = self_.inner_ref()?.clone();
let mut options =
lancedb::table::PrewarmDataOptions::new().columns(columns.unwrap_or_default());
options.filter = filter;
options.concurrency = positive_u32_integer(concurrency, "concurrency")?;
future_into_py(self_.py(), async move {
let plan = inner.explain_prewarm_data(options).await.infer_error()?;
serde_json::to_string(&plan).map_err(|error| PyRuntimeError::new_err(error.to_string()))
})
}
pub fn list_indices(self_: PyRef<'_, Self>) -> PyResult<Bound<'_, PyAny>> {
let inner = self_.inner_ref()?.clone();
future_into_py(self_.py(), async move {