Skip to content

[core] Add IF NOT EXISTS support for create_branch operation#7353

Merged
JingsongLi merged 1 commit intoapache:masterfrom
dark2momo:master
Mar 7, 2026
Merged

[core] Add IF NOT EXISTS support for create_branch operation#7353
JingsongLi merged 1 commit intoapache:masterfrom
dark2momo:master

Conversation

@dark2momo
Copy link
Contributor

@dark2momo dark2momo commented Mar 6, 2026

This commit adds the ignoreIfExists parameter to the create_branch operation across all layers:

Core Layer:

  • Add createBranch(String branchName, boolean ignoreIfExists) method to Table interface
  • Add createBranch(String branchName, String tagName, boolean ignoreIfExists) method to Table interface
  • Add corresponding methods to BranchManager interface
  • Update AbstractFileStoreTable, FormatTable, DelegatedFileStoreTable, ReadonlyTable, PrivilegedFileStoreTable implementations
  • Update Catalog interface with default method for ignoreIfExists support
  • Update CatalogBranchManager and FileSystemBranchManager implementations

Flink Layer:

  • Update CreateBranchProcedure with optional ignoreIfExists parameter
  • Update CreateBranchAction and CreateBranchActionFactory
  • Update MultipleParameterToolAdapter for parsing ignoreIfExists option

Spark Layer:

  • Update CreateBranchProcedure with optional ignoreIfExists parameter

Testing:

  • Add test cases for createBranch with ignoreIfExists in SimpleTableTestBase
  • Add test cases for createBranch with ignoreIfExists in BranchActionITCase

All existing tests continue to pass, ensuring backward compatibility.

Purpose

Linked issue: close #7277

Tests

API and Format

Documentation

Generative AI tooling

This commit adds the `ignoreIfExists` parameter to the create_branch operation across all layers:

Core Layer:
- Add `createBranch(String branchName, boolean ignoreIfExists)` method to Table interface
- Add `createBranch(String branchName, String tagName, boolean ignoreIfExists)` method to Table interface
- Add corresponding methods to BranchManager interface
- Update AbstractFileStoreTable, FormatTable, DelegatedFileStoreTable, ReadonlyTable, PrivilegedFileStoreTable implementations
- Update Catalog interface with default method for ignoreIfExists support
- Update CatalogBranchManager and FileSystemBranchManager implementations

Flink Layer:
- Update CreateBranchProcedure with optional ignoreIfExists parameter
- Update CreateBranchAction and CreateBranchActionFactory
- Update MultipleParameterToolAdapter for parsing ignoreIfExists option

Spark Layer:
- Update CreateBranchProcedure with optional ignoreIfExists parameter

Testing:
- Add test cases for createBranch with ignoreIfExists in SimpleTableTestBase
- Add test cases for createBranch with ignoreIfExists in BranchActionITCase

All existing tests continue to pass, ensuring backward compatibility.
Copy link
Contributor

@JingsongLi JingsongLi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@JingsongLi JingsongLi merged commit 85b8dee into apache:master Mar 7, 2026
12 checks passed
@dark2momo
Copy link
Contributor Author

@JingsongLi Thank you for the review and merge~

jerry-024 added a commit to jerry-024/paimon that referenced this pull request Mar 10, 2026
* upstream/master: (31 commits)
  [python] Correct pyroaring version in requirements
  [test] Enrich table name in MergeIntoTableTestBase
  [test] Fix unstable test: FileStoreLookupFunctionTest.testLookupScanLeak
  [python] Remove useless parameters in blob_writer.py
  [rest] Introduce reset consumer api in rest (apache#7372)
  [python] Introduce Python CLI table snapshot (apache#7373)
  [python] Fix time mapping by always using time32 (apache#7371)
  [python] Introduce catalog list-dbs in Python CLI (apache#7366)
  [hotfix][docs] replace the documentation URL for data-types blob (apache#7370)
  [python] Add i short name to ignore-if-not-exists for database
  [python] Support dynamic bucket write (apache#7363)
  [python] Introduce database related commands to Python CLI (apache#7362)
  [python] Introduce table import, drop and alter to Python CLI (apache#7360)
  [python] Fix py version required in README (apache#7361)
  [test] Add missing LeafFunction coverage in PredicateJsonSerdeTest (apache#7359)
  [python] support predicate NotBetween, Like function (apache#7352)
  [python] Introduce Paimon CLI in PyPaimon (apache#7358)
  [doc] Document ignoreIfExists for create_branch
  [core] Add IF NOT EXISTS support for create_branch operation (apache#7353)
  [python] Remove oss and pylance from requirements deps
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Allow "IF NOT EXISTS" check on branches

2 participants