stevenzwu commented on code in PR #7795:
URL: https://github.com/apache/iceberg/pull/7795#discussion_r1234373012


##########
flink/v1.15/flink/src/main/java/org/apache/iceberg/flink/FlinkCatalog.java:
##########
@@ -126,10 +126,13 @@ public FlinkCatalog(
   @Override
   public void open() throws CatalogException {
     // Create the default database if it does not exist.
-    try {
-      createDatabase(getDefaultDatabase(), ImmutableMap.of(), true);
-    } catch (DatabaseAlreadyExistException e) {
-      // Ignore the exception if it's already exist.
+    String defaultDatabase = getDefaultDatabase();
+    if (!databaseExists(defaultDatabase)) {
+      try {
+        createDatabase(getDefaultDatabase(), ImmutableMap.of(), true);
+      } catch (DatabaseAlreadyExistException e) {

Review Comment:
   Yea, I was thinking about remove the create database call and just add a 
`Preconditions` check that the default database exists. that is also consistent 
with Flink's `HiveCatalog` implementation.
   
   The `Preconditions` check is also debatable. I am not very clear about the 
expectation of catalog. is the `default` database always expected/required? not 
sure if @rdblue has any input.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to