Repository navigation
Spark 4.2: Create branch and tag from the selected ref in ALTER TABLE - #19150
Open
Amineharrabi wants to merge 1 commit into
Open
Amineharrabi wants to merge 1 commit into
Amineharrabi wants to merge 1 commit into
Conversation
ALTER TABLE t.branch_x CREATE BRANCH/TAG accepted the branch selector but created the new ref from the head of main. The new ref now starts from the snapshot of the table as the identifier selects it, which is main's head when there is no selector. Generated-by: Claude Code
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ALTER TABLE t.branch_work CREATE BRANCH child(andCREATE TAG) accepted the branch selector but created the ref from the head ofmain, becauseCreateOrReplaceBranchExecandCreateOrReplaceTagExecreadtable.currentSnapshot(). They now use the snapshot of theSparkTablethe identifier resolves to, so the ref starts fromwork's head, matching how reads and writes throught.branch_workbehave. Without a selector this is stillmain's head, andAS OF VERSIONstill 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.createBranchFromSelectedBranchandTestTagDDL.createTagFromSelectedBranchadvancemainpast a branchwork, create a ref throught.branch_work, and check that it points atwork's head; both fail without the change. The existingTestBranchDDL,TestTagDDLandTestReplaceBranchtests pass.AI Disclosure
AI was used with human oversight