Amineharrabi opened a new pull request, #19150: URL: https://github.com/apache/iceberg/pull/19150
`ALTER TABLE t.branch_work CREATE BRANCH child` (and `CREATE TAG`) accepted the branch selector but created the ref from the head of `main`, because `CreateOrReplaceBranchExec` and `CreateOrReplaceTagExec` read `table.currentSnapshot()`. They now use the snapshot of the `SparkTable` the identifier resolves to, so the ref starts from `work`'s head, matching how reads and writes through `t.branch_work` behave. Without a selector this is still `main`'s head, and `AS OF VERSION` still takes precedence. Spark 3.5, 4.0 and 4.1 have the same code and can follow in a backport once this is reviewed. Fixes #19141 Test plan: `TestBranchDDL.createBranchFromSelectedBranch` and `TestTagDDL.createTagFromSelectedBranch` advance `main` past a branch `work`, create a ref through `t.branch_work`, and check that it points at `work`'s head; both fail without the change. The existing `TestBranchDDL`, `TestTagDDL` and `TestReplaceBranch` tests pass. --- **AI Disclosure** - Model: Claude Opus 5.5 - Platform/Tool: Claude Code - Human Oversight: [unknown - human to fill in] - Prompt Summary: Investigate #19141, find the cause, fix it for Spark 4.2 and add regression tests. The code change, tests and this description are generated; the choice to honour the selector rather than reject it is the author's. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
