Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public static LoadTableResponse createTable(
}

public static void dropTable(Catalog catalog, TableIdentifier ident) {
boolean dropped = catalog.dropTable(ident);
boolean dropped = catalog.dropTable(ident, false);
if (!dropped) {
throw new NoSuchTableException("Table does not exist: %s", ident);
}
Expand Down
25 changes: 25 additions & 0 deletions core/src/test/java/org/apache/iceberg/catalog/CatalogTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,31 @@ public void testDropTableWithPurge() {
Assert.assertFalse("Table should not exist after drop", catalog.tableExists(TABLE));
}

@Test
public void testDropTableWithoutPurge() {
C catalog = catalog();

if (requiresNamespaceCreate()) {
catalog.createNamespace(NS);
}

Assert.assertFalse("Table should not exist before create", catalog.tableExists(TABLE));

Table table = catalog.buildTable(TABLE, SCHEMA).create();
Assert.assertTrue("Table should exist after create", catalog.tableExists(TABLE));
Set<String> actualMetadataFileLocations = ReachableFileUtil.metadataFileLocations(table, false);

boolean dropped = catalog.dropTable(TABLE, false);
Assert.assertTrue("Should drop a table that does exist", dropped);
Assert.assertFalse("Table should not exist after drop", catalog.tableExists(TABLE));
Set<String> expectedMetadataFileLocations =
ReachableFileUtil.metadataFileLocations(table, false);
Assertions.assertThat(actualMetadataFileLocations)
.hasSameElementsAs(expectedMetadataFileLocations)
.hasSize(1)
.as("Should have one metadata file");
}

@Test
public void testDropMissingTable() {
C catalog = catalog();
Expand Down