@AfterMethod(alwaysRun = true) public void tearDown() throws Exception { if (dummyHandle != null) { dummyHandle.close(); } deleteRecursively(temporary); }
@Override public synchronized void dropTable(String databaseName, String tableName, boolean deleteData) { List<String> locations = listAllDataPaths(this, databaseName, tableName); SchemaTableName schemaTableName = new SchemaTableName(databaseName, tableName); Table table = relations.remove(schemaTableName); if (table == null) { throw new TableNotFoundException(schemaTableName); } views.remove(schemaTableName); partitions.keySet().removeIf(partitionName -> partitionName.matches(databaseName, tableName)); // remove data if (deleteData) { for (String location : locations) { if (location != null) { File directory = new File(new Path(location).toUri()); checkArgument( isParentDir(directory, baseDirectory), "Table directory must be inside of the metastore base directory"); deleteRecursively(directory); } } } }
@Override public void dropTable(String databaseName, String tableName) { List<String> locations = listAllDataPaths(this, databaseName, tableName); SchemaTableName schemaTableName = new SchemaTableName(databaseName, tableName); Table table = relations.remove(schemaTableName); if (table == null) { throw new TableNotFoundException(schemaTableName); } views.remove(schemaTableName); partitions .keySet() .stream() .filter(partitionName -> partitionName.matches(databaseName, tableName)) .forEach(partitions::remove); // remove data for (String location : locations) { if (location != null) { File directory = new File(URI.create(location)); checkArgument( isParentDir(directory, baseDirectory), "Table directory must be inside of the metastore base directory"); deleteRecursively(directory); } } }
@AfterMethod public void teardown() { dummyHandle.close(); FileUtils.deleteRecursively(dataDir); }
@AfterClass(alwaysRun = true) public void tearDown() throws Exception { deleteRecursively(directory); }