JingsongLi commented on code in PR #939:
URL: https://github.com/apache/paimon-rust/pull/939#discussion_r4177501577
##########
crates/integrations/datafusion/src/procedures.rs:
##########
@@ -453,6 +455,42 @@ async fn proc_create_tag(
ok_result(ctx)
}
+async fn proc_create_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_name = require_arg(args, "branch")?;
+ let tag = args.get("tag").map(String::as_str);
+ let ignore_if_exists = args
+ .get("ignore_if_exists")
+ .map(|s| s.eq_ignore_ascii_case("true"))
+ .unwrap_or(false);
+
+ let bm = BranchManager::new(table.file_io().clone(),
table.location().to_string());
Review Comment:
[P2] Preserve REST catalog ownership when creating a branch. This filesystem
BranchManager is used for REST tables as well. With an actual HTTP-backed REST
catalog, a Parquet table and tag v1, CALL rest.sys.create_branch(table =>
'test_db.t1', branch => 'b2', tag => 'v1') returns success and creates the
physical branch directory, but sends no catalog mutation; a fresh SELECT
through b2 fails TableNotExist because b2 was never registered. Java
RESTCatalog.createBranch POSTs to the table branches endpoint with
branch/fromTag. Route creation through the catalog contract, or explicitly
reject REST before writing any branch files until that operation is supported.
##########
crates/integrations/datafusion/src/procedures.rs:
##########
@@ -453,6 +455,42 @@ async fn proc_create_tag(
ok_result(ctx)
}
+async fn proc_create_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?;
Review Comment:
[P2] Resolve the source branch for Java-compatible tag-based branch
creation. Java BranchProcedureTest and BranchSqlITCase explicitly cover
creating a branch from a tag on another branch. In a real SQL/Parquet probe, b1
and its branch-local tag only_b1 are readable, but CALL sys.create_branch(table
=> 'test_db.t1$branch_b1', branch => 'b2', tag => 'only_b1') fails
TableNotExist here, since get_table resolves the literal branch-qualified
identifier instead of loading that table branch. Resolve the source branch and
carry its tag/snapshot/schema scope into branch creation so this advertised
create_branch operation can reproduce the Java case.
--
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]