bowenli86 commented on a change in pull request #7643: [FLINK-11474][table] Add 
ReadableCatalog, ReadableWritableCatalog, and other …
URL: https://github.com/apache/flink/pull/7643#discussion_r253673128
 
 

 ##########
 File path: 
flink-libraries/flink-table/src/main/java/org/apache/flink/table/api/catalog/ReadableWritableCatalog.java
 ##########
 @@ -0,0 +1,175 @@
+/*
+ * 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.api.catalog;
+
+import org.apache.flink.table.api.TableAlreadyExistException;
+import org.apache.flink.table.api.TableNotExistException;
+import 
org.apache.flink.table.api.catalog.exceptions.DatabaseAlreadyExistException;
+import org.apache.flink.table.api.catalog.exceptions.DatabaseNotExistException;
+import org.apache.flink.table.plan.stats.TableStats;
+
+/**
+ * An interface responsible for manipulating catalog metadata.
+ */
+public interface ReadableWritableCatalog extends ReadableCatalog {
+
+       // ------ databases ------
+
+       /**
+        * Adds a database to this catalog.
+        *
+        * @param dbName        The name of the database to add.
+        * @param database        The database to add.
+        * @param ignoreIfExists Flag to specify behavior if a database with 
the given name already
+        *                       exists: if set to false, it throws a 
DatabaseAlreadyExistException,
+        *                       if set to true, nothing happens.
+        * @throws DatabaseAlreadyExistException
+        *                       thrown if the database does already exist in 
the catalog
+        *                       and ignoreIfExists is false
+        */
+       void createDatabase(String dbName, CatalogDatabase database, boolean 
ignoreIfExists)
+               throws DatabaseAlreadyExistException;
+
+       /**
+        * Deletes a database from this catalog.
+        *
+        * @param dbName        Name of the database to delete.
+        * @param ignoreIfNotExists Flag to specify behavior if the database 
does not exist:
+        *                          if set to false, throw an exception,
+        *                          if set to true, nothing happens.
+        * @throws DatabaseNotExistException thrown if the database does not 
exist in the catalog
+        */
+       void dropDatabase(String dbName, boolean ignoreIfNotExists) throws 
DatabaseNotExistException;
+
+       /**
+        * Modifies an existing database.
+        *
+        * @param dbName        Name of the database to modify.
+        * @param newDatabase           The new database to replace the 
existing database.
+        * @param ignoreIfNotExists Flag to specify behavior if the database 
does not exist:
+        *                          if set to false, throw an exception,
+        *                          if set to true, nothing happens.
+        * @throws DatabaseNotExistException thrown if the database does not 
exist in the catalog
+        */
+       void alterDatabase(String dbName, CatalogDatabase newDatabase, boolean 
ignoreIfNotExists)
+               throws DatabaseNotExistException;
+
+       /**
+        * Renames an existing database.
+        *
+        * @param dbName        Name of the database to modify.
+        * @param newDbName     New name of the database.
+        * @param ignoreIfNotExists Flag to specify behavior if the database 
does not exist:
+        *                          if set to false, throw an exception,
+        *                          if set to true, nothing happens.
+        * @throws DatabaseNotExistException thrown if the database does not 
exist in the catalog
+        */
+       void renameDatabase(String dbName, String newDbName, boolean 
ignoreIfNotExists)
 
 Review comment:
   does it need to throw a 'DatabaseAlreadyExistsException' when the 
'newDbName' is already taken?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


With regards,
Apache Git Services

Reply via email to