Database toHiveDb() { Database hiveDB = new Database(); hiveDB.setDescription(this.comment); hiveDB.setLocationUri(this.locationUri); hiveDB.setName(this.dbName); hiveDB.setParameters(this.dbProperties); return hiveDB; }
db.setName(MetastoreDirectSqlUtils.extractSqlString(dbline[1])); db.setLocationUri(MetastoreDirectSqlUtils.extractSqlString(dbline[2])); db.setDescription(MetastoreDirectSqlUtils.extractSqlString(dbline[3])); db.setOwnerName(MetastoreDirectSqlUtils.extractSqlString(dbline[4])); String type = MetastoreDirectSqlUtils.extractSqlString(dbline[5]);
@Test public void testAlterDatabaseCaseInsensitive() throws Exception { Database originalDatabase = testDatabases[0]; Database newDatabase = originalDatabase.deepCopy(); newDatabase.setDescription("Altered database"); // Test in upper case client.alterDatabase(originalDatabase.getName().toUpperCase(), newDatabase); Database alteredDatabase = client.getDatabase(newDatabase.getName()); Assert.assertEquals("Comparing databases", newDatabase, alteredDatabase); // Test in mixed case originalDatabase = testDatabases[2]; newDatabase = originalDatabase.deepCopy(); newDatabase.setDescription("Altered database 2"); client.alterDatabase("TeST_daTAbaSe_TO_FiNd_2", newDatabase); alteredDatabase = client.getDatabase(newDatabase.getName()); Assert.assertEquals("Comparing databases", newDatabase, alteredDatabase); }
/** * Create a Database * @param db * @param crtDb * @return Always returns 0 * @throws HiveException */ private int createDatabase(Hive db, CreateDatabaseDesc crtDb) throws HiveException { Database database = new Database(); database.setName(crtDb.getName()); database.setDescription(crtDb.getComment()); database.setLocationUri(crtDb.getLocationUri()); database.setParameters(crtDb.getDatabaseProperties()); database.setOwnerName(SessionState.getUserFromAuthenticator()); database.setOwnerType(PrincipalType.USER); try { makeLocationQualified(database); db.createDatabase(database, crtDb.getIfNotExists()); } catch (AlreadyExistsException ex) { //it would be better if AlreadyExistsException had an errorCode field.... throw new HiveException(ex, ErrorMsg.DATABASE_ALREADY_EXISTS, crtDb.getName()); } return 0; }
/** * Create a Database * @param db * @param crtDb * @return Always returns 0 * @throws HiveException */ private int createDatabase(Hive db, CreateDatabaseDesc crtDb) throws HiveException { Database database = new Database(); database.setName(crtDb.getName()); database.setDescription(crtDb.getComment()); database.setLocationUri(crtDb.getLocationUri()); database.setParameters(crtDb.getDatabaseProperties()); database.setOwnerName(SessionState.getUserFromAuthenticator()); database.setOwnerType(PrincipalType.USER); try { if (!Utilities.isDefaultNameNode(conf)) { makeLocationQualified(database); } db.createDatabase(database, crtDb.getIfNotExists()); } catch (AlreadyExistsException ex) { //it would be better if AlreadyExistsException had an errorCode field.... throw new HiveException(ex, ErrorMsg.DATABSAE_ALREADY_EXISTS, crtDb.getName()); } return 0; }
public Database getJDODatabase(String catName, String name) throws NoSuchObjectException { MDatabase mdb = null; boolean commited = false; try { openTransaction(); mdb = getMDatabase(catName, name); commited = commitTransaction(); } finally { if (!commited) { rollbackTransaction(); } } Database db = new Database(); db.setName(mdb.getName()); db.setDescription(mdb.getDescription()); db.setLocationUri(mdb.getLocationUri()); db.setParameters(convertMap(mdb.getParameters())); db.setOwnerName(mdb.getOwnerName()); String type = org.apache.commons.lang.StringUtils.defaultIfBlank(mdb.getOwnerType(), null); PrincipalType principalType = (type == null) ? null : PrincipalType.valueOf(type); db.setOwnerType(principalType); db.setCatalogName(catName); db.setCreateTime(mdb.getCreateTime()); return db; }
unsetDescription(); } else { setDescription((String)value);
Database toHiveDb() { Database hiveDB = new Database(); hiveDB.setDescription(this.comment); hiveDB.setLocationUri(this.locationUri); hiveDB.setName(this.dbName); hiveDB.setParameters(this.dbProperties); return hiveDB; }
Database toHiveDb() { Database hiveDB = new Database(); hiveDB.setDescription(this.comment); hiveDB.setLocationUri(this.locationUri); hiveDB.setName(this.dbName); hiveDB.setParameters(this.dbProperties); return hiveDB; }
Database toHiveDb() { Database hiveDB = new Database(); hiveDB.setDescription(this.comment); hiveDB.setLocationUri(this.locationUri); hiveDB.setName(this.dbName); hiveDB.setParameters(this.dbProperties); return hiveDB; }
/** * {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public Database metacatToHiveDatabase(final DatabaseDto dto) { final Database database = new Database(); String name = ""; String description = ""; final QualifiedName databaseName = dto.getName(); if (databaseName != null) { name = databaseName.getDatabaseName(); // Since this is required setting it to the same as the DB name for now description = databaseName.getDatabaseName(); } database.setName(name); database.setDescription(description); String dbUri = dto.getUri(); if (Strings.isNullOrEmpty(dbUri)) { dbUri = ""; } database.setLocationUri(dbUri); Map<String, String> metadata = dto.getMetadata(); if (metadata == null) { metadata = Collections.EMPTY_MAP; } database.setParameters(metadata); return database; }
@Override @SuppressWarnings("unchecked") public Database metacatToHiveDatabase(final DatabaseDto dto) { final Database database = new Database(); String name = ""; String description = ""; final QualifiedName databaseName = dto.getName(); if (databaseName != null) { name = databaseName.getDatabaseName(); // Since this is required setting it to the same as the DB name for now description = databaseName.getDatabaseName(); } database.setName(name); database.setDescription(description); String dbUri = dto.getUri(); if (Strings.isNullOrEmpty(dbUri)) { dbUri = ""; } database.setLocationUri(dbUri); Map<String, String> metadata = dto.getMetadata(); if (metadata == null) { metadata = Collections.EMPTY_MAP; } database.setParameters(metadata); return database; }
/** * {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public Database metacatToHiveDatabase(final DatabaseDto dto) { final Database database = new Database(); String name = ""; String description = ""; final QualifiedName databaseName = dto.getName(); if (databaseName != null) { name = databaseName.getDatabaseName(); // Since this is required setting it to the same as the DB name for now description = databaseName.getDatabaseName(); } database.setName(name); database.setDescription(description); String dbUri = dto.getUri(); if (Strings.isNullOrEmpty(dbUri)) { dbUri = ""; } database.setLocationUri(dbUri); Map<String, String> metadata = dto.getMetadata(); if (metadata == null) { metadata = Collections.EMPTY_MAP; } database.setParameters(metadata); return database; }
public Database getJDODatabase(String name) throws NoSuchObjectException { MDatabase mdb = null; boolean commited = false; try { openTransaction(); mdb = getMDatabase(name); commited = commitTransaction(); } finally { if (!commited) { rollbackTransaction(); } } Database db = new Database(); db.setName(mdb.getName()); db.setDescription(mdb.getDescription()); db.setLocationUri(mdb.getLocationUri()); db.setParameters(convertMap(mdb.getParameters())); db.setOwnerName(mdb.getOwnerName()); String type = mdb.getOwnerType(); db.setOwnerType((null == type || type.trim().isEmpty()) ? null : PrincipalType.valueOf(type)); return db; }
/** * Create a Database * @param db * @param crtDb * @return Always returns 0 * @throws HiveException * @throws AlreadyExistsException */ private int createDatabase(Hive db, CreateDatabaseDesc crtDb) throws HiveException, AlreadyExistsException { Database database = new Database(); database.setName(crtDb.getName()); database.setDescription(crtDb.getComment()); database.setLocationUri(crtDb.getLocationUri()); database.setParameters(crtDb.getDatabaseProperties()); db.createDatabase(database, crtDb.getIfNotExists()); return 0; }
public Database getJDODatabase(String name) throws NoSuchObjectException { MDatabase mdb = null; boolean commited = false; try { openTransaction(); mdb = getMDatabase(name); commited = commitTransaction(); } finally { if (!commited) { rollbackTransaction(); } } Database db = new Database(); db.setName(mdb.getName()); db.setDescription(mdb.getDescription()); db.setLocationUri(mdb.getLocationUri()); db.setParameters(convertMap(mdb.getParameters())); db.setOwnerName(mdb.getOwnerName()); String type = mdb.getOwnerType(); db.setOwnerType((null == type || type.trim().isEmpty()) ? null : PrincipalType.valueOf(type)); return db; }
public Database getDatabase(String name) throws NoSuchObjectException { MDatabase mdb = null; boolean commited = false; try { openTransaction(); mdb = getMDatabase(name); commited = commitTransaction(); } finally { if (!commited) { rollbackTransaction(); } } Database db = new Database(); db.setName(mdb.getName()); db.setDescription(mdb.getDescription()); db.setLocationUri(mdb.getLocationUri()); db.setParameters(mdb.getParameters()); return db; }
public Database getDatabase(String name) throws NoSuchObjectException { MDatabase mdb = null; boolean commited = false; try { openTransaction(); mdb = getMDatabase(name); commited = commitTransaction(); } finally { if (!commited) { rollbackTransaction(); } } Database db = new Database(); db.setName(mdb.getName()); db.setDescription(mdb.getDescription()); db.setLocationUri(mdb.getLocationUri()); db.setParameters(mdb.getParameters()); return db; }
/** * Create a Database * @param db * @param crtDb * @return Always returns 0 * @throws HiveException */ private int createDatabase(Hive db, CreateDatabaseDesc crtDb) throws HiveException { Database database = new Database(); database.setName(crtDb.getName()); database.setDescription(crtDb.getComment()); database.setLocationUri(crtDb.getLocationUri()); database.setParameters(crtDb.getDatabaseProperties()); database.setOwnerName(SessionState.getUserFromAuthenticator()); database.setOwnerType(PrincipalType.USER); try { if (!Utilities.isDefaultNameNode(conf)) { makeLocationQualified(database); } db.createDatabase(database, crtDb.getIfNotExists()); } catch (AlreadyExistsException ex) { //it would be better if AlreadyExistsException had an errorCode field.... throw new HiveException(ex, ErrorMsg.DATABSAE_ALREADY_EXISTS, crtDb.getName()); } return 0; }
public Database getJDODatabase(String catName, String name) throws NoSuchObjectException { MDatabase mdb = null; boolean commited = false; try { openTransaction(); mdb = getMDatabase(catName, name); commited = commitTransaction(); } finally { if (!commited) { rollbackTransaction(); } } Database db = new Database(); db.setName(mdb.getName()); db.setDescription(mdb.getDescription()); db.setLocationUri(mdb.getLocationUri()); db.setParameters(convertMap(mdb.getParameters())); db.setOwnerName(mdb.getOwnerName()); String type = org.apache.commons.lang.StringUtils.defaultIfBlank(mdb.getOwnerType(), null); PrincipalType principalType = (type == null) ? null : PrincipalType.valueOf(type); db.setOwnerType(principalType); db.setCatalogName(catName); return db; }