Skip to content

feat(namespace-dir): implement rename_table for DirectoryNamespace#6961

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

feat(namespace-dir): implement rename_table for DirectoryNamespace#6961
XuQianJin-Stars wants to merge 1 commit into
lance-format:mainfrom
XuQianJin-Stars:feature/implement-rename-table

Conversation

@XuQianJin-Stars
Copy link
Copy Markdown
Contributor

Closes #6922

Summary

DirectoryNamespace (the filesystem-backed LanceNamespace implementation in rust/lance-namespace-impls/src/dir.rs) currently falls back to the trait's default "Not supported" implementation for two DML operations. This PR wires them up to Lance core, on par with what Dataset::update / Dataset::delete already provide for direct dataset access.

Method Backed by
update_table(UpdateTableRequest) -> UpdateTableResponse lance::dataset::write::UpdateBuilder
delete_from_table(DeleteFromTableRequest) -> DeleteFromTableResponse Dataset::delete(predicate)

Both methods are already exposed on the Java side (DirectoryNamespace.java updateTable / deleteFromTable) and by lance-namespace-request-client, so this PR is Rust-only and unblocks the existing client surface.

Changes

update_table

  • Builds an UpdateBuilder by setting each [column, expression] pair from the request, applies the optional predicate via update_where, and returns the actual rows_updated and the new dataset version.
  • Validates the updates list up-front (non-empty list, exactly two elements per pair, non-empty / duplicate-free column names) so callers get a clean InvalidInput instead of an opaque DataFusion parse error.

Implements the rename_table method for DirectoryNamespace, allowing tables
to be renamed within the same namespace. The implementation:

- Validates source table exists via resolve_table_location
- Checks destination table does not already exist
- Copies all files from source to destination path
- Removes the source directory after successful copy
- Updates manifest entries when manifest mode is enabled
- Rejects cross-namespace rename when manifest mode is disabled

Includes 5 unit tests:
- test_rename_table_basic: basic rename and verify accessibility
- test_rename_to_existing_table_should_fail: conflict detection
- test_rename_nonexistent_table_should_fail: source not found
- test_rename_table_empty_name_should_fail: input validation
- test_rename_table_cross_namespace_should_fail: unsupported in dir mode
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
Copy link
Copy Markdown
Contributor

ACTION NEEDED
Lance follows the Conventional Commits specification for release automation.

The PR title and description are used as the merge commit message. Please update your PR title and description to match the specification.

For details on the error please inspect the "PR Title Check" action.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 27, 2026

Codecov Report

❌ Patch coverage is 74.62687% with 34 lines in your changes missing coverage. Please review.

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

📢 Thoughts on this report? Let us know!

@XuQianJin-Stars XuQianJin-Stars changed the title feat(namespace-dir): implement rename_table for DirectoryNamespace feat(namespace-dir): implement rename_table for DirectoryNamespace May 28, 2026
@github-actions github-actions Bot added the enhancement New feature or request label May 28, 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 update_table and delete_from_table DML methods

1 participant