mirror of
https://github.com/lancedb/lancedb.git
synced 2026-11-26 20:44:00 +00:00
fix(sdk): retain deprecated compaction API compatibility
This commit is contained in:
@@ -305,6 +305,26 @@ It is a no-op when no writers are cached.
|
||||
|
||||
***
|
||||
|
||||
### ~~compactAsync()~~
|
||||
|
||||
```ts
|
||||
compactAsync(options?): Promise<Job<OptimizeResult>>
|
||||
```
|
||||
|
||||
#### Parameters
|
||||
|
||||
* **options?**: [`CompactionOptions`](../interfaces/CompactionOptions.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Job`](Job.md)<[`OptimizeResult`](../interfaces/OptimizeResult.md)>>
|
||||
|
||||
#### Deprecated
|
||||
|
||||
Use optimizeAsync() instead.
|
||||
|
||||
***
|
||||
|
||||
### compactRTE()
|
||||
|
||||
```ts
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
- [ClientConfig](interfaces/ClientConfig.md)
|
||||
- [ColumnAlteration](interfaces/ColumnAlteration.md)
|
||||
- [ColumnOrdering](interfaces/ColumnOrdering.md)
|
||||
- [CompactionOptions](interfaces/CompactionOptions.md)
|
||||
- [CompactionStats](interfaces/CompactionStats.md)
|
||||
- [ConnectNamespaceOptions](interfaces/ConnectNamespaceOptions.md)
|
||||
- [ConnectionOptions](interfaces/ConnectionOptions.md)
|
||||
@@ -181,6 +182,7 @@
|
||||
- [BlobRangeRequest](type-aliases/BlobRangeRequest.md)
|
||||
- [BlobReadOptions](type-aliases/BlobReadOptions.md)
|
||||
- [BlobUri](type-aliases/BlobUri.md)
|
||||
- [CompactionResult](type-aliases/CompactionResult.md)
|
||||
- [Data](type-aliases/Data.md)
|
||||
- [DataLike](type-aliases/DataLike.md)
|
||||
- [DataTypeLike](type-aliases/DataTypeLike.md)
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
[**@lancedb/lancedb**](../README.md) • **Docs**
|
||||
|
||||
***
|
||||
|
||||
[@lancedb/lancedb](../globals.md) / CompactionOptions
|
||||
|
||||
# Interface: ~~CompactionOptions~~
|
||||
|
||||
## Deprecated
|
||||
|
||||
Use OptimizeOptions with flat rewrite settings.
|
||||
|
||||
## Extends
|
||||
|
||||
- `Pick`<[`OptimizeOptions`](OptimizeOptions.md), `"targetRowsPerFragment"` \| `"maxSourceRows"` \| `"ioBufferSize"` \| `"batchSize"`>
|
||||
|
||||
## Properties
|
||||
|
||||
### ~~batchSize?~~
|
||||
|
||||
```ts
|
||||
optional batchSize: number;
|
||||
```
|
||||
|
||||
Positive scanner batch size in rows.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
`Pick.batchSize`
|
||||
|
||||
***
|
||||
|
||||
### ~~ioBufferSize?~~
|
||||
|
||||
```ts
|
||||
optional ioBufferSize: number;
|
||||
```
|
||||
|
||||
Scanner read-ahead budget in bytes; zero disables byte-based backpressure.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
`Pick.ioBufferSize`
|
||||
|
||||
***
|
||||
|
||||
### ~~maxSourceRows?~~
|
||||
|
||||
```ts
|
||||
optional maxSourceRows: number;
|
||||
```
|
||||
|
||||
Positive live-source-row budget across whole rewrite tasks.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
`Pick.maxSourceRows`
|
||||
|
||||
***
|
||||
|
||||
### ~~targetRowsPerFragment?~~
|
||||
|
||||
```ts
|
||||
optional targetRowsPerFragment: number;
|
||||
```
|
||||
|
||||
Positive target rows per output fragment. Omitted remote values inherit table policy.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
`Pick.targetRowsPerFragment`
|
||||
@@ -42,6 +42,18 @@ Cannot be combined with action="rewrite_data" or used with durable Optimize jobs
|
||||
|
||||
***
|
||||
|
||||
### ~~compactionOptions?~~
|
||||
|
||||
```ts
|
||||
optional compactionOptions: CompactionOptions;
|
||||
```
|
||||
|
||||
#### Deprecated
|
||||
|
||||
Pass rewrite settings directly on OptimizeOptions.
|
||||
|
||||
***
|
||||
|
||||
### deleteUnverified?
|
||||
|
||||
```ts
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
[**@lancedb/lancedb**](../README.md) • **Docs**
|
||||
|
||||
***
|
||||
|
||||
[@lancedb/lancedb](../globals.md) / CompactionResult
|
||||
|
||||
# Type Alias: ~~CompactionResult~~
|
||||
|
||||
```ts
|
||||
type CompactionResult: OptimizeResult;
|
||||
```
|
||||
|
||||
## Deprecated
|
||||
|
||||
Use OptimizeResult.
|
||||
@@ -373,7 +373,7 @@ index statistics, and search. For example, `table.delete(where="id = 1")`,
|
||||
`create_scalar_index` defaults to `replace=True` on both backends. Both scalar
|
||||
and full-text index creation accept `wait_timeout`. LanceDB Enterprise maintenance methods
|
||||
use the same Optimize submission options. `cleanup_old_versions()` remains a
|
||||
warning-only no-op; the former `compact_files()` method is removed.
|
||||
warning-only no-op; the deprecated `compact_files()` method preserves that behavior.
|
||||
`optimize` submits a durable compaction job and returns once that submission is
|
||||
accepted, not once compaction itself finishes. Pruning and index optimization
|
||||
are not yet supported remotely, so it silently skips them and returns with
|
||||
@@ -407,6 +407,10 @@ code that used the former LanceDB Enterprise-only argument order.
|
||||
|
||||
::: lancedb.table.Table
|
||||
|
||||
::: lancedb.table.CompactionOptions
|
||||
|
||||
Deprecated compatibility name for `OptimizeOptions`.
|
||||
|
||||
::: lancedb.table.OptimizeOptions
|
||||
|
||||
::: lancedb.table.FragmentStatistics
|
||||
@@ -1523,3 +1527,7 @@ Caches, hidden paths, symlinks and unsafe paths are excluded. Use `pip=` or
|
||||
::: lancedb.prewarm.PrewarmDataPlan
|
||||
|
||||
::: lancedb.prewarm.PrewarmPruningSummary
|
||||
|
||||
::: lancedb.compaction.CompactionResult
|
||||
|
||||
Deprecated compatibility name for `lancedb.optimize.OptimizeResult`.
|
||||
|
||||
@@ -504,7 +504,7 @@ const result = await job.wait();
|
||||
```
|
||||
|
||||
```rust
|
||||
use lancedb::table::OptimizeOptions;
|
||||
use lancedb::table::optimize::OptimizeOptions;
|
||||
|
||||
async fn optimize_table(table: &lancedb::Table) -> lancedb::Result<()> {
|
||||
table.optimize(OptimizeOptions::default()).await?;
|
||||
@@ -523,11 +523,15 @@ returning actual statistics. Select only data rewrites with Python
|
||||
versions and skip the separate index maintenance phase. Cleanup arguments cannot
|
||||
be combined with a rewrite-only action.
|
||||
|
||||
The former `compact_async()` / `compactAsync()` methods are now
|
||||
The preferred replacements for `compact_async()` / `compactAsync()` are
|
||||
`optimize_async()` / `optimizeAsync()`. Rust `compact(overrides)` becomes
|
||||
`optimize(overrides)`. Python `compact_files()` becomes
|
||||
`optimize(action="rewrite_data", target_rows_per_fragment=1000)`, with rewrite metrics
|
||||
under `stats.compaction`. The old names are removed without aliases.
|
||||
under `stats.compaction`. The old methods and imports remain available for compatibility.
|
||||
Python warns on deprecated methods and nested settings; TypeScript and Rust mark
|
||||
legacy APIs deprecated. The Embedded `compact_files()` implementation still accepts
|
||||
Lance options and returns its original statistics; the remote method remains a
|
||||
warning-only no-op.
|
||||
|
||||
### Optimize naming migration
|
||||
|
||||
@@ -536,18 +540,29 @@ The SDK uses Optimize names for submission, settings, and durable results:
|
||||
| Previous name | Current name |
|
||||
| --- | --- |
|
||||
| `CompactionResult` | `OptimizeResult` |
|
||||
| `CompactionOptions` | `OptimizeOptions` |
|
||||
| Python/TypeScript `CompactionOptions` | `OptimizeOptions` |
|
||||
| Rust `CompactionOptions` | `table::optimize::OptimizeOptions` |
|
||||
| Rust `CompactionOverrides` | `OptimizeOverrides` |
|
||||
| Rust `CompactionMode` | `OptimizeDataMode` |
|
||||
| Rust index-maintenance `OptimizeOptions` | `IndexOptimizeOptions` |
|
||||
| Python `compaction_options=` / `data_options=` | Flat keyword arguments |
|
||||
| TypeScript `compactionOptions` / `dataOptions` | Flat `OptimizeOptions` fields |
|
||||
| Rust `table::OptimizeOptions` (index maintenance) | `table::IndexOptimizeOptions` |
|
||||
| Python `compaction_options=` | Flat keyword arguments |
|
||||
| TypeScript `compactionOptions` | Flat `OptimizeOptions` fields |
|
||||
| Python `lancedb.compaction` | `lancedb.optimize` |
|
||||
| Rust `OptimizeAction::Compact` | `OptimizeAction::RewriteDataWithOptions` |
|
||||
|
||||
These names are replaced without compatibility aliases. TypeScript rejects the
|
||||
removed `compactionOptions` and `dataOptions` properties before submission.
|
||||
Python rejects the old wrapper keywords. This prevents a requested work limit from being silently ignored.
|
||||
Released names remain as deprecated compatibility APIs. Existing Python
|
||||
`optimize(compaction_options=...)` and TypeScript `optimize({ compactionOptions: ... })`
|
||||
calls preserve their settings. Combining nested and flat rewrite settings is rejected
|
||||
before submission, as are unknown nested settings. The intermediate, unreleased
|
||||
`data_options` / `dataOptions` wrappers are unsupported.
|
||||
|
||||
Rust retains `table::OptimizeOptions` as the index-maintenance type so existing
|
||||
`OptimizeAction::Index(...)` calls keep their meaning. Import data-rewrite options
|
||||
from `table::optimize::OptimizeOptions`; `table::IndexOptimizeOptions` is the preferred
|
||||
explicit name for index-maintenance settings.
|
||||
|
||||
`OptimizeAction` also has new rewrite variants. Rust callers that exhaustively
|
||||
match this enum must handle those variants when upgrading.
|
||||
|
||||
`CompactionStats` and `OptimizeStats.compaction` still identify the compaction
|
||||
phase within Embedded's broader maintenance cycle. The algorithm-specific
|
||||
@@ -577,7 +592,7 @@ const job = await table.optimizeAsync(options);
|
||||
```
|
||||
|
||||
```rust
|
||||
use lancedb::table::OptimizeOptions;
|
||||
use lancedb::table::optimize::OptimizeOptions;
|
||||
|
||||
let options = OptimizeOptions {
|
||||
target_rows_per_fragment: 1000,
|
||||
|
||||
@@ -4,5 +4,5 @@ export const PyStorageCompactionTuning = "from lancedb import OptimizeOptions\n\
|
||||
|
||||
export const PyStorageRebuildVectorIndex = "from lancedb.index import IvfFlat\n\ntable.create_index(\n \"vector\",\n config=IvfFlat(distance_type=\"l2\", num_partitions=4),\n replace=True,\n)\n";
|
||||
|
||||
export const RsStorageCompactionTuning = "use lancedb::table::{OptimizeOptions, OptimizeAction};\n\nlet desired_fragment_bytes: usize = 64 * 1024;\nlet average_row_bytes: usize = 1024; // Estimate from representative rows.\nlet options = OptimizeOptions {\n target_rows_per_fragment: (desired_fragment_bytes / average_row_bytes).max(1),\n batch_size: Some(16),\n num_threads: Some(1),\n ..Default::default()\n};\ntable\n .optimize(OptimizeAction::RewriteDataWithOptions {\n options,\n remap_options: None,\n })\n .await?;\n";
|
||||
export const RsStorageCompactionTuning = "use lancedb::table::OptimizeAction;\nuse lancedb::table::optimize::OptimizeOptions;\n\nlet desired_fragment_bytes: usize = 64 * 1024;\nlet average_row_bytes: usize = 1024; // Estimate from representative rows.\nlet options = OptimizeOptions {\n target_rows_per_fragment: (desired_fragment_bytes / average_row_bytes).max(1),\n batch_size: Some(16),\n num_threads: Some(1),\n ..Default::default()\n};\ntable\n .optimize(OptimizeAction::RewriteDataWithOptions {\n options,\n remap_options: None,\n })\n .await?;\n";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user