-
Notifications
You must be signed in to change notification settings - Fork 14k
[FLINK-38262][table] alter connection rename operation #28793
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Shekharrajak
wants to merge
4
commits into
apache:master
Choose a base branch
from
Shekharrajak:FLINK-38262-alter-connection-rename-operation
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+365
−0
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
1fdc876
[FLINK-38262][table] Add ALTER CONNECTION RENAME operation
Shekharrajak 453ab76
Update flink-table/flink-table-api-java/src/main/java/org/apache/flin…
Shekharrajak acaf5c8
Update flink-table/flink-table-api-java/src/main/java/org/apache/flin…
Shekharrajak 390042e
[FLINK-38262][table] Fix renameConnection structure and address revie…
Shekharrajak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
...a/src/main/java/org/apache/flink/table/operations/ddl/AlterConnectionRenameOperation.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.flink.table.operations.ddl; | ||
|
|
||
| import org.apache.flink.annotation.Internal; | ||
| import org.apache.flink.table.api.internal.TableResultImpl; | ||
| import org.apache.flink.table.api.internal.TableResultInternal; | ||
| import org.apache.flink.table.catalog.ObjectIdentifier; | ||
|
|
||
| /** Operation for ALTER CONNECTION .. RENAME TO .. statements. */ | ||
| @Internal | ||
| public class AlterConnectionRenameOperation implements AlterOperation { | ||
|
|
||
| private final ObjectIdentifier connectionIdentifier; | ||
| private final String newConnectionName; | ||
| private final boolean ignoreIfNotExists; | ||
|
|
||
| public AlterConnectionRenameOperation( | ||
| ObjectIdentifier connectionIdentifier, | ||
| String newConnectionName, | ||
| boolean ignoreIfNotExists) { | ||
| this.connectionIdentifier = connectionIdentifier; | ||
| this.newConnectionName = newConnectionName; | ||
| this.ignoreIfNotExists = ignoreIfNotExists; | ||
| } | ||
|
|
||
| public ObjectIdentifier getConnectionIdentifier() { | ||
| return connectionIdentifier; | ||
| } | ||
|
|
||
| public String getNewConnectionName() { | ||
| return newConnectionName; | ||
| } | ||
|
|
||
| public boolean ignoreIfNotExists() { | ||
| return ignoreIfNotExists; | ||
| } | ||
|
|
||
| @Override | ||
| public String asSummaryString() { | ||
| return String.format( | ||
| "ALTER CONNECTION %s%s RENAME TO %s", | ||
| ignoreIfNotExists ? "IF EXISTS " : "", | ||
| connectionIdentifier.asSummaryString(), | ||
| newConnectionName); | ||
| } | ||
|
|
||
| @Override | ||
| public TableResultInternal execute(Context ctx) { | ||
| ctx.getCatalogManager() | ||
| .renameConnection(connectionIdentifier, newConnectionName, ignoreIfNotExists); | ||
| return TableResultImpl.TABLE_RESULT_OK; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...g/apache/flink/table/planner/operations/converters/SqlAlterConnectionRenameConverter.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.flink.table.planner.operations.converters; | ||
|
|
||
| import org.apache.flink.sql.parser.ddl.connection.SqlAlterConnectionRename; | ||
| import org.apache.flink.table.catalog.ObjectIdentifier; | ||
| import org.apache.flink.table.catalog.UnresolvedIdentifier; | ||
| import org.apache.flink.table.operations.Operation; | ||
| import org.apache.flink.table.operations.ddl.AlterConnectionRenameOperation; | ||
|
|
||
| /** A converter for {@link SqlAlterConnectionRename}. */ | ||
| public class SqlAlterConnectionRenameConverter | ||
| implements SqlNodeConverter<SqlAlterConnectionRename> { | ||
|
|
||
| @Override | ||
| public Operation convertSqlNode( | ||
| SqlAlterConnectionRename sqlAlterConnectionRename, ConvertContext context) { | ||
| ObjectIdentifier connectionIdentifier = | ||
| context.getCatalogManager() | ||
| .qualifyIdentifier( | ||
| UnresolvedIdentifier.of(sqlAlterConnectionRename.getFullName())); | ||
|
|
||
| return new AlterConnectionRenameOperation( | ||
| connectionIdentifier, | ||
| sqlAlterConnectionRename.getNewConnectionName().getSimple(), | ||
| sqlAlterConnectionRename.ifConnectionExists()); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the community aligned with adding this to the public API? I haven't seen a Mailing Thread or FLIP on this. Maybe I have missed it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moreover, in the PR description you mentioned:
Which is not the case here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes this is part of FLIP https://cwiki.apache.org/confluence/spaces/FLINK/pages/350784113/FLIP-529+Connections+in+Flink+SQL+and+TableAPI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://cwiki.apache.org/confluence/spaces/FLINK/pages/350784113/FLIP-529+Connections+in+Flink+SQL+and+TableAPI#FLIP529%3AConnectionsinFlinkSQLandTableAPI-EnhancedCatalogInterface