yuzelin commented on code in PR #21133:
URL: https://github.com/apache/flink/pull/21133#discussion_r1022288458
##########
flink-table/flink-sql-gateway/src/test/java/org/apache/flink/table/gateway/service/SqlGatewayServiceITCase.java:
##########
@@ -157,6 +169,80 @@ public void testOpenSessionWithEnvironment() throws
Exception {
assertThat(tableEnv.listModules()).contains(moduleName);
}
+ @Test
+ public void testConfigureSessionWithLegalStatement(@TempDir
java.nio.file.Path tmpDir)
+ throws Exception {
+ SessionHandle sessionHandle =
service.openSession(defaultSessionEnvironment);
+
+ // SET & RESET
+ verifyConfigureSession(sessionHandle, "SET 'key1' = 'value1';");
+ Map<String, String> config = new HashMap<>();
+ config.put("key1", "value1");
+
assertThat(service.getSessionConfig(sessionHandle)).containsAllEntriesOf(config);
+
+ verifyConfigureSession(sessionHandle, "RESET 'key1';");
+
assertThat(service.getSessionConfig(sessionHandle)).doesNotContainEntry("key1",
"value1");
+
+ // CREATE & USE & ALTER & DROP
+ verifyConfigureSession(
+ sessionHandle,
+ "CREATE CATALOG mycat with ('type' = 'generic_in_memory',
'default-database' = 'db');");
+
+ verifyConfigureSession(sessionHandle, "USE CATALOG mycat;");
+
assertThat(service.getCurrentCatalog(sessionHandle)).isEqualTo("mycat");
Review Comment:
The `type` is used for discovering the corresponding catalog factory. Here
the `generic_in_memory` identify the `GenericInMemoryCatalogFactory`. I think
we can verify it by `mycat instance of GenericInMemoryCatalog` but the
`SqlGatewayService` doesn't expose the api to get the catalog class but only
the name string. Otherwise, creating mycat successfully means the factory has
been found, so I think it's not a problem.
Also, creating the catalog successfully means the properties in `with`
clause can pass the validation, so I think it's not necessary to check the
properties again.
--
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]