FangYongs commented on code in PR #23063:
URL: https://github.com/apache/flink/pull/23063#discussion_r1283908619


##########
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/FileCatalogStore.java:
##########
@@ -217,32 +253,10 @@ public Set<String> listCatalogs() throws CatalogException 
{
     public boolean contains(String catalogName) throws CatalogException {
         checkOpenState();
 
-        return listAllCatalogFiles().containsKey(catalogName);
-    }
-
-    private Map<String, Path> listAllCatalogFiles() throws CatalogException {
-        Map<String, Path> files = new HashMap<>();
-        File directoryFile = new File(catalogStoreDirectory);
-        if (!directoryFile.isDirectory()) {
-            throw new CatalogException("File catalog store only support local 
directory");
-        }
-
-        try {
-            Files.list(directoryFile.toPath())
-                    .filter(file -> 
file.getFileName().toString().endsWith(FILE_EXTENSION))
-                    .filter(Files::isRegularFile)
-                    .forEach(
-                            p ->
-                                    files.put(
-                                            
p.getFileName().toString().replace(FILE_EXTENSION, ""),
-                                            p));
-        } catch (Throwable t) {
-            throw new CatalogException("Failed to list file catalog store 
directory", t);
-        }
-        return files;
+        return listCatalogs().contains(catalogName);

Review Comment:
   Directly check if the catalog file exists here? I think get all catalogs may 
be not an efficient operation



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

Reply via email to