feat: Enforce backend-owned schema model for Lance directory and REST catalogs - #243
feat: Enforce backend-owned schema model for Lance directory and REST catalogs#243mikewhb wants to merge 11 commits into
Conversation
Legacy directory attachments disable Lance namespace manifests and cannot persist child namespaces. Reject user-created schemas instead of falling back to transient DuckDB schema entries. Preserve the existing behavior that maps main directly to the catalog root.
Reuse Lance namespace list, create, and drop operations to map REST child namespaces to DuckDB schemas. Rebuild schema entries and install their existing REST table generators on ATTACH so schemas persist across connections.
Derive REST table operations from the bound Lance schema entry. Child-schema CTAS now targets its child namespace, while main retains the original namespace. Keep fully qualified table identifiers for namespace mutations and verify routing after reattachment.
Invalidate only the target schema's existing default generator after a directory copy or REST writer finalization succeeds. This makes committed CTAS tables visible across connections without touching the dataset cache or invalidating during planning.
Refresh only the replaced table entry after a successful CTAS commit so existing connections rematerialize its schema without flushing dataset caches. Carry namespace identifiers across the FFI as length-delimited segments and remove leaf-name retries that could redirect qualified operations to another namespace.
Use a database-shared generation map to invalidate only replaced dataset keys while preserving unrelated cross-query cache entries. Keep optional child-namespace discovery from blocking main-only backends, and reject remote schema DDL forms whose transaction or replacement semantics cannot be preserved.
Recognize structured unsupported namespace responses, preserve DuckDB duplicate-schema conflict semantics, and reject REST table DDL before remote side effects inside explicit transactions.
Keep PR 243 focused on namespace routing and catalog discovery. Restore connection-local dataset caching and move the database-wide generation boundary plus replacement freshness coverage to the dedicated cache-coherency work.
Remove the private LID1 FFI format because Lance REST still serializes identifiers with its configured delimiter. Preserve qualified child-namespace routing and fail-closed lookups while retaining the pre-existing REST identifier contract.
Invalidate only the target schema's lazy table generator after a successful CTAS commit. Leave existing table-entry replacement and dataset freshness semantics to the dedicated replacement and cache-coherency work.
|
@lance-community "Lance Gatekeeper — Pipeline could not complete" How to deal with it. |
Return namespace and table listings through a shared typed string-list FFI instead of lossy newline framing. Reuse the ownership API for directory listings and scalar-index discovery. Normalize full table identifiers relative to the requested namespace, while accepting leaf-only compatibility responses and excluding deeper descendants. Reject appended REST segments containing the active delimiter before remote operations so quoted names cannot silently change hierarchy.
d3978ef to
b4a7fbf
Compare
There was a problem hiding this comment.
✅ Gate recommendation: approve.
1 fixed / 0 remain.
The current revision completes the REST identifier boundary: typed list results preserve element boundaries, appended delimiter-bearing segments fail closed, and Lance's full table identifiers are normalized to direct-child leaf names. Schema ownership, qualified CTAS routing, discovery refresh, conflict handling, and explicit-transaction guards remain intact.
|
@Xuanwo Could you review the REST multi-schema work on this branch? It maps REST child namespaces to DuckDB schemas and fixes REST CTAS to use the bound schema id. Directory catalogs are unchanged (no CREATE SCHEMA without manifest). Thanks. |
|
@lance-community Lance Gatekeeper pipeline could not complete on the last run, could you please rerun it? |
Background
DuckDB treats schemas created under an attached catalog as schemas owned by that catalog. For example, after attaching PostgreSQL,
CREATE SCHEMA pg.salescreates a PostgreSQL schema, andtables created under
pg.salesare stored in PostgreSQL.Legacy Lance directory namespaces behaved differently. Because they run with namespace manifests disabled,
CREATE SCHEMA lance.salescreated only a transient in-memory DuckDB schema. It wasnot represented in Lance, disappeared after reattachment, and made table ownership and storage routing ambiguous.
This PR makes the Lance catalog follow a clear backend-owned schema model.
Changes
main.CREATE SCHEMAis rejected for legacy directory namespaces because manifest-disabled directories cannot persist child namespaces.ATTACH.CREATE SCHEMAandDROP SCHEMAreuse Lance namespace APIs while preserving DuckDB conflict and dependency semantics.REST services that do not support child-namespace discovery can still attach in
main-only mode. Remote DDL that cannot participate in DuckDB rollback is rejected inside explicit transactions.The existing REST delimiter contract and connection-local dataset cache behavior remain unchanged. Cross-connection dataset freshness and
CREATE OR REPLACEhandling are separate concerns.Validation
Regression coverage includes: