You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Shekharrajak (via GitHub)" <gi...@apache.org> on 2026/07/21 17:05:50 UTC
[PR] [FLINK-38262][table] show connections operation [flink]
Shekharrajak opened a new pull request, #28790:
URL: https://github.com/apache/flink/pull/28790
## What is the purpose of the change
Adds ShowConnectionsOperation and converter support for SHOW CONNECTIONS, including catalog/database qualification and LIKE filtering.
Ref https://issues.apache.org/jira/browse/FLINK-38262
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-38262][table] show connections operation [flink]
Posted by "Shekharrajak (via GitHub)" <gi...@apache.org>.
Shekharrajak commented on code in PR #28790:
URL: https://github.com/apache/flink/pull/28790#discussion_r4178188649
##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/common/sql/ConnectionITCase.java:
##########
@@ -73,10 +78,35 @@ void testCreatePermanentConnectionRejectedWithoutSecretStore() {
.hasMessageContaining("WritableSecretStore must be configured");
}
+ @Test
+ void testShowConnections() {
+ tEnv().executeSql("CREATE TEMPORARY CONNECTION b_conn WITH ('k' = 'v')");
+ tEnv().executeSql("CREATE TEMPORARY CONNECTION a_conn WITH ('k' = 'v')");
+
+ assertThat(collectRows("SHOW CONNECTIONS"))
Review Comment:
added testShowConnectionsInDatabase https://github.com/apache/flink/pull/28790/changes/a7bdcc1f5e236de0f4ec7ed29b3d6e75f0c665ed
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-38262][table] show connections operation [flink]
Posted by "lihaosky (via GitHub)" <gi...@apache.org>.
lihaosky commented on code in PR #28790:
URL: https://github.com/apache/flink/pull/28790#discussion_r3708227031
##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/batch/sql/CreateConnectionITCase.java:
##########
@@ -73,10 +78,35 @@ void testCreatePermanentConnectionRejectedWithoutSecretStore() {
.hasMessageContaining("WritableSecretStore must be configured");
}
+ @Test
+ void testShowConnections() {
+ tEnv().executeSql("CREATE TEMPORARY CONNECTION b_conn WITH ('k' = 'v')");
+ tEnv().executeSql("CREATE TEMPORARY CONNECTION a_conn WITH ('k' = 'v')");
+
+ assertThat(collectRows("SHOW CONNECTIONS"))
Review Comment:
Please also add some test around `show connections in/from db`
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-38262][table] show connections operation [flink]
Posted by "Shekharrajak (via GitHub)" <gi...@apache.org>.
Shekharrajak commented on code in PR #28790:
URL: https://github.com/apache/flink/pull/28790#discussion_r3667428474
##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/operations/SqlConnectionOperationConverterTest.java:
##########
@@ -121,4 +124,45 @@ void testCreateConnectionWithEmptyOptionsRejected() {
.isInstanceOf(SqlValidateException.class)
.hasMessageContaining("Connection property list can not be empty.");
}
+
+ @Test
+ void testShowConnections() {
+ Operation operation = parse("SHOW CONNECTIONS");
+ assertThat(operation).isInstanceOf(ShowConnectionsOperation.class);
+ assertThat(operation.asSummaryString()).isEqualTo("SHOW CONNECTIONS");
+ }
+
+ @Test
+ void testShowConnectionsWithDatabase() {
+ Operation operation = parse("SHOW CONNECTIONS FROM db1");
+ assertThat(operation).isInstanceOf(ShowConnectionsOperation.class);
+ assertThat(operation.asSummaryString()).isEqualTo("SHOW CONNECTIONS FROM builtin.db1");
+ }
+
+ @Test
+ void testShowConnectionsWithCatalogAndDatabase() {
+ Operation operation = parse("SHOW CONNECTIONS IN cat1.db1");
+ assertThat(operation).isInstanceOf(ShowConnectionsOperation.class);
+ assertThat(operation.asSummaryString()).isEqualTo("SHOW CONNECTIONS IN cat1.db1");
+ }
+
+ @Test
+ void testShowConnectionsLike() {
+ Operation operation = parse("SHOW CONNECTIONS LIKE '%conn%'");
+ assertThat(operation).isInstanceOf(ShowConnectionsOperation.class);
+ assertThat(operation.asSummaryString()).isEqualTo("SHOW CONNECTIONS LIKE '%conn%'");
+ }
Review Comment:
Thanks updated https://github.com/apache/flink/pull/28790/changes/e2484881683822ba371ad63e91caca0b3a6883cf
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-38262][table] show connections operation [flink]
Posted by "Shekharrajak (via GitHub)" <gi...@apache.org>.
Shekharrajak commented on PR #28790:
URL: https://github.com/apache/flink/pull/28790#issuecomment-5981404255
@flinkbot run azure
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-38262][table] show connections operation [flink]
Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin commented on code in PR #28790:
URL: https://github.com/apache/flink/pull/28790#discussion_r4178202043
##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/operations/converters/SqlNodeConverters.java:
##########
@@ -141,6 +141,7 @@ private static void registerCatalogConverters() {
private static void registerConnectionConverters() {
register(new SqlCreateConnectionConverter());
+ register(new SqlShowConnectionsConverter());
Review Comment:
please follow order style
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-38262][table] show connections operation [flink]
Posted by "raminqaf (via GitHub)" <gi...@apache.org>.
raminqaf commented on code in PR #28790:
URL: https://github.com/apache/flink/pull/28790#discussion_r3654966827
##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/operations/SqlConnectionOperationConverterTest.java:
##########
@@ -121,4 +124,45 @@ void testCreateConnectionWithEmptyOptionsRejected() {
.isInstanceOf(SqlValidateException.class)
.hasMessageContaining("Connection property list can not be empty.");
}
+
+ @Test
+ void testShowConnections() {
+ Operation operation = parse("SHOW CONNECTIONS");
+ assertThat(operation).isInstanceOf(ShowConnectionsOperation.class);
+ assertThat(operation.asSummaryString()).isEqualTo("SHOW CONNECTIONS");
+ }
+
+ @Test
+ void testShowConnectionsWithDatabase() {
+ Operation operation = parse("SHOW CONNECTIONS FROM db1");
+ assertThat(operation).isInstanceOf(ShowConnectionsOperation.class);
+ assertThat(operation.asSummaryString()).isEqualTo("SHOW CONNECTIONS FROM builtin.db1");
+ }
+
+ @Test
+ void testShowConnectionsWithCatalogAndDatabase() {
+ Operation operation = parse("SHOW CONNECTIONS IN cat1.db1");
+ assertThat(operation).isInstanceOf(ShowConnectionsOperation.class);
+ assertThat(operation.asSummaryString()).isEqualTo("SHOW CONNECTIONS IN cat1.db1");
+ }
+
+ @Test
+ void testShowConnectionsLike() {
+ Operation operation = parse("SHOW CONNECTIONS LIKE '%conn%'");
+ assertThat(operation).isInstanceOf(ShowConnectionsOperation.class);
+ assertThat(operation.asSummaryString()).isEqualTo("SHOW CONNECTIONS LIKE '%conn%'");
+ }
Review Comment:
How about we convert these into a single parametized test. WDYT?
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-38262][table] show connections operation [flink]
Posted by "Shekharrajak (via GitHub)" <gi...@apache.org>.
Shekharrajak commented on PR #28790:
URL: https://github.com/apache/flink/pull/28790#issuecomment-6438863872
@flinkbot run azure
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-38262][table] show connections operation [flink]
Posted by "lihaosky (via GitHub) via issues" <is...@flink.apache.org>.
lihaosky commented on code in PR #28790:
URL: https://github.com/apache/flink/pull/28790#discussion_r4517268635
##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/common/sql/ConnectionITCase.java:
##########
@@ -38,14 +47,34 @@
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.assertj.core.api.Assertions.entry;
-/** IT case for CREATE CONNECTION statement. */
-class CreateConnectionITCase extends BatchTestBase {
+/** IT cases for connection statements. */
+@ExtendWith(ParameterizedTestExtension.class)
+class ConnectionITCase {
Review Comment:
**[blocking]** This fails `ITCASE_USE_MINICLUSTER`. The rename dropped `extends BatchTestBase`, which registered the MiniCluster. `SinkReuseITCase` in this package extends `AbstractTestBase`:
```suggestion
class ConnectionITCase extends AbstractTestBase {
```
(plus `import org.apache.flink.test.util.AbstractTestBase;`). Please confirm the ITCases pass in both modes afterwards.
##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/common/sql/ConnectionITCase.java:
##########
@@ -38,14 +47,34 @@
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.assertj.core.api.Assertions.entry;
-/** IT case for CREATE CONNECTION statement. */
-class CreateConnectionITCase extends BatchTestBase {
+/** IT cases for connection statements. */
+@ExtendWith(ParameterizedTestExtension.class)
+class ConnectionITCase {
- @Test
+ @Parameter public boolean isBatch;
+
+ @Parameters(name = "isBatch: {0}")
+ public static List<Boolean> parameters() {
+ return List.of(true, false);
+ }
+
+ private TableEnvironment tEnv;
+
+ @BeforeEach
+ void setup() {
+ tEnv =
+ TestingTableEnvironment.create(
+ isBatch
+ ? EnvironmentSettings.inBatchMode()
+ : EnvironmentSettings.inStreamingMode(),
+ null,
+ TableConfig.getDefault());
+ }
+
+ @TestTemplate
void testCreateTemporaryConnection() {
- tEnv().executeSql(
- "CREATE TEMPORARY CONNECTION my_conn COMMENT 'hi there' "
- + "WITH ('k' = 'v')");
+ tEnv.executeSql(
+ "CREATE TEMPORARY CONNECTION my_conn COMMENT 'hi there' " + "WITH ('k' = 'v')");
Review Comment:
**[nit]** Leftover concatenation from the reformat. It fits on one line:
```suggestion
tEnv.executeSql("CREATE TEMPORARY CONNECTION my_conn COMMENT 'hi there' WITH ('k' = 'v')");
```
##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/common/sql/ConnectionITCase.java:
##########
@@ -161,12 +190,69 @@ void testShowCreateSecretOnlyTemporaryConnection() {
.containsOnly(entry("type", "default")));
}
- @Test
- void testDescribeTemporaryConnection() {
- tEnv().executeSql(
- "CREATE TEMPORARY CONNECTION my_conn COMMENT 'hi there' "
- + "WITH ('type' = 'default', 'k' = 'v', 'comment' = 'option comment', "
- + "'password' = 'super-secret')");
+ @TestTemplate
+ void testShowConnections() throws Exception {
+ ObjectIdentifier identifier = connectionIdentifier("permanent_conn");
+ catalogManager()
+ .getCatalog(identifier.getCatalogName())
+ .orElseThrow()
+ .createConnection(
+ identifier.toObjectPath(),
+ CatalogConnection.of(Map.of("k", "v"), null),
+ false);
+ tEnv.executeSql("CREATE TEMPORARY CONNECTION b_conn WITH ('k' = 'v')");
+ tEnv.executeSql("CREATE TEMPORARY CONNECTION a_conn WITH ('k' = 'v')");
+
+ assertThat(collectRows("SHOW CONNECTIONS"))
+ .containsExactly(Row.of("a_conn"), Row.of("b_conn"), Row.of("permanent_conn"));
+ assertThat(collectRows("SHOW CONNECTIONS FROM " + identifier.getDatabaseName()))
+ .containsExactly(Row.of("a_conn"), Row.of("b_conn"), Row.of("permanent_conn"));
+ }
+
+ @TestTemplate
+ void testShowConnectionsInDatabase() throws Exception {
Review Comment:
**[suggestion]** Could we cover the error paths too?
- `SHOW CONNECTIONS FROM missing_db`
- `SHOW CONNECTIONS IN missing_cat.db`: from reading the code, this surfaces a raw `CatalogNotExistException`, not the `ValidationException` that `SHOW MODELS` gives. I haven't run it. If that's right, worth aligning.
- `SHOW CONNECTIONS FROM a.b.c` (the converter's format error)
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-38262][table] show connections operation [flink]
Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin commented on code in PR #28790:
URL: https://github.com/apache/flink/pull/28790#discussion_r3667930603
##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/batch/sql/CreateConnectionITCase.java:
##########
@@ -73,10 +78,35 @@ void testCreatePermanentConnectionRejectedWithoutSecretStore() {
.hasMessageContaining("WritableSecretStore must be configured");
}
+ @Test
+ void testShowConnections() {
+ tEnv().executeSql("CREATE TEMPORARY CONNECTION b_conn WITH ('k' = 'v')");
+ tEnv().executeSql("CREATE TEMPORARY CONNECTION a_conn WITH ('k' = 'v')");
+
+ assertThat(collectRows("SHOW CONNECTIONS"))
+ .containsExactly(Row.of("a_conn"), Row.of("b_conn"));
+ }
+
+ @Test
+ void testShowConnectionsLike() {
+ tEnv().executeSql("CREATE TEMPORARY CONNECTION prod_conn WITH ('k' = 'v')");
+ tEnv().executeSql("CREATE TEMPORARY CONNECTION tmp_conn WITH ('k' = 'v')");
+
+ assertThat(collectRows("SHOW CONNECTIONS LIKE 'prod_%'"))
+ .containsExactly(Row.of("prod_conn"));
+ assertThat(collectRows("SHOW CONNECTIONS NOT LIKE 'prod_%'"))
+ .containsExactly(Row.of("tmp_conn"));
+ }
+
private CatalogManager catalogManager() {
return ((TableEnvironmentInternal) tEnv()).getCatalogManager();
}
+ private List<Row> collectRows(String sql) {
+ TableResult result = tEnv().executeSql(sql);
+ return CollectionUtil.iteratorToList(result.collect());
Review Comment:
if you look at javadoc of this method it does not match recommended way to call 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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-38262][table] show connections operation [flink]
Posted by "Shekharrajak (via GitHub)" <gi...@apache.org>.
Shekharrajak commented on code in PR #28790:
URL: https://github.com/apache/flink/pull/28790#discussion_r4178162204
##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/common/sql/ConnectionITCase.java:
##########
@@ -73,10 +78,35 @@ void testCreatePermanentConnectionRejectedWithoutSecretStore() {
.hasMessageContaining("WritableSecretStore must be configured");
}
+ @Test
+ void testShowConnections() {
+ tEnv().executeSql("CREATE TEMPORARY CONNECTION b_conn WITH ('k' = 'v')");
+ tEnv().executeSql("CREATE TEMPORARY CONNECTION a_conn WITH ('k' = 'v')");
+
+ assertThat(collectRows("SHOW CONNECTIONS"))
+ .containsExactly(Row.of("a_conn"), Row.of("b_conn"));
+ }
+
+ @Test
+ void testShowConnectionsLike() {
+ tEnv().executeSql("CREATE TEMPORARY CONNECTION prod_conn WITH ('k' = 'v')");
+ tEnv().executeSql("CREATE TEMPORARY CONNECTION tmp_conn WITH ('k' = 'v')");
+
+ assertThat(collectRows("SHOW CONNECTIONS LIKE 'prod_%'"))
+ .containsExactly(Row.of("prod_conn"));
+ assertThat(collectRows("SHOW CONNECTIONS NOT LIKE 'prod_%'"))
+ .containsExactly(Row.of("tmp_conn"));
+ }
Review Comment:
clubbed to single test https://github.com/apache/flink/pull/28790/changes/c8eabae6d5a879b398704b073c0aa46de27ee077
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-38262][table] show connections operation [flink]
Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin commented on code in PR #28790:
URL: https://github.com/apache/flink/pull/28790#discussion_r3667451420
##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/batch/sql/CreateConnectionITCase.java:
##########
@@ -73,10 +78,35 @@ void testCreatePermanentConnectionRejectedWithoutSecretStore() {
.hasMessageContaining("WritableSecretStore must be configured");
}
+ @Test
+ void testShowConnections() {
+ tEnv().executeSql("CREATE TEMPORARY CONNECTION b_conn WITH ('k' = 'v')");
+ tEnv().executeSql("CREATE TEMPORARY CONNECTION a_conn WITH ('k' = 'v')");
+
+ assertThat(collectRows("SHOW CONNECTIONS"))
+ .containsExactly(Row.of("a_conn"), Row.of("b_conn"));
+ }
+
+ @Test
+ void testShowConnectionsLike() {
+ tEnv().executeSql("CREATE TEMPORARY CONNECTION prod_conn WITH ('k' = 'v')");
+ tEnv().executeSql("CREATE TEMPORARY CONNECTION tmp_conn WITH ('k' = 'v')");
+
+ assertThat(collectRows("SHOW CONNECTIONS LIKE 'prod_%'"))
+ .containsExactly(Row.of("prod_conn"));
+ assertThat(collectRows("SHOW CONNECTIONS NOT LIKE 'prod_%'"))
+ .containsExactly(Row.of("tmp_conn"));
+ }
Review Comment:
why do we need 2 separate tests?
why same can't be done in one?
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-38262][table] show connections operation [flink]
Posted by "Shekharrajak (via GitHub)" <gi...@apache.org>.
Shekharrajak commented on code in PR #28790:
URL: https://github.com/apache/flink/pull/28790#discussion_r4178336663
##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/operations/converters/SqlNodeConverters.java:
##########
@@ -141,6 +141,7 @@ private static void registerCatalogConverters() {
private static void registerConnectionConverters() {
register(new SqlCreateConnectionConverter());
+ register(new SqlShowConnectionsConverter());
Review Comment:
updated https://github.com/apache/flink/pull/28790/changes/721dbcbc2be294d3258dc0fb70089ed49ac87779
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-38262][table] show connections operation [flink]
Posted by "flinkbot (via GitHub)" <gi...@apache.org>.
flinkbot commented on PR #28790:
URL: https://github.com/apache/flink/pull/28790#issuecomment-5036902016
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "f0455b59a63cb4ebb007f46db43727522cf51768",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "f0455b59a63cb4ebb007f46db43727522cf51768",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* f0455b59a63cb4ebb007f46db43727522cf51768 UNKNOWN
<details>
<summary>Bot commands</summary>
The @flinkbot bot supports the following commands:
- `@flinkbot run azure` re-run the last Azure build
</details>
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-38262][table] show connections operation [flink]
Posted by "Shekharrajak (via GitHub)" <gi...@apache.org>.
Shekharrajak commented on PR #28790:
URL: https://github.com/apache/flink/pull/28790#issuecomment-5106949823
@flinkbot run azure
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-38262][table] show connections operation [flink]
Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin commented on code in PR #28790:
URL: https://github.com/apache/flink/pull/28790#discussion_r3667890774
##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/operations/converters/SqlShowConnectionsConverter.java:
##########
@@ -0,0 +1,54 @@
+/*
+ * 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.dql.SqlShowConnections;
+import org.apache.flink.table.operations.Operation;
+import org.apache.flink.table.operations.ShowConnectionsOperation;
+import org.apache.flink.table.operations.utils.ShowLikeOperator;
+
+import javax.annotation.Nullable;
+
+/** A converter for {@link SqlShowConnections}. */
+public class SqlShowConnectionsConverter extends AbstractSqlShowConverter<SqlShowConnections> {
+
+ @Override
+ public Operation getOperationWithoutPrep(
+ SqlShowConnections sqlShowCall,
+ @Nullable String catalogName,
+ @Nullable String databaseName,
+ @Nullable ShowLikeOperator likeOp) {
+ return new ShowConnectionsOperation(catalogName, databaseName, likeOp);
+ }
+
+ @Override
+ public Operation getOperation(
+ SqlShowConnections sqlShowCall,
+ @Nullable String catalogName,
+ @Nullable String databaseName,
+ String prep,
Review Comment:
why it is not nullable?
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-38262][table] show connections operation [flink]
Posted by "Shekharrajak (via GitHub)" <gi...@apache.org>.
Shekharrajak commented on code in PR #28790:
URL: https://github.com/apache/flink/pull/28790#discussion_r4178155459
##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/operations/converters/SqlShowConnectionsConverter.java:
##########
@@ -0,0 +1,54 @@
+/*
+ * 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.dql.SqlShowConnections;
+import org.apache.flink.table.operations.Operation;
+import org.apache.flink.table.operations.ShowConnectionsOperation;
+import org.apache.flink.table.operations.utils.ShowLikeOperator;
+
+import javax.annotation.Nullable;
+
+/** A converter for {@link SqlShowConnections}. */
+public class SqlShowConnectionsConverter extends AbstractSqlShowConverter<SqlShowConnections> {
+
+ @Override
+ public Operation getOperationWithoutPrep(
+ SqlShowConnections sqlShowCall,
+ @Nullable String catalogName,
+ @Nullable String databaseName,
+ @Nullable ShowLikeOperator likeOp) {
+ return new ShowConnectionsOperation(catalogName, databaseName, likeOp);
+ }
+
+ @Override
+ public Operation getOperation(
+ SqlShowConnections sqlShowCall,
+ @Nullable String catalogName,
+ @Nullable String databaseName,
+ String prep,
Review Comment:
Added `@Nullable` for consistency.
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-38262][table] show connections operation [flink]
Posted by "Shekharrajak (via GitHub)" <gi...@apache.org>.
Shekharrajak commented on code in PR #28790:
URL: https://github.com/apache/flink/pull/28790#discussion_r4178180446
##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/common/sql/ConnectionITCase.java:
##########
@@ -73,10 +78,35 @@ void testCreatePermanentConnectionRejectedWithoutSecretStore() {
.hasMessageContaining("WritableSecretStore must be configured");
}
+ @Test
+ void testShowConnections() {
+ tEnv().executeSql("CREATE TEMPORARY CONNECTION b_conn WITH ('k' = 'v')");
+ tEnv().executeSql("CREATE TEMPORARY CONNECTION a_conn WITH ('k' = 'v')");
+
+ assertThat(collectRows("SHOW CONNECTIONS"))
+ .containsExactly(Row.of("a_conn"), Row.of("b_conn"));
+ }
+
+ @Test
+ void testShowConnectionsLike() {
+ tEnv().executeSql("CREATE TEMPORARY CONNECTION prod_conn WITH ('k' = 'v')");
+ tEnv().executeSql("CREATE TEMPORARY CONNECTION tmp_conn WITH ('k' = 'v')");
+
+ assertThat(collectRows("SHOW CONNECTIONS LIKE 'prod_%'"))
+ .containsExactly(Row.of("prod_conn"));
+ assertThat(collectRows("SHOW CONNECTIONS NOT LIKE 'prod_%'"))
+ .containsExactly(Row.of("tmp_conn"));
+ }
+
private CatalogManager catalogManager() {
return ((TableEnvironmentInternal) tEnv()).getCatalogManager();
}
+ private List<Row> collectRows(String sql) {
+ TableResult result = tEnv().executeSql(sql);
+ return CollectionUtil.iteratorToList(result.collect());
Review Comment:
updated to
```
try (CloseableIterator<Row> rows = result.collect()) {
```
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-38262][table] show connections operation [flink]
Posted by "Shekharrajak (via GitHub)" <gi...@apache.org>.
Shekharrajak commented on PR #28790:
URL: https://github.com/apache/flink/pull/28790#issuecomment-6012747037
@flinkbot run azure
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org