Skip to content

Use UUID directories for DuckLake object paths - #441

Open
faysou wants to merge 2 commits into
datafusion-contrib:mainfrom
faysou:ducklake-object-uuids-pr
Open

faysou wants to merge 2 commits into
datafusion-contrib:mainfrom
faysou:ducklake-object-uuids-pr

Conversation

@faysou

@faysou faysou commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Use the object's UUID as the default directory when a new schema or table name falls outside
DuckLake's path rules. Reserve the directory before uploading and carry the same plan into
the catalog commit. Reuse an existing schema's stored path and honor an explicit path.

Tables staged together in a new schema share its planned directory. If a concurrent write
creates the schema with a different directory, the commit rejects the plan and removes its
staged files.

UUID directory reservation

flowchart LR
    Resolve["Resolve schema and table paths"] --> Name{"New default path with an invalid name?"}
    Name -->|Yes| UUID["Reserve the object UUID directory"]
    Name -->|No| Path["Use the stored, explicit, or valid name path"]
    UUID --> Upload["Stage files under the selected path"]
    Path --> Upload
    Upload --> Check{"Catalog path agrees at commit?"}
    Check -->|Yes| Commit["Commit metadata and staged file paths"]
    Check -->|No| Clean["Reject the write and remove staged files"]
Loading

Verification

  • All-feature Clippy passes.

  • Five UUID-directory tests pass. DuckDB reads the staged files through all four standard
    catalog layouts. The SQLite race test checks that the conflicting commit leaves the
    snapshot head intact and removes its staged object.

  • The staged-table fixture checks that two tables share a schema directory and have distinct v7
    table directories. DuckDB returns the expected sum of 20 for the first table.

  • Four stored-schema-path regression tests pass.

  • The SQLite index check uses a selective lookup key. The PostgreSQL multicatalog parity
    test uses time travel to verify deletion dates when DuckDB 1.5.5 reports a snapshot
    outside the requested change window. Both checks pass locally.

Specification proof

DuckLake rule Implementation invariant Discriminating proof
Default DuckLake paths accept up to 255 bytes of ASCII letters, digits, underscores, and hyphens. Choose the object's UUID when the name fails the default path predicate. The four standard catalog tests verify v7 schema and table directories and read files from those paths.
Default DuckLake paths use the stored directory to resolve data files. Carry the reserved path through upload and catalog commit, including multi-table staging. The SQLite race test checks cleanup after the reserved path conflicts with the catalog path.

Reference implementation

DuckDB's DuckLake extension applies the same name predicate and allocates the UUID before
deriving the schema or table directory. PR #395 already stores object UUIDs. This change
carries the chosen paths through the Rust writer's separate upload and metadata commit steps.
Default path predicate,
Schema creation,
Table creation.

- Match DuckLake default schema and table path selection
- Apply the rule to direct and atomic creation in every writer
- Assert safe-name filtering and persisted SQLite UUID paths
@faysou

faysou commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

@anoop-narang or to maintainers, I did a comparison of available features in datafusion-ducklake and ducklake specs in July and prepared several PRs at the time, I've rebased and published them today in case some could be useful to your project. I don't have more PRs planned.

- Give the SQLite lookup a selective key in the index fixture.
- Date flushed deletes from time travel when the DuckDB reference
  reports a snapshot outside the change window.

This branch has not been deployed

No deployments
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