private boolean assertDatabaseNoExistence(VerificationState state, String name) { if (catalog.existDatabase(name)) { state.addVerification(new DuplicateDatabaseException(name)); return false; } return true; }
private boolean assertDatabaseNoExistence(VerificationState state, String name) { if (catalog.existDatabase(name)) { state.addVerification(new DuplicateDatabaseException(name)); return false; } return true; }
throw new DuplicateDatabaseException(databaseName);
throw new DuplicateDatabaseException(databaseName);
@Override public void createDatabase(String databaseName, String tablespaceName) throws DuplicateDatabaseException { HiveCatalogStoreClientPool.HiveCatalogStoreClient client = null; try { Database database = new Database( databaseName, "", defaultTableSpaceUri + "/" + databaseName, new HashMap<>()); client = clientPool.getClient(); client.getHiveClient().createDatabase(database); } catch (AlreadyExistsException e) { throw new DuplicateDatabaseException(databaseName); } catch (Throwable t) { throw new TajoInternalError(t); } finally { if (client != null) { client.release(); } } }
public void createDatabase(@Nullable QueryContext queryContext, String databaseName, @Nullable String tablespace, boolean ifNotExists) throws IOException, DuplicateDatabaseException { String tablespaceName; if (tablespace == null) { tablespaceName = DEFAULT_TABLESPACE_NAME; } else { tablespaceName = tablespace; } // CREATE DATABASE IF NOT EXISTS boolean exists = catalog.existDatabase(databaseName); if (exists) { if (ifNotExists) { LOG.info("database \"" + databaseName + "\" is already exists."); return; } else { throw new DuplicateDatabaseException(databaseName); } } String normalized = databaseName; Path databaseDir = StorageUtil.concatPath(context.getConf().getVar(TajoConf.ConfVars.WAREHOUSE_DIR), normalized); FileSystem fs = databaseDir.getFileSystem(context.getConf()); fs.mkdirs(databaseDir); catalog.createDatabase(databaseName, tablespaceName); LOG.info("database \"" + databaseName + "\" created."); }
public void createDatabase(@Nullable QueryContext queryContext, String databaseName, @Nullable String tablespace, boolean ifNotExists) throws IOException, DuplicateDatabaseException { String tablespaceName; if (tablespace == null) { tablespaceName = DEFAULT_TABLESPACE_NAME; } else { tablespaceName = tablespace; } // CREATE DATABASE IF NOT EXISTS boolean exists = catalog.existDatabase(databaseName); if (exists) { if (ifNotExists) { LOG.info("database \"" + databaseName + "\" is already exists."); return; } else { throw new DuplicateDatabaseException(databaseName); } } String normalized = databaseName; Path databaseDir = StorageUtil.concatPath(context.getConf().getVar(TajoConf.ConfVars.WAREHOUSE_DIR), normalized); FileSystem fs = databaseDir.getFileSystem(context.getConf()); fs.mkdirs(databaseDir); catalog.createDatabase(databaseName, tablespaceName); LOG.info("database \"" + databaseName + "\" created."); }