snuyanzin commented on code in PR #28387: URL: https://github.com/apache/flink/pull/28387#discussion_r3409124494
########## flink-table/flink-sql-parser/src/test/java/org/apache/flink/sql/parser/FlinkSqlParserCatalogTest.java: ########## @@ -0,0 +1,208 @@ +/* + * 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.junit.jupiter.api.Test; +import org.junit.jupiter.api.parallel.Execution; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.CsvSource; + +import java.util.Locale; + +import static org.junit.jupiter.api.parallel.ExecutionMode.CONCURRENT; + +/** Catalog and database parser tests. */ +@Execution(CONCURRENT) +class FlinkSqlParserCatalogTest extends FlinkSqlParserTestBase { + + @Test + void testShowCatalogs() { + sql("show catalogs").ok("SHOW CATALOGS"); + + sql("show catalogs like '%'").ok("SHOW CATALOGS LIKE '%'"); + sql("show catalogs not like '%'").ok("SHOW CATALOGS NOT LIKE '%'"); + + sql("show catalogs ilike '%'").ok("SHOW CATALOGS ILIKE '%'"); + sql("show catalogs not ilike '%'").ok("SHOW CATALOGS NOT ILIKE '%'"); + + sql("show catalogs ^likes^").fails("(?s).*Encountered \"likes\" at line 1, column 15.\n.*"); + sql("show catalogs not ^likes^") + .fails("(?s).*Encountered \"likes\" at line 1, column 19" + ".\n" + ".*"); + sql("show catalogs ^ilikes^") + .fails("(?s).*Encountered \"ilikes\" at line 1, column 15.\n.*"); + sql("show catalogs not ^ilikes^") + .fails("(?s).*Encountered \"ilikes\" at line 1, column 19" + ".\n" + ".*"); + } + + @Test + void testShowCurrentCatalog() { + sql("show current catalog").ok("SHOW CURRENT CATALOG"); + } + + @Test + void testDescribeCatalog() { + sql("describe catalog a").ok("DESCRIBE CATALOG `A`"); + sql("describe catalog extended a").ok("DESCRIBE CATALOG EXTENDED `A`"); + + sql("desc catalog a").ok("DESCRIBE CATALOG `A`"); + sql("desc catalog extended a").ok("DESCRIBE CATALOG EXTENDED `A`"); + } + + @Test + void testAlterCatalog() { + sql("alter catalog a set ('k1'='v1', 'k2'='v2')") + .ok("ALTER CATALOG `A` SET (\n" + " 'k1' = 'v1',\n" + " 'k2' = 'v2'\n" + ")"); + sql("alter catalog a reset ('k1')").ok("ALTER CATALOG `A` RESET (\n" + " 'k1'\n" + ")"); + sql("alter catalog a comment 'comment1'").ok("ALTER CATALOG `A` COMMENT 'comment1'"); + } + + // END Review Comment: what is this about? -- 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]
