diff --git a/paimon-core/src/main/java/org/apache/paimon/catalog/AbstractCatalog.java b/paimon-core/src/main/java/org/apache/paimon/catalog/AbstractCatalog.java index d6ffa36f5fc7..b440e1b6e508 100644 --- a/paimon-core/src/main/java/org/apache/paimon/catalog/AbstractCatalog.java +++ b/paimon-core/src/main/java/org/apache/paimon/catalog/AbstractCatalog.java @@ -67,7 +67,6 @@ public abstract class AbstractCatalog implements Catalog { protected final FileIO fileIO; protected final Map tableDefaultOptions; protected final Options catalogOptions; - protected final String branchName; @Nullable protected final LineageMetaFactory lineageMetaFactory; @@ -76,7 +75,6 @@ protected AbstractCatalog(FileIO fileIO) { this.lineageMetaFactory = null; this.tableDefaultOptions = new HashMap<>(); this.catalogOptions = new Options(); - branchName = BranchManager.DEFAULT_MAIN_BRANCH; } protected AbstractCatalog(FileIO fileIO, Options options) { @@ -86,7 +84,6 @@ protected AbstractCatalog(FileIO fileIO, Options options) { this.tableDefaultOptions = convertToPropertiesPrefixKey(options.toMap(), TABLE_DEFAULT_OPTION_PREFIX); this.catalogOptions = options; - this.branchName = options.get(CoreOptions.BRANCH); } @Override @@ -340,12 +337,6 @@ public Table getTable(Identifier identifier) throws TableNotExistException { return table; } else { Table table = getDataTable(identifier); - // Override branch option - if (!branchName.equals(BranchManager.DEFAULT_MAIN_BRANCH)) { - Map dynamicOptions = new HashMap<>(table.options()); - dynamicOptions.put(CoreOptions.BRANCH.key(), branchName); - table = table.copy(dynamicOptions); - } return table; } } diff --git a/paimon-core/src/main/java/org/apache/paimon/catalog/FileSystemCatalog.java b/paimon-core/src/main/java/org/apache/paimon/catalog/FileSystemCatalog.java index e4815a4de42c..1e4e5b0ebaaa 100644 --- a/paimon-core/src/main/java/org/apache/paimon/catalog/FileSystemCatalog.java +++ b/paimon-core/src/main/java/org/apache/paimon/catalog/FileSystemCatalog.java @@ -119,7 +119,7 @@ public boolean tableExists(Identifier identifier) { } private boolean tableExists(Path tablePath) { - return new SchemaManager(fileIO, tablePath, branchName).listAllIds().size() > 0; + return new SchemaManager(fileIO, tablePath).listAllIds().size() > 0; } @Override @@ -153,7 +153,7 @@ private SchemaManager schemaManager(Identifier identifier) { new RuntimeException( "No lock context when lock is enabled.")))) .orElse(null); - return new SchemaManager(fileIO, path, branchName) + return new SchemaManager(fileIO, path) .withLock(catalogLock == null ? null : Lock.fromCatalog(catalogLock, identifier)); } diff --git a/paimon-core/src/main/java/org/apache/paimon/jdbc/JdbcCatalog.java b/paimon-core/src/main/java/org/apache/paimon/jdbc/JdbcCatalog.java index 922d513ebac2..7e7718b5bee9 100644 --- a/paimon-core/src/main/java/org/apache/paimon/jdbc/JdbcCatalog.java +++ b/paimon-core/src/main/java/org/apache/paimon/jdbc/JdbcCatalog.java @@ -288,7 +288,7 @@ protected void renameTableImpl(Identifier fromTable, Identifier toTable) { updateTable(connections, catalogKey, fromTable, toTable); Path fromPath = getDataTableLocation(fromTable); - if (new SchemaManager(fileIO, fromPath, branchName).listAllIds().size() > 0) { + if (new SchemaManager(fileIO, fromPath).listAllIds().size() > 0) { // Rename the file system's table directory. Maintain consistency between tables in // the file system and tables in the Hive Metastore. Path toPath = getDataTableLocation(toTable); @@ -323,7 +323,7 @@ protected TableSchema getDataTableSchema(Identifier identifier) throws TableNotE throw new TableNotExistException(identifier); } Path tableLocation = getDataTableLocation(identifier); - return new SchemaManager(fileIO, tableLocation, branchName) + return new SchemaManager(fileIO, tableLocation) .latest() .orElseThrow( () -> new RuntimeException("There is no paimon table in " + tableLocation)); @@ -374,7 +374,7 @@ public void close() throws Exception { } private SchemaManager getSchemaManager(Identifier identifier) { - return new SchemaManager(fileIO, getDataTableLocation(identifier), branchName) + return new SchemaManager(fileIO, getDataTableLocation(identifier)) .withLock(lock(identifier)); } diff --git a/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalog.java b/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalog.java index d548c0976937..0d71e70a6479 100644 --- a/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalog.java +++ b/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalog.java @@ -336,7 +336,7 @@ public TableSchema getDataTableSchema(Identifier identifier) throws TableNotExis throw new TableNotExistException(identifier); } Path tableLocation = getDataTableLocation(identifier); - return new SchemaManager(fileIO, tableLocation, branchName) + return new SchemaManager(fileIO, tableLocation) .latest() .orElseThrow( () -> new RuntimeException("There is no paimon table in " + tableLocation)); @@ -422,7 +422,7 @@ protected void renameTableImpl(Identifier fromTable, Identifier toTable) { client.alter_table(fromDB, fromTableName, table); Path fromPath = getDataTableLocation(fromTable); - if (new SchemaManager(fileIO, fromPath, branchName).listAllIds().size() > 0) { + if (new SchemaManager(fileIO, fromPath).listAllIds().size() > 0) { // Rename the file system's table directory. Maintain consistency between tables in // the file system and tables in the Hive Metastore. Path toPath = getDataTableLocation(toTable); @@ -588,7 +588,7 @@ private FieldSchema convertToFieldSchema(DataField dataField) { } private SchemaManager schemaManager(Identifier identifier) { - return new SchemaManager(fileIO, getDataTableLocation(identifier), branchName) + return new SchemaManager(fileIO, getDataTableLocation(identifier)) .withLock(lock(identifier)); }