twalthr commented on a change in pull request #11156: [FLINK-16183][table-api] Make identifier parsing in Table API more lenient URL: https://github.com/apache/flink/pull/11156#discussion_r383138082
########## File path: flink-table/flink-sql-parser/src/test/java/org/apache/flink/sql/parser/TableApiIdentifierParsingTest.java ########## @@ -0,0 +1,101 @@ +/* + * 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.sql.parser; + +import org.apache.flink.sql.parser.impl.FlinkSqlParserImpl; +import org.apache.flink.sql.parser.impl.ParseException; +import org.apache.flink.sql.parser.validate.FlinkSqlConformance; + +import org.apache.calcite.config.Lex; +import org.apache.calcite.sql.SqlIdentifier; +import org.apache.calcite.util.SourceStringReader; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +import java.util.List; + +import static java.util.Arrays.asList; +import static java.util.Collections.singletonList; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.junit.Assert.assertThat; + +/** + * Tests for parsing a Table API specific SqlIdentifier. + */ +@RunWith(Parameterized.class) +public class TableApiIdentifierParsingTest { + + @Parameterized.Parameters(name = "Parsing: {0}. Expected identifier: {1}") + public static Object[][] parameters() { + return new Object[][] { + new Object[] { + "array", + singletonList("array") + }, + + new Object[] { + "table", + singletonList("table") + }, + + new Object[] { + "cat.db.array", + asList("cat", "db", "array") + }, + + new Object[] { + "`cat.db`.table", + asList("cat.db", "table") + }, + + new Object[] { + "db.table", Review comment: Or should we remove this clause? In general, we should also test escapin, e.g. having backticks as part of the name ---------------------------------------------------------------- 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] With regards, Apache Git Services
