Skip to content

feat(namespace-dir): implement table tag operations#6886

Open
XuQianJin-Stars wants to merge 1 commit into
lance-format:mainfrom
XuQianJin-Stars:feature/implement-table-tag-operations
Open

feat(namespace-dir): implement table tag operations#6886
XuQianJin-Stars wants to merge 1 commit into
lance-format:mainfrom
XuQianJin-Stars:feature/implement-table-tag-operations

Conversation

@XuQianJin-Stars
Copy link
Copy Markdown
Contributor

@XuQianJin-Stars XuQianJin-Stars commented May 21, 2026

Summary

Implement the 5 table tag trait methods on DirectoryNamespace by delegating to the native lance Dataset::tags() interface, so that tag management works end-to-end against any directory-backed namespace (local FS / object store) without requiring a remote catalog.

Closes #6885.

What's Changed

Implemented the following TableTag trait methods on DirectoryNamespace (rust/lance-namespace-impls/src/dir.rs):

  • list_table_tags — list all tags of a table, with their referenced version and an optional message.
  • get_table_tag_version — resolve a tag name to its dataset version.
  • create_table_tag — create a new tag pointing to a given version; rejects duplicates.
  • delete_table_tag — delete an existing tag; rejects unknown tags.
  • update_table_tag — move an existing tag to a new version; rejects unknown tags / versions.

All methods open the target dataset via the existing directory-resolution logic and then call into Dataset::tags() (create / update / delete / list / get_version).

Error Mapping

A small helper map_tag_error translates lance-core ref errors into the proper NamespaceError variants used by the namespace API:

lance-core error NamespaceError
RefNotFound TableTagNotFound
RefConflict TableTagAlreadyExists
InvalidRef InvalidInput
VersionNotFound TableVersionNotFound

Additionally, requests are validated up-front:

  • Empty tag names → InvalidInput.
  • Non-positive versions (<= 0) on create / updateInvalidInput.
  • Missing tables continue to surface as TableNotFound via the existing dataset-open path.

Tests

Added 10 unit tests in dir.rs covering:

  1. create + list happy path (tag visible with correct version & optional message).
  2. create conflict on duplicate tag → TableTagAlreadyExists.
  3. get_table_tag_version happy path.
  4. get_table_tag_version on unknown tag → TableTagNotFound.
  5. update_table_tag happy path (version moves forward).
  6. update_table_tag on unknown tag → TableTagNotFound.
  7. delete_table_tag happy path (subsequent get fails).
  8. delete_table_tag on unknown tag → TableTagNotFound.
  9. Invalid input: empty tag name and non-positive version → InvalidInput.
  10. Operations on a non-existent table → TableNotFound.

Scope / Non-Goals

  • Only DirectoryNamespace is touched; other namespace implementations are unchanged.
  • No changes to public trait signatures, the namespace REST schema, or the on-disk tag format — this PR purely wires the existing Dataset::tags() API through the directory namespace.

Implement the 5 table tag trait methods on DirectoryNamespace by
delegating to the native lance Dataset::tags() interface:

  - list_table_tags
  - get_table_tag_version
  - create_table_tag
  - delete_table_tag
  - update_table_tag

A small helper map_tag_error translates lance-core ref errors
(RefNotFound / RefConflict / InvalidRef / VersionNotFound) into the
proper NamespaceError variants (TableTagNotFound, TableTagAlreadyExists,
InvalidInput, TableVersionNotFound). Empty tag names and non-positive
versions are rejected up-front as InvalidInput.

Add 10 unit tests covering create/list, conflict, get, get-not-found,
update, update-not-found, delete, delete-not-found, invalid arguments
and table-not-found paths.
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@github-actions github-actions Bot added the enhancement New feature or request label May 21, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2026

Codecov Report

❌ Patch coverage is 89.69957% with 24 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
rust/lance-namespace-impls/src/dir.rs 89.69% 24 Missing ⚠️

📢 Thoughts on this report? Let us know!

@XuQianJin-Stars XuQianJin-Stars changed the title feat(DirectoryNamespace): implement table tag operations feat(namespace-dir): implement table tag operations May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(DirectoryNamespace): implement table tag operations

1 participant