nssalian commented on a change in pull request #3275:
URL: https://github.com/apache/iceberg/pull/3275#discussion_r735045350



##########
File path: core/src/main/java/org/apache/iceberg/jdbc/JdbcCatalog.java
##########
@@ -359,22 +400,30 @@ public void close() {
   public boolean namespaceExists(Namespace namespace) {
     try {
       return connections.run(conn -> {
-        boolean exists = false;
-
+        boolean tableExists = false;
         try (PreparedStatement sql = 
conn.prepareStatement(JdbcUtil.GET_NAMESPACE_SQL)) {
           sql.setString(1, catalogName);
           sql.setString(2, JdbcUtil.namespaceToString(namespace) + "%");
           ResultSet rs = sql.executeQuery();
           if (rs.next()) {
-            exists = true;
+            tableExists = true;
           }
 
           rs.close();
         }
+        boolean namespacePropertyExists = false;
+        try (PreparedStatement sql = 
conn.prepareStatement(JdbcUtil.GET_NAMESPACE_PROPERTIES_SQL)) {
+          sql.setString(1, catalogName);
+          sql.setString(2, JdbcUtil.namespaceToString(namespace) + "%");
+          ResultSet rs = sql.executeQuery();
+          if (rs.next()) {
+            namespacePropertyExists = true;
+          }
 
-        return exists;
+          rs.close();
+        }
+        return (tableExists || namespacePropertyExists);
       });
-

Review comment:
       Done




-- 
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