Skip to content

table: add shared write options and create-table options - #151

Merged
Xuanwo merged 8 commits into
mainfrom
xuanwo/create-table-write-options-v2
Nov 23, 2026
Merged

Xuanwo merged 8 commits into
mainfrom
xuanwo/create-table-write-options-v2

Conversation

@Xuanwo

@Xuanwo Xuanwo commented Nov 22, 2026

Copy link
Copy Markdown
Member

Replacement for #145 with corrected commit authorship. Refs #125.

Adds the shared C representation of the SDK write options and a create-table entry that applies the SDK create builder options.

What changed

  • LanceDBWriteOptions with a set_fields bitmask for max rows per file, max rows per group, max bytes per file, data storage version and stable row IDs. Omitted fields keep SDK defaults, while explicit zero/false stay distinguishable. A NULL pointer or zero mask leaves WriteOptions.lance_write_params unset, so default remote create still works.
  • LanceDBCreateTableOptions and lancedb_table_create_with_options with Create/Overwrite/ExistOk, namespace path, location, per-table storage options, external-blob option and optional write options. Write options are applied before the per-table storage and external-blob setters.
  • ExistOk uses the SDK callback and restores the create location and per-table storage options to the callback's open request. A custom-location table is reopened instead of a same-name default-root table.
  • The new entry consumes a non-NULL reader exactly once, including argument, option, schema and SDK errors. It clears a non-NULL table_out on entry and writes it only on success. The legacy lancedb_table_create behavior is unchanged and its header ownership description is corrected.
  • Uses the shared namespace_path_from_c parser from connection: add multi-level namespace paths #137.

Tests

  • C++ coverage for ExistOk vs Overwrite, explicit write options, custom location, per-table storage options, nested namespace create/listing with limit and start_after, and new-vs-legacy table_out failure behavior.
  • Rust unit coverage for write-option conversion, ExistOk callback location/storage propagation, and exactly-once reader release.

Verification

  • cargo test --lib --locked: 12/12 passed on the unchanged private tree.
  • cargo check --all-targets --locked: passed.
  • C ABI host LP64 and MSVC LLP64: 177 functions, 33 structs, 9 enums on the live main tree.
  • Strict C17 headers, C++ test syntax, cargo fmt --check and git diff --check: passed.
  • Real consumer runtime and Clippy are left to CI; no heavy local build was repeated.

…rite-options-v2

# Conflicts:
#	.github/scripts/check_abi.py
#	tests/test_c_enum_inputs.c
Xuanwo added a commit to lance-format/lance that referenced this pull request Nov 23, 2026
`ObjectStoreRegistry` keeps the scoped storage-options accessor alive in
both its `active_stores` and `building` maps. For a provider-backed
accessor (namespace create), that accessor owns the namespace client and
its session, which owns the same registry, so dropping the table and
connection cannot release either. Weak store values and periodic pruning
do not break the cycle. This blocks the valid empty nested-namespace
create in lancedb/lancedb-c#151 (`79f8f56`, `tests/test_table.cpp:604`).

Both maps now share a private key that stores the already resolved
scoped `accessor_id()` instead of the accessor `Arc`; the full params
still drive construction and refresh. Cache identity for the
base/provider/wrapper, metrics prefix, scheduler mode and validation,
and singleflight/retry behavior are unchanged.

The added regression uses the local file provider and an options
provider that holds the same registry. It fails on `f9fd19e` with `the
object store cache retained the storage options provider` and passes
with this change.

## Verification

On sophon-blob, exact `f2d3971`:

`cargo test -p lance-io --lib --profile ci
test_cache_does_not_retain_storage_options_provider -- --nocapture`

```
1 passed; 0 failed
```

The same test binary ran `object_store::providers::tests`: 21 passed, 0
failed, including the base-scoped options, cache statistics, pruning,
and singleflight/retry tests.

The same regression on parent `f9fd19e` fails with the retention
assertion. `cargo fmt --all -- --check`, `git diff --check`, and `cargo
metadata --locked --no-deps` passed.

Hosted Clippy, rustdoc, MSRV, Linux, macOS, Windows, Python, Java, and
compatibility checks passed on `f2d3971`. The dependency check fails on
RUSTSEC-2026-0592 in the `url 2.5.8` already locked on `main`. The same
check reports the `libsais-rs 0.2.2` yank as a warning. #11370 updates
the root lock to the patched release.
@Xuanwo
Xuanwo merged commit 32591cf into main Nov 23, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant