minihippo commented on code in PR #5064: URL: https://github.com/apache/hudi/pull/5064#discussion_r1037057329
########## hudi-metaserver/src/main/java/org/apache/hudi/metaserver/service/TableService.java: ########## @@ -0,0 +1,83 @@ +/* + * 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.hudi.metaserver.service; + +import org.apache.hudi.common.model.HoodieTableType; +import org.apache.hudi.metaserver.store.MetadataStore; +import org.apache.hudi.metaserver.thrift.AlreadyExistException; +import org.apache.hudi.metaserver.thrift.MetaException; +import org.apache.hudi.metaserver.thrift.MetaStoreException; +import org.apache.hudi.metaserver.thrift.NoSuchObjectException; +import org.apache.hudi.metaserver.thrift.Table; + +import java.io.Serializable; + +/** + * Handle all database / table related requests. + */ +public class TableService implements Serializable { + private MetadataStore store; + + public TableService(MetadataStore metadataStore) { + this.store = metadataStore; + } + + public void createDatabase(String db) throws AlreadyExistException, MetaStoreException, MetaException { + // todo: define the database entry in the thrift + if (databaseExists(db)) { + throw new AlreadyExistException("Database " + db + " already exists"); + } + if (!store.createDatabase(db)) { + throw new MetaException("Fail to create the database: " + db); Review Comment: Actually we do not make the createDB api available for client, caused by the missing of catalog. By now, considering the compatibility and user friendly, if db not exist, will create it when create a new table -- 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]
