danny0405 commented on a change in pull request #12188: URL: https://github.com/apache/flink/pull/12188#discussion_r426338099
########## File path: flink-table/flink-sql-client/src/test/java/org/apache/flink/table/client/cli/utils/SqlParserHelper.java ########## @@ -0,0 +1,55 @@ +/* + * 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.client.cli.utils; + +import org.apache.flink.table.api.EnvironmentSettings; +import org.apache.flink.table.api.TableEnvironment; +import org.apache.flink.table.api.internal.TableEnvironmentInternal; +import org.apache.flink.table.delegation.Parser; + +/** + * An utility class that provides pre-prepared tables and sql parser. + */ +public class SqlParserHelper { + // return the sql parser instance hold by this table evn. + private final TableEnvironment tableEnv; + + public SqlParserHelper() { + tableEnv = TableEnvironment.create(EnvironmentSettings.newInstance().build()); + } + + /** + * prepare some tables for testing. + */ + public void registerTables() { + tableEnv.executeSql("create table MyTable (a int, b bigint, c varchar(32)) " + + "with ('connector' = 'filesystem', 'path' = '/non')"); Review comment: Can invoke `registerTable(String createTableStmt)` instead. ########## File path: flink-table/flink-sql-client/src/test/java/org/apache/flink/table/client/cli/CliClientTest.java ########## @@ -90,9 +92,9 @@ public void testFailedUpdateSubmission() throws Exception { @Test public void testSqlCompletion() throws IOException { - verifySqlCompletion("", 0, Arrays.asList("SELECT", "QUIT;", "RESET;"), Collections.emptyList()); - verifySqlCompletion("SELEC", 5, Collections.singletonList("SELECT"), Collections.singletonList("QUIT;")); - verifySqlCompletion("SELE", 0, Collections.singletonList("SELECT"), Collections.singletonList("QUIT;")); + verifySqlCompletion("", 0, Arrays.asList("SOURCE", "QUIT;", "RESET;"), Collections.emptyList()); Review comment: Why drop the `SELEC` completion test ? ---------------------------------------------------------------- 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]
