From 7a690bac71ab2fd6abd6b086f185e9ebd69bb1af Mon Sep 17 00:00:00 2001 From: ChilePiquin Date: Wed, 18 Nov 2026 14:27:13 -0800 Subject: [PATCH] test(sdk): align Optimize diagnostics and complete examples --- docs/web/enterprise/cache-prewarm.mdx | 21 ++++++++++++++++++++- docs/web/maintenance/compaction.mdx | 12 ++++++++++++ rust/lancedb/src/remote/table.rs | 20 +++++++++++++++----- 3 files changed, 47 insertions(+), 6 deletions(-) diff --git a/docs/web/enterprise/cache-prewarm.mdx b/docs/web/enterprise/cache-prewarm.mdx index 936fb2ec0..7d9c97708 100644 --- a/docs/web/enterprise/cache-prewarm.mdx +++ b/docs/web/enterprise/cache-prewarm.mdx @@ -305,8 +305,25 @@ branch. The server never needs to scan rows merely to evaluate the predicate. options as the job-returning methods but return after acceptance without retaining the handle. The existing TypeScript `prewarmData(columns)` array form remains supported. Rust `prewarm_data()` also accepts the same `PrewarmDataOptions` as durable -submission and Explain, including filters and concurrency: +submission and Explain. All three convenience methods support columns, filters, +and concurrency: + + +```python +table.prewarm_data(["video"], filter="quality > 0.7", concurrency=4) +``` + + +```typescript +await table.prewarmData({ + columns: ["video"], + filter: "quality > 0.7", + concurrency: 4, +}); +``` + + ```rust use lancedb::table::PrewarmDataOptions; @@ -315,6 +332,8 @@ table.prewarm_data(PrewarmDataOptions::new() .filter("quality > 0.7") .concurrency(4)).await?; ``` + + Existing Rust `prewarm_data(None)` and `prewarm_data(Some(columns))` calls remain supported. The convenience method returns after acceptance and discards the job diff --git a/docs/web/maintenance/compaction.mdx b/docs/web/maintenance/compaction.mdx index 58135629f..5caffda6e 100644 --- a/docs/web/maintenance/compaction.mdx +++ b/docs/web/maintenance/compaction.mdx @@ -576,6 +576,18 @@ await table.optimize(options); const job = await table.optimizeAsync(options); ``` +```rust +use lancedb::table::OptimizeOptions; + +let options = OptimizeOptions { + target_rows_per_fragment: 1000, + batch_size: Some(128), + ..Default::default() +}; +table.optimize(options.clone()).await?; +let job = table.optimize_async(options).await?; +``` + Python/TypeScript Embedded convenience Optimize also accepts cleanup settings in the same request. Durable Optimize jobs reject cleanup and separate index-maintenance requests before diff --git a/rust/lancedb/src/remote/table.rs b/rust/lancedb/src/remote/table.rs index 9e0ca34b8..04771baee 100644 --- a/rust/lancedb/src/remote/table.rs +++ b/rust/lancedb/src/remote/table.rs @@ -17810,7 +17810,12 @@ mod tests { }) .await .unwrap_err(); - assert!(error.to_string().contains("SQL is unavailable")); + assert!(matches!(error, Error::NotSupported { .. })); + assert!( + error + .to_string() + .contains("Optimize jobs require a Flight SQL endpoint") + ); } #[tokio::test] @@ -17893,9 +17898,9 @@ mod tests { .unwrap(); // No SQL client is wired to this REST-only mock, so the branch-scoped - // handle hits the same "SQL is unavailable" check `optimize` runs for - // main -- it does not reject the branch itself, and it does not send - // a REST request (see `test_optimize_requires_sql`). + // handle hits the shared missing-endpoint check used on main; it does + // not reject the branch itself or send a REST request + // (see `test_optimize_requires_sql`). let error = branch .optimize(OptimizeAction::RewriteDataWithOptions { options: crate::table::optimize::OptimizeOptions::default(), @@ -17904,7 +17909,12 @@ mod tests { .await .unwrap_err(); - assert!(error.to_string().contains("SQL is unavailable")); + assert!(matches!(error, Error::NotSupported { .. })); + assert!( + error + .to_string() + .contains("Optimize jobs require a Flight SQL endpoint") + ); } #[tokio::test]