Skip to content

Commit

Permalink
[rename] Extract assertMainBranch to AbstractCatalog (apache#3761)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuzelin authored Jul 16, 2024
1 parent ae77340 commit 414adcd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,13 @@ protected void checkNotBranch(Identifier identifier, String method) {
}
}

protected void assertMainBranch(String branchName) {
if (!DEFAULT_MAIN_BRANCH.equals(branchName)) {
throw new UnsupportedOperationException(
this.getClass().getName() + " currently does not support table branches");
}
}

private static boolean isSpecifiedSystemTable(Identifier identifier) {
return identifier.getObjectName().contains(SYSTEM_TABLE_SPLITTER)
&& !getOriginalIdentifierAndBranch(identifier).isPresent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
import static org.apache.paimon.jdbc.JdbcUtils.execute;
import static org.apache.paimon.jdbc.JdbcUtils.insertProperties;
import static org.apache.paimon.jdbc.JdbcUtils.updateTable;
import static org.apache.paimon.utils.BranchManager.DEFAULT_MAIN_BRANCH;

/* This file is based on source code from the Iceberg Project (http://iceberg.apache.org/), licensed by the Apache
* Software Foundation (ASF) under the Apache License, Version 2.0. See the NOTICE file distributed with this work for
Expand Down Expand Up @@ -334,13 +333,6 @@ protected TableSchema getDataTableSchema(Identifier identifier, String branchNam
() -> new RuntimeException("There is no paimon table in " + tableLocation));
}

private void assertMainBranch(String branchName) {
if (!DEFAULT_MAIN_BRANCH.equals(branchName)) {
throw new UnsupportedOperationException(
"JdbcCatalog currently does not support table branches");
}
}

@Override
public boolean tableExists(Identifier identifier) {
if (isSystemTable(identifier)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@
import static org.apache.paimon.hive.HiveCatalogOptions.LOCATION_IN_PROPERTIES;
import static org.apache.paimon.options.CatalogOptions.TABLE_TYPE;
import static org.apache.paimon.options.OptionsUtils.convertToPropertiesPrefixKey;
import static org.apache.paimon.utils.BranchManager.DEFAULT_MAIN_BRANCH;
import static org.apache.paimon.utils.Preconditions.checkArgument;
import static org.apache.paimon.utils.StringUtils.isNullOrWhitespaceOnly;

Expand Down Expand Up @@ -409,13 +408,6 @@ public TableSchema getDataTableSchema(Identifier identifier, String branchName)
return getDataTableSchema(identifier);
}

private void assertMainBranch(String branchName) {
if (!DEFAULT_MAIN_BRANCH.equals(branchName)) {
throw new UnsupportedOperationException(
"HiveCatalog currently does not support table branches");
}
}

private TableSchema getDataTableSchema(Identifier identifier) throws TableNotExistException {
if (!tableExists(identifier)) {
throw new TableNotExistException(identifier);
Expand Down

0 comments on commit 414adcd

Please sign in to comment.