コード例 #1
0
 @AfterMethod(alwaysRun = true)
 public void tearDown() throws Exception {
   if (dummyHandle != null) {
     dummyHandle.close();
   }
   deleteRecursively(temporary);
 }
コード例 #2
0
  @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);
        }
      }
    }
  }
コード例 #3
0
  @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);
      }
    }
  }
コード例 #4
0
 @AfterMethod
 public void teardown() {
   dummyHandle.close();
   FileUtils.deleteRecursively(dataDir);
 }
コード例 #5
0
 @AfterClass(alwaysRun = true)
 public void tearDown() throws Exception {
   deleteRecursively(directory);
 }