Skip to content

Commit

Permalink
Core: Fix BaseMetastoreCatalog#registerTable to return full table name (
Browse files Browse the repository at this point in the history
apache#6589)

* Core: Fix BaseMetastoreCatalog#registerTable to return full table name

registerTable should return full table name, just like how loadTable and
create API returns

* Empty
  • Loading branch information
krvikash authored Jan 17, 2023
1 parent dc75045 commit 32cfb62
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public Table registerTable(TableIdentifier identifier, String metadataFileLocati
TableMetadata metadata = TableMetadataParser.read(ops.io(), metadataFile);
ops.commit(null, metadata);

return new BaseTable(ops, identifier.toString());
return new BaseTable(ops, fullTableName(name(), identifier));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import org.apache.iceberg.SortOrder;
import org.apache.iceberg.Table;
import org.apache.iceberg.TableOperations;
import org.apache.iceberg.TestHelpers;
import org.apache.iceberg.Transaction;
import org.apache.iceberg.catalog.CatalogTests;
import org.apache.iceberg.catalog.Namespace;
Expand Down Expand Up @@ -778,7 +779,9 @@ public void testRegisterTable() {
catalog.dropTable(identifier, false);
TableOperations ops = ((HasTableOperations) registeringTable).operations();
String metadataLocation = ((JdbcTableOperations) ops).currentMetadataLocation();
Assertions.assertThat(catalog.registerTable(identifier, metadataLocation)).isNotNull();
Table registeredTable = catalog.registerTable(identifier, metadataLocation);
Assertions.assertThat(registeredTable).isNotNull();
TestHelpers.assertSerializedAndLoadedMetadata(registeringTable, registeredTable);
Assertions.assertThat(catalog.loadTable(identifier)).isNotNull();
Assertions.assertThat(catalog.dropTable(identifier)).isTrue();
}
Expand Down

0 comments on commit 32cfb62

Please sign in to comment.