feat(datafusion): support the rename_branch procedure - #942
jackylee-ch wants to merge 3 commits into
Conversation
|
Requirement fit: SUPPORTED; the SQL procedure provides a real end-to-end branch operation. However, P1: reject path separators in branch names before exposing rename via SQL. |
Review follow-up (apache#942): `BranchManager::validate_branch_name` accepted a rename target containing a path separator such as `foo/bar`, so `sys.rename_branch` moved the branch to a nested path (`branch-foo/bar`) that `$branches` never lists back — a silently orphaned branch. Reject '/' and '\\' in branch names, alongside the existing main/blank/numeric checks.
Java exposes `sys.rename_branch(table, from_branch, to_branch)` to rename a branch. The core BranchManager::rename_branch primitive already existed; only the DataFusion procedure was missing. Register rename_branch: declare its table/from_branch/to_branch parameters (so a misspelled argument is rejected, like Java's binding) and dispatch to BranchManager, which validates that the source branch exists, the target name is free, and neither is main.
Review follow-up (apache#942): `BranchManager::validate_branch_name` accepted a rename target containing a path separator such as `foo/bar`, so `sys.rename_branch` moved the branch to a nested path (`branch-foo/bar`) that `$branches` never lists back — a silently orphaned branch. Reject '/' and '\\' in branch names, alongside the existing main/blank/numeric checks.
Mirror the create_branch regression for rename: after creating `b1`, `CALL sys.rename_branch(..., to_branch => 'foo/bar')` must fail with the path-separator error, leave `b1` in place (still listed by `$branches`), and not produce a `foo/bar` branch.
07967cf to
af87f57
Compare
|
Addressed. On the Added the SQL regression The |
|
The path-separator regression is fixed and the existing 34 SQL procedure tests plus 18 branch-manager tests pass. I also verified a tag-born branch retains its data after an ordinary SQL rename and can be queried via [P1] Validate the source branch name before moving its directory. [P2] Reject target names that readers cannot open. A validation mismatch remains in the newly exposed rename operation ( Concrete reproduction: create a native table with one row, create tag Please share the catalog/table name validation at the manager boundary (also rejecting control characters), retaining the manager's additional main/numeric restrictions. My actual rename/read regression fails on this head; a temporary control calling the catalog validator rejects the target before mutation and preserves the original branch and row. The source traversal probe |
Java exposes
sys.rename_branch(table, from_branch, to_branch)to rename a branch. The coreBranchManager::rename_branchprimitive already existed; only the DataFusionCALLprocedure was missing.This registers
rename_branch: it declares thetable/from_branch/to_branchparameters so a misspelled argument is rejected, and dispatches toBranchManager, which already validates that the source branch exists, the target name is free, and neither ismain.Tested end-to-end: seed a branch, CALL rename_branch, assert the old name is gone from
$branchesand the new one is present; renaming a missing branch errors.