raminqaf commented on code in PR #28791:
URL: https://github.com/apache/flink/pull/28791#discussion_r3655015328


##########
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/CatalogManager.java:
##########
@@ -1910,6 +1910,36 @@ public Optional<CatalogConnection> 
getConnection(ObjectIdentifier objectIdentifi
         }
     }
 
+    /**
+     * Get a connection from the catalog with contextual metadata.
+     *
+     * @param objectIdentifier The fully qualified path of the connection.
+     * @return The requested connection wrapped in Optional.
+     */
+    public Optional<ContextResolvedConnection> getResolvedConnection(
+            ObjectIdentifier objectIdentifier) {
+        CatalogConnection temporaryConnection = 
temporaryConnections.get(objectIdentifier);
+        if (temporaryConnection != null) {
+            return Optional.of(
+                    ContextResolvedConnection.of(objectIdentifier, 
temporaryConnection, true));
+        }
+
+        Optional<Catalog> catalog = 
getCatalog(objectIdentifier.getCatalogName());
+        if (catalog.isPresent()) {
+            try {
+                return Optional.of(
+                        ContextResolvedConnection.of(
+                                objectIdentifier,
+                                
catalog.get().getConnection(objectIdentifier.toObjectPath()),
+                                false));
+            } catch (ConnectionNotExistException | 
UnsupportedOperationException e) {
+                return Optional.empty();
+            }
+        } else {
+            return Optional.empty();
+        }

Review Comment:
   `else` not needed
   ```suggestion
           }
           return Optional.empty();
   ```



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