private void dropDbTable() { // cleanup try { msc.dropTable(catName, dbName, tableName, true, true); msc.dropDatabase(catName, dbName, true, true, true); } catch (TException e) { // ignore } }
@Test public void testDropTableIgnoreUnknown() throws Exception { Table table = testTables[0]; // Check what happens, when we ignore these errors client.dropTable("no_such_database", table.getTableName(), true, true); client.dropTable(table.getDbName(), "no_such_table", false, true); client.dropTable(OTHER_DATABASE, table.getTableName(), true, true); // TODO: Strangely the default parametrization is to ignore missing tables client.dropTable("no_such_database", table.getTableName()); client.dropTable(table.getDbName(), "no_such_table"); client.dropTable(OTHER_DATABASE, table.getTableName()); }
@Test(expected = NoSuchObjectException.class) public void testDropTableNoSuchDatabase() throws Exception { Table table = testTables[2]; client.dropTable("no_such_database", table.getTableName(), true, false); }
@Test(expected = NoSuchObjectException.class) public void testDropTableNoSuchTableInTheDatabase() throws Exception { Table table = testTables[2]; client.dropTable(OTHER_DATABASE, table.getTableName(), true, false); }
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) { } }
private void cleanUpTableQuietly(String catName, String dbName, String tableName) { try { db.dropTable(catName, dbName, tableName); } catch (Exception exception) { fail("Unexpected exception: " + StringUtils.stringifyException(exception)); } }
private void cleanUpTableQuietly(String catName, String dbName, String tableName) { try { db.dropTable(catName, dbName, tableName, true, true, true); } catch (Exception exception) { fail("Unexpected exception: " + StringUtils.stringifyException(exception)); } }
@Test(expected = NoSuchObjectException.class) public void testDropTableNoSuchTable() throws Exception { Table table = testTables[2]; client.dropTable(table.getDbName(), "no_such_table", true, false); }
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) { } }
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 public void testDropTableNullTableName() throws Exception { try { client.dropTable(DEFAULT_DATABASE, null, true, false); // TODO: Should be checked on server side. On Embedded metastore it throws MetaException, // on Remote metastore it throws TProtocolException Assert.fail("Expected an MetaException or TProtocolException to be thrown"); } catch (MetaException exception) { // Expected exception - Embedded MetaStore } catch (TProtocolException exception) { // Expected exception - Remote MetaStore } }
@Test public void testDropTableNullDatabase() throws Exception { // Missing database in the query try { client.dropTable(null, OTHER_DATABASE, true, false); // TODO: Should be checked on server side. On Embedded metastore it throws MetaException, // on Remote metastore it throws TProtocolException Assert.fail("Expected an MetaException or TProtocolException to be thrown"); } catch (MetaException exception) { // Expected exception - Embedded MetaStore } catch (TProtocolException exception) { // Expected exception - Remote MetaStore } }
@Test(expected = NoSuchObjectException.class) public void dropTableBogusCatalog() throws TException { client.dropTable("nosuch", testTables[0].getDbName(), testTables[0].getTableName(), true, false); }
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(); } }
public Database dropAndCreate(IMetaStoreClient metaStoreClient) throws Exception { if (metaStoreClient == null) { throw new IllegalArgumentException(); } try { for (String table : metaStoreClient.listTableNamesByFilter(database.getName(), "", (short) -1)) { metaStoreClient.dropTable(database.getName(), table, true, true); } metaStoreClient.dropDatabase(database.getName()); } catch (TException e) { } metaStoreClient.createDatabase(database); return database; }
@Test public void testDropTableExternalWithoutPurge() throws Exception { Table table = externalTable; client.dropTable(table.getDbName(), table.getTableName(), true, true, false); Assert.assertTrue("Table path should not be removed", metaStore.isPathExists(new Path(table.getSd().getLocation()))); Assert.assertFalse("Table path should be in trash", metaStore.isPathExistsInTrash(new Path(table.getSd().getLocation()))); }
@Test public void testDropTableWithPurge() throws Exception { Table table = testTables[0]; client.dropTable(table.getDbName(), table.getTableName(), true, true, true); Assert.assertFalse("Table path should be removed", metaStore.isPathExists(new Path(table.getSd().getLocation()))); Assert.assertFalse("Table path should not be in trash", metaStore.isPathExistsInTrash(new Path(table.getSd().getLocation()))); }
@Test public void testDropTableExternalWithPurge() throws Exception { Table table = externalTable; client.dropTable(table.getDbName(), table.getTableName(), true, true, true); Assert.assertTrue("Table path should not be removed", metaStore.isPathExists(new Path(table.getSd().getLocation()))); Assert.assertFalse("Table path should not be in trash", metaStore.isPathExistsInTrash(new Path(table.getSd().getLocation()))); }
@Test public void testDropTableWithoutPurge() throws Exception { Table table = testTables[0]; client.dropTable(table.getDbName(), table.getTableName(), true, true, false); Assert.assertFalse("Table path should be removed", metaStore.isPathExists(new Path(table.getSd().getLocation()))); Assert.assertTrue("Table path should be in trash", metaStore.isPathExistsInTrash(new Path(table.getSd().getLocation()))); }
@Test public void droppedTable() throws Exception { Table t = newTable("default", "dt", false); addDeltaFile(t, null, 1L, 2L, 2); addDeltaFile(t, null, 3L, 4L, 2); burnThroughTransactions("default", "dt", 4); CompactionRequest rqst = new CompactionRequest("default", "dt", CompactionType.MAJOR); txnHandler.compact(rqst); // Drop table will clean the table entry from the compaction queue and hence worker have no effect ms.dropTable("default", "dt"); startWorker(); ShowCompactResponse rsp = txnHandler.showCompact(new ShowCompactRequest()); List<ShowCompactResponseElement> compacts = rsp.getCompacts(); Assert.assertEquals(0, compacts.size()); }