sunzheng1002 commented on a change in pull request #14725:
URL: https://github.com/apache/flink/pull/14725#discussion_r583348982
##########
File path:
flink-table/flink-sql-client/src/test/java/org/apache/flink/table/client/cli/CliClientTest.java
##########
@@ -257,6 +257,39 @@ public void testUseDatabaseAndShowCurrentDatabase() throws
Exception {
assertTrue(output.contains("db"));
}
+ @Test
+ public void testUseDatabaseAndShowCurrentDatabaseByKeyword() throws
Exception {
+ TestingExecutor executor =
+ new TestingExecutorBuilder()
+ .setExecuteSqlConsumer(
+ (ignored1, sql) -> {
+ if (sql.toLowerCase().equals("use `mod`"))
{
+ return TestTableResult.TABLE_RESULT_OK;
+ } else if (sql.toLowerCase().equals("show
current database")) {
+ SHOW_ROW.setField(0, "`mod`");
+ return new TestTableResult(
+
ResultKind.SUCCESS_WITH_CONTENT,
+ TableSchema.builder()
+ .field(
+ "current
database name",
+
DataTypes.STRING())
+ .build(),
+
CloseableIterator.ofElement(SHOW_ROW, ele -> {}));
+ } else {
+ throw new SqlExecutionException(
+ "unexpected database name:
db");
+ }
+ })
+ .build();
+ String output = testExecuteSql(executor, "use `mod`;");
+ assertThat(executor.getNumExecuteSqlCalls(), is(1));
+ assertFalse(output.contains("unexpected database name"));
Review comment:
Test class modification and execution pass, use "git rebase" to submit
the code
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]