feat(datafusion): support the delete_branch procedure - #941
jackylee-ch wants to merge 3 commits into
Conversation
|
Requirement fit: SUPPORTED, but P1: preserve branches configured for production reads. This procedure calls |
Review follow-up (apache#941): `sys.delete_branch` called `BranchManager::drop_branch` directly, so it would drop a branch named by `scan.primary-branch` or `scan.fallback-branch` and silently break the table's read path. Paimon Java `AbstractFileStoreTable.deleteBranch` refuses this and asks the caller to unset the option first. Add a `BranchManager::ensure_branch_deletable` guard reading those two options and call it before dropping each branch.
Java exposes `sys.delete_branch(table, branch)` to drop one or more comma-separated branches. The core BranchManager::drop_branch primitive already existed; only the DataFusion procedure was missing. Register delete_branch: declare its table/branch parameters (so a misspelled argument is rejected, like Java's binding) and dispatch to BranchManager, dropping each named branch and skipping one that does not exist -- the same forgiving, comma-splitting shape as delete_tag.
Review follow-up (apache#941): `sys.delete_branch` called `BranchManager::drop_branch` directly, so it would drop a branch named by `scan.primary-branch` or `scan.fallback-branch` and silently break the table's read path. Paimon Java `AbstractFileStoreTable.deleteBranch` refuses this and asks the caller to unset the option first. Add a `BranchManager::ensure_branch_deletable` guard reading those two options and call it before dropping each branch.
…ches Add the SQL regressions requested in review: at the CALL boundary, `sys.delete_branch` must refuse a branch named by `scan.primary-branch` or `scan.fallback-branch` and leave it in place, while still deleting unrelated branches; and a comma-separated request must catch a protected branch even when it is not listed first.
1b6706b to
574aa4f
Compare
|
Addressed. Added the SQL regressions:
I verified the tests are non-vacuous: neutering the check makes both fail with "expected error, got Ok" (the protected branch is deleted); restoring it passes. Rebased onto current main. |
Java exposes
sys.delete_branch(table, branch)to drop one or more comma-separated branches. The coreBranchManager::drop_branchprimitive already existed; only the DataFusionCALLprocedure was missing.This registers
delete_branch: it declares thetable/branchparameters so a misspelled argument is rejected, and dispatches toBranchManager, dropping each named branch and skipping one that no longer exists — the same forgiving, comma-splitting shape as the existingdelete_tag.Tested end-to-end: seed a branch, CALL delete_branch, assert it is gone from
$branches; a second delete of the same branch is a no-op.