JingsongLi commented on code in PR #941:
URL: https://github.com/apache/paimon-rust/pull/941#discussion_r4177453189
##########
crates/integrations/datafusion/src/procedures.rs:
##########
@@ -453,6 +455,43 @@ async fn proc_create_tag(
ok_result(ctx)
}
+async fn proc_delete_branch(
+ ctx: &SessionContext,
+ catalog: &Arc<dyn Catalog>,
+ catalog_name: &str,
+ args: &HashMap<String, String>,
+) -> DFResult<DataFrame> {
+ let table = get_table(catalog, catalog_name, args).await?;
+ let branch_str = require_arg(args, "branch")?;
+
+ let bm = BranchManager::new(table.file_io().clone(),
table.location().to_string());
Review Comment:
[P2] Preserve REST catalog ownership when deleting branches
get_table accepts REST-managed tables too, but this always uses the
filesystem manager. A real HTTP/Parquet branch probe reads b1 through the REST
catalog, then CALL rest.sys.delete_branch(..., branch => b1) succeeds,
recursively deletes its directory, and makes fresh b1 reads fail, although the
catalog still registers b1. The captured requests contain only GETs; the
fixture rejects catalog mutations. Java uses CatalogBranchManager for REST
tables and sends DELETE .../tables/{table}/branches/{branch}, propagating
refusal instead of deleting locally. Route through catalog management or reject
REST tables before filesystem mutation until that API is supported. A temporary
early REST guard preserves the readable branch.
##########
crates/integrations/datafusion/src/procedures.rs:
##########
@@ -453,6 +455,43 @@ async fn proc_create_tag(
ok_result(ctx)
}
+async fn proc_delete_branch(
+ ctx: &SessionContext,
+ catalog: &Arc<dyn Catalog>,
+ catalog_name: &str,
+ args: &HashMap<String, String>,
+) -> DFResult<DataFrame> {
+ let table = get_table(catalog, catalog_name, args).await?;
+ let branch_str = require_arg(args, "branch")?;
+
+ let bm = BranchManager::new(table.file_io().clone(),
table.location().to_string());
+ let options = table.schema().options();
+ for branch_name in branch_str.split(',') {
+ let branch_name = branch_name.trim();
Review Comment:
[P2] Preserve the exact branch identity instead of trimming it
Leading spaces are valid in both the shared branch validator and readers: "
b1" and "b1" can be distinct readable tag-born branches. With both present,
CALL sys.delete_branch(..., branch => ' b1') succeeds but deletes "b1" and
leaves the requested " b1" untouched. The real write/tag/branch/read probe
reports b1=false, requested branch=true after deletion. Java
Table.deleteBranches splits commas and passes each token unchanged, so the
existing delete_tag trim convention is not applicable to branch identities.
Preserve the raw token or reject ambiguous input before mutation; removing this
trim makes the leading-space deletion probe pass on the current-main merge.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]