Skip to content

Commit fb81bf5

Browse files
committed
Ignore non-existing table when dropping Iceberg schema with cascade
1 parent 5f5f506 commit fb81bf5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergMetadata.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1174,7 +1174,11 @@ public void dropSchema(ConnectorSession session, String schemaName, boolean casc
11741174
dropView(session, viewName);
11751175
}
11761176
for (SchemaTableName tableName : listTables(session, Optional.of(schemaName))) {
1177-
dropTable(session, getTableHandle(session, tableName, Optional.empty(), Optional.empty()));
1177+
ConnectorTableHandle tableHandle = getTableHandle(session, tableName, Optional.empty(), Optional.empty());
1178+
if (tableHandle != null) {
1179+
// getTableHandle method returns null if the table is dropped concurrently
1180+
dropTable(session, tableHandle);
1181+
}
11781182
}
11791183
}
11801184
catalog.dropNamespace(session, schemaName);

0 commit comments

Comments
 (0)