@VisibleForTesting
  void dropPartitionsInternal(String catName, String dbName, String tblName,
       List<String> partNames, boolean allowSql, boolean allowJdo)
      throws MetaException, NoSuchObjectException {
    if (CollectionUtils.isEmpty(partNames)) {
      return;
    }
    new GetListHelper<Void>(catName, dbName, tblName, allowSql, allowJdo) {
      @Override
      protected List<Void> getSqlResult(GetHelper<List<Void>> ctx) throws MetaException {
        directSql.dropPartitionsViaSqlFilter(catName, dbName, tblName, partNames);
        return Collections.emptyList();
      }
      @Override
      protected List<Void> getJdoResult(GetHelper<List<Void>> ctx) throws MetaException {
        dropPartitionsViaJdo(catName, dbName, tblName, partNames);
        return Collections.emptyList();
      }
    }.run(false);
  }
@Test
  public void testDirectSQLDropPartitionsCleanup() throws Exception {

    createPartitionedTable(true, true);

    // Check, that every table in the expected state before the drop
    checkBackendTableSize("PARTITIONS", 3);
    checkBackendTableSize("PART_PRIVS", 3);
    checkBackendTableSize("PART_COL_PRIVS", 3);
    checkBackendTableSize("PART_COL_STATS", 3);
    checkBackendTableSize("PARTITION_PARAMS", 3);
    checkBackendTableSize("PARTITION_KEY_VALS", 3);
    checkBackendTableSize("SD_PARAMS", 3);
    checkBackendTableSize("BUCKETING_COLS", 3);
    checkBackendTableSize("SKEWED_COL_NAMES", 3);
    checkBackendTableSize("SDS", 4); // Table has an SDS
    checkBackendTableSize("SORT_COLS", 3);
    checkBackendTableSize("SERDE_PARAMS", 3);
    checkBackendTableSize("SERDES", 4); // Table has a serde

    // drop the partitions
    try (AutoCloseable c = deadline()) {
      objectStore.dropPartitionsInternal(DEFAULT_CATALOG_NAME, DB1, TABLE1,
	        Arrays.asList("test_part_col=a0", "test_part_col=a1", "test_part_col=a2"), true, false);
    }

    // Check, if every data is dropped connected to the partitions
    checkBackendTableSize("PARTITIONS", 0);
    checkBackendTableSize("PART_PRIVS", 0);
    checkBackendTableSize("PART_COL_PRIVS", 0);
    checkBackendTableSize("PART_COL_STATS", 0);
    checkBackendTableSize("PARTITION_PARAMS", 0);
    checkBackendTableSize("PARTITION_KEY_VALS", 0);
    checkBackendTableSize("SD_PARAMS", 0);
    checkBackendTableSize("BUCKETING_COLS", 0);
    checkBackendTableSize("SKEWED_COL_NAMES", 0);
    checkBackendTableSize("SDS", 1); // Table has an SDS
    checkBackendTableSize("SORT_COLS", 0);
    checkBackendTableSize("SERDE_PARAMS", 0);
    checkBackendTableSize("SERDES", 1); // Table has a serde
  }