bowenli86 commented on a change in pull request #9971: [FLINK-14490][table] Add 
methods for interacting with temporary objects
URL: https://github.com/apache/flink/pull/9971#discussion_r338168934
 
 

 ##########
 File path: 
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/catalog/CatalogCalciteSchema.java
 ##########
 @@ -59,17 +62,34 @@ public CatalogCalciteSchema(boolean isStreamingMode, 
String catalogName, Catalog
         */
        @Override
        public Schema getSubSchema(String schemaName) {
-
-               if (catalog.databaseExists(schemaName)) {
-                       return new DatabaseCalciteSchema(isStreamingMode, 
schemaName, catalogName, catalog);
+               if (temporaryDatabaseExists(schemaName) || 
permanentDatabaseExists(schemaName)) {
+                       return new DatabaseCalciteSchema(isStreamingMode, 
schemaName, catalogName, catalogManager);
                } else {
                        return null;
                }
        }
 
+       private boolean temporaryDatabaseExists(String schemaName) {
+               return catalogManager.getTemporaryTables()
+                       .keySet()
+                       .stream()
+                       .anyMatch(i -> i.getDatabaseName().equals(schemaName));
+       }
+
+       private Boolean permanentDatabaseExists(String schemaName) {
 
 Review comment:
   ditto

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to