@Test(expected = NoSuchObjectException.class) public void testDropDatabaseIgnoreUnknownFalse() throws Exception { // No such database client.dropDatabase("no_such_database", false, false); }
@Test public void testDropDatabaseIgnoreUnknownTrue() throws Exception { // No such database client.dropDatabase("no_such_database", false, true); }
private void dropDbTable() { // cleanup try { msc.dropTable(catName, dbName, tableName, true, true); msc.dropDatabase(catName, dbName, true, true, true); } catch (TException e) { // ignore } }
@Test(expected = MetaException.class) public void testDropDatabaseNullName() throws Exception { // Missing database in the query client.dropDatabase(null); }
@Test(expected = NoSuchObjectException.class) public void testListPartitionsWithAuthByValuesNoDb() throws Exception { client.dropDatabase(DB_NAME); client.listPartitionsWithAuthInfo(DB_NAME, TABLE_NAME, Lists .newArrayList("2017", "11", "27"), (short)-1, "", Lists.newArrayList()); }
@Test(expected = NoSuchObjectException.class) public void testListPartitionsByValuesNoDb() throws Exception { client.dropDatabase(DB_NAME); client.listPartitions(DB_NAME, TABLE_NAME, Lists.newArrayList("1999"), (short)-1); }
@Test(expected = NoSuchObjectException.class) public void testListPartitionsWithAuthNoDb() throws Exception { client.dropDatabase(DB_NAME); client.listPartitionsWithAuthInfo(DB_NAME, TABLE_NAME, (short)-1, "", Lists.newArrayList()); }
@Test(expected = NoSuchObjectException.class) public void testGetPartitionByValuesNoDb() throws Exception { client.dropDatabase(DB_NAME); client.getPartition(DB_NAME, TABLE_NAME, Lists.newArrayList("1997", "05", "16")); }
@Test(expected = NoSuchObjectException.class) public void testListPartitionNamesNoDb() throws Exception { client.dropDatabase(DB_NAME); client.listPartitionNames(DB_NAME, TABLE_NAME, (short)-1); }
public static void dropDB(IMetaStoreClient client, String databaseName) { try { for (String table : client.listTableNamesByFilter(databaseName, "", (short) -1)) { client.dropTable(databaseName, table, true, true); } client.dropDatabase(databaseName); } catch (TException e) { } }
@Test(expected = NoSuchObjectException.class) public void testListPartitionSpecsNoDb() throws Exception { client.dropDatabase(DB_NAME); client.listPartitionSpecs(DB_NAME, TABLE_NAME, -1); }
@Test(expected = NoSuchObjectException.class) public void testListPartitionsByFilterNoDb() throws Exception { client.dropDatabase(DB_NAME); client.listPartitionsByFilter(DB_NAME, TABLE_NAME, "yyyy=\"2017\"", (short)-1); }
@Test(expected = NoSuchObjectException.class) public void testListPartitionSpecsByFilterNoDb() throws Exception { client.dropDatabase(DB_NAME); client.listPartitionSpecsByFilter(DB_NAME, TABLE_NAME, "yyyy=\"2017\"", -1); }
@Before public void setUp() throws Exception { // Get new client client = metaStore.getClient(); // Clean up the database client.dropDatabase(DB_NAME, true, true, true); createDB(DB_NAME); }
public static void dropDB(HiveConf conf, String databaseName) throws HiveException, MetaException { IMetaStoreClient client = new HiveMetaStoreClient(conf); try { for (String table : client.listTableNamesByFilter(databaseName, "", (short) -1)) { client.dropTable(databaseName, table, true, true); } client.dropDatabase(databaseName); } catch (TException e) { client.close(); } }
@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(); createDB(DB_NAME); }
@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(); new DatabaseBuilder(). setName(DB_NAME). create(client, metaStore.getConf()); }
@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(); createDB(DB_NAME); sourceTable = createSourceTable(); destTable = createDestTable(); partitions = createTestPartitions(); }
@Test(expected = InvalidOperationException.class) public void testDropDatabaseWithFunction() throws Exception { Database database = testDatabases[0]; Function testFunction = new FunctionBuilder() .setDbName(database.getName()) .setName("test_function") .setClass("org.apache.hadoop.hive.ql.udf.generic.GenericUDFUpper") .create(client, metaStore.getConf()); client.dropDatabase(database.getName(), true, true, false); }
@Test(expected = InvalidOperationException.class) public void testDropDatabaseWithTable() throws Exception { Database database = testDatabases[0]; Table testTable = new TableBuilder() .setDbName(database.getName()) .setTableName("test_table") .addCol("test_col", "int") .create(client, metaStore.getConf()); client.dropDatabase(database.getName(), true, true, false); }