use of org.apache.hadoop.hive.metastore.client.builder.DatabaseBuilder in project hive by apache.
the class TestAppendPartitions method setUp.
@Before
public void setUp() throws Exception {
// Get new client
client = metaStore.getClient();
// Clean up the database
client.dropDatabase(DB_NAME, true, true, true);
metaStore.cleanWarehouseDirs();
Database db = new DatabaseBuilder().setName(DB_NAME).build();
client.createDatabase(db);
tableWithPartitions = createTableWithPartitions();
externalTable = createExternalTable();
tableNoPartColumns = createTableNoPartitionColumns();
tableView = createView();
}
use of org.apache.hadoop.hive.metastore.client.builder.DatabaseBuilder in project hive by apache.
the class TestExchangePartitions method createDB.
// Helper methods
private void createDB(String dbName) throws TException {
Database db = new DatabaseBuilder().setName(dbName).build();
client.createDatabase(db);
}
use of org.apache.hadoop.hive.metastore.client.builder.DatabaseBuilder in project hive by apache.
the class TestGetTableMeta method createDB.
private Database createDB(String dbName) throws TException {
Database db = new DatabaseBuilder().setName(dbName).build();
client.createDatabase(db);
return db;
}
use of org.apache.hadoop.hive.metastore.client.builder.DatabaseBuilder in project hive by apache.
the class TestDatabases method setUp.
@Before
public void setUp() throws Exception {
// Get new client
client = metaStore.getClient();
// Clean up the databases
for (String databaseName : client.getAllDatabases()) {
if (!databaseName.equals(DEFAULT_DATABASE)) {
client.dropDatabase(databaseName, true, true, true);
}
}
testDatabases[0] = new DatabaseBuilder().setName("test_database_1").build();
testDatabases[1] = new DatabaseBuilder().setName("test_database_to_find_1").build();
testDatabases[2] = new DatabaseBuilder().setName("test_database_to_find_2").build();
testDatabases[3] = new DatabaseBuilder().setName("test_database_hidden_1").build();
// Create the databases, and reload them from the MetaStore
for (int i = 0; i < testDatabases.length; i++) {
client.createDatabase(testDatabases[i]);
testDatabases[i] = client.getDatabase(testDatabases[i].getName());
}
}
use of org.apache.hadoop.hive.metastore.client.builder.DatabaseBuilder in project hive by apache.
the class TestDatabases method testAlterDatabase.
@Test
public void testAlterDatabase() throws Exception {
Database originalDatabase = testDatabases[0];
Database newDatabase = new DatabaseBuilder().setName(originalDatabase.getName()).setOwnerType(PrincipalType.GROUP).setOwnerName("owner2").setLocation(metaStore.getWarehouseRoot() + "/database_location_2").setDescription("dummy description 2").addParam("param_key_1", "param_value_1_2").addParam("param_key_2_3", "param_value_2_3").build();
client.alterDatabase(originalDatabase.getName(), newDatabase);
Database alteredDatabase = client.getDatabase(newDatabase.getName());
Assert.assertEquals("Comparing Databases", newDatabase, alteredDatabase);
}
Aggregations