danny0405 commented on a change in pull request #11791: URL: https://github.com/apache/flink/pull/11791#discussion_r415274850
########## File path: flink-table/flink-sql-parser-hive/src/test/java/org/apache/flink/sql/parser/hive/FlinkHiveSqlParserImplTest.java ########## @@ -0,0 +1,118 @@ +/* + * 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.hive; + +import org.apache.flink.sql.parser.hive.impl.FlinkHiveSqlParserImpl; + +import org.apache.calcite.sql.parser.SqlParserImplFactory; +import org.apache.calcite.sql.parser.SqlParserTest; +import org.junit.Test; + +/** + * Tests for {@link FlinkHiveSqlParserImpl}. + */ +public class FlinkHiveSqlParserImplTest extends SqlParserTest { + + @Override + protected SqlParserImplFactory parserImplFactory() { + return FlinkHiveSqlParserImpl.FACTORY; + } + + // overrides test methods that we don't support + @Override + public void testDescribeStatement() { + } + + @Override + public void testTableHintsInInsert() { + } + + @Override + public void testDescribeSchema() { + } + + @Test + public void testShowDatabases() { + sql("show databases").ok("SHOW DATABASES"); + } + + @Test + public void testUseDatabase() { + // use database + sql("use db1").ok("USE `DB1`"); + } + + @Test + public void testCreateDatabase() { + sql("create database db1") + .ok("CREATE DATABASE `DB1` WITH (\n" + + " 'is_generic' = 'false'\n" + + ")"); + sql("create database db1 comment 'comment db1' location '/path/to/db1'") + .ok("CREATE DATABASE `DB1`\n" + + "COMMENT 'comment db1' WITH (\n" + + " 'is_generic' = 'false',\n" + + " 'database.location_uri' = '/path/to/db1'\n" + + ")"); + sql("create database db1 with dbproperties ('k1'='v1','k2'='v2')") + .ok("CREATE DATABASE `DB1` WITH (\n" + + " 'k1' = 'v1',\n" + + " 'k2' = 'v2',\n" + + " 'is_generic' = 'false'\n" + Review comment: Why the unparse SQL is different ? ---------------------------------------------------------------- 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: us...@infra.apache.org