Search in sources :

Example 26 with DatabaseBuilder

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();
}
Also used : DatabaseBuilder(org.apache.hadoop.hive.metastore.client.builder.DatabaseBuilder) Database(org.apache.hadoop.hive.metastore.api.Database) Before(org.junit.Before)

Example 27 with DatabaseBuilder

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);
}
Also used : DatabaseBuilder(org.apache.hadoop.hive.metastore.client.builder.DatabaseBuilder) Database(org.apache.hadoop.hive.metastore.api.Database)

Example 28 with DatabaseBuilder

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;
}
Also used : DatabaseBuilder(org.apache.hadoop.hive.metastore.client.builder.DatabaseBuilder) Database(org.apache.hadoop.hive.metastore.api.Database)

Example 29 with DatabaseBuilder

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());
    }
}
Also used : DatabaseBuilder(org.apache.hadoop.hive.metastore.client.builder.DatabaseBuilder) Before(org.junit.Before)

Example 30 with DatabaseBuilder

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);
}
Also used : DatabaseBuilder(org.apache.hadoop.hive.metastore.client.builder.DatabaseBuilder) Database(org.apache.hadoop.hive.metastore.api.Database) Test(org.junit.Test) MetastoreCheckinTest(org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest)

Aggregations

DatabaseBuilder (org.apache.hadoop.hive.metastore.client.builder.DatabaseBuilder)31 Database (org.apache.hadoop.hive.metastore.api.Database)26 Test (org.junit.Test)12 TableBuilder (org.apache.hadoop.hive.metastore.client.builder.TableBuilder)9 Before (org.junit.Before)9 MetastoreCheckinTest (org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest)8 Partition (org.apache.hadoop.hive.metastore.api.Partition)6 Table (org.apache.hadoop.hive.metastore.api.Table)6 PartitionBuilder (org.apache.hadoop.hive.metastore.client.builder.PartitionBuilder)6 ISchema (org.apache.hadoop.hive.metastore.api.ISchema)5 ISchemaBuilder (org.apache.hadoop.hive.metastore.client.builder.ISchemaBuilder)5 SchemaVersion (org.apache.hadoop.hive.metastore.api.SchemaVersion)4 SchemaVersionBuilder (org.apache.hadoop.hive.metastore.client.builder.SchemaVersionBuilder)4 MetastoreUnitTest (org.apache.hadoop.hive.metastore.annotation.MetastoreUnitTest)3 NoSuchObjectException (org.apache.hadoop.hive.metastore.api.NoSuchObjectException)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 FieldSchema (org.apache.hadoop.hive.metastore.api.FieldSchema)2 ListenerEvent (org.apache.hadoop.hive.metastore.events.ListenerEvent)2 File (java.io.File)1