Shekharrajak commented on code in PR #28793:
URL: https://github.com/apache/flink/pull/28793#discussion_r4676559478


##########
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/CatalogManager.java:
##########
@@ -2154,6 +2154,60 @@ public void alterConnection(
         }
     }
 
+    /**
+     * Rename a connection in the given fully qualified path.
+     *
+     * @param objectIdentifier The fully qualified path of the connection to 
rename.
+     * @param newConnectionName The new connection name.
+     * @param ignoreIfNotExists If false exception will be thrown if the 
connection to be renamed
+     *     does not exist.
+     */
+    public void renameConnection(
+            ObjectIdentifier objectIdentifier,
+            String newConnectionName,
+            boolean ignoreIfNotExists) {
+        checkArgument(!StringUtils.isNullOrWhitespaceOnly(newConnectionName));
+        ObjectIdentifier newIdentifier =
+                ObjectIdentifier.of(
+                        objectIdentifier.getCatalogName(),
+                        objectIdentifier.getDatabaseName(),
+                        newConnectionName);
+        CatalogConnection temporaryConnection = 
temporaryConnections.get(objectIdentifier);
+        if (temporaryConnection != null) {
+            checkConnectionNotExists(newIdentifier);
+            temporaryConnections.remove(objectIdentifier);
+            temporaryConnections.put(newIdentifier, temporaryConnection);
+            return;
+        }
+
+        if (getConnection(objectIdentifier).isEmpty()) {
+            if (ignoreIfNotExists) {
+                return;
+            }
+            throw new ValidationException(
+                    String.format(
+                            "Connection with identifier '%s' does not exist.",
+                            objectIdentifier.asSummaryString()));
+        }
+        checkConnectionNotExists(newIdentifier);
+
+        execute(

Review Comment:
    delegates a permanent rename to the catalog that owns it



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