Hisoka-X commented on code in PR #7261:
URL: https://github.com/apache/seatunnel/pull/7261#discussion_r1694781715


##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/AbstractJdbcCatalog.java:
##########
@@ -277,15 +285,24 @@ public List<String> listDatabases() throws 
CatalogException {
 
     @Override
     public boolean databaseExists(String databaseName) throws CatalogException 
{
-        checkArgument(StringUtils.isNotBlank(databaseName));
-
-        return listDatabases().contains(databaseName);
+        if (StringUtils.isBlank(databaseName)) {
+            return false;
+        }
+        if (!SYS_DATABASES.isEmpty() && SYS_DATABASES.contains(databaseName)) {
+            return false;
+        }
+        return queryExists(
+                getUrlFromDatabaseName(databaseName), 
getDatabaseWithConditionSql(databaseName));

Review Comment:
   But in fact, the old way only has performance issues. If the user does not 
have a lot of tables, there is no problem. This PR solves the performance 
problem but should not invalidate the functions of the custom Catalog (It can 
not worked after merge this PR if do not change the code).



-- 
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: commits-unsubscr...@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to