@@ -305,7 +305,9 @@ public class HoodieCatalog extends AbstractCatalog {
|
||||
try {
|
||||
StreamerUtil.initTableIfNotExists(conf);
|
||||
// prepare the non-table-options properties
|
||||
options.put(TableOptionProperties.COMMENT, resolvedTable.getComment());
|
||||
if (!StringUtils.isNullOrWhitespaceOnly(resolvedTable.getComment())) {
|
||||
options.put(TableOptionProperties.COMMENT, resolvedTable.getComment());
|
||||
}
|
||||
TableOptionProperties.createProperties(tablePathStr, hadoopConf, options);
|
||||
} catch (IOException e) {
|
||||
throw new CatalogException(String.format("Initialize table path %s exception.", tablePathStr), e);
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.apache.flink.table.catalog.ResolvedCatalogTable;
|
||||
import org.apache.flink.table.catalog.ResolvedSchema;
|
||||
import org.apache.flink.table.catalog.UniqueConstraint;
|
||||
import org.apache.flink.table.catalog.exceptions.CatalogException;
|
||||
import org.apache.flink.table.catalog.exceptions.DatabaseAlreadyExistException;
|
||||
import org.apache.flink.table.catalog.exceptions.DatabaseNotExistException;
|
||||
import org.apache.flink.table.catalog.exceptions.TableAlreadyExistException;
|
||||
import org.apache.flink.table.catalog.exceptions.TableNotExistException;
|
||||
@@ -158,6 +159,10 @@ public class TestHoodieCatalog {
|
||||
assertTrue(catalog.listDatabases().contains("db1"));
|
||||
assertEquals(expected.getProperties(), actual.getProperties());
|
||||
|
||||
// create exist database
|
||||
assertThrows(DatabaseAlreadyExistException.class,
|
||||
() -> catalog.createDatabase("db1", expected, false));
|
||||
|
||||
// drop exist database
|
||||
catalog.dropDatabase("db1", true);
|
||||
assertFalse(catalog.listDatabases().contains("db1"));
|
||||
|
||||
Reference in New Issue
Block a user