diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TableRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TableRepository.java index b0b7cbf02fc..14d26d2306e 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TableRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TableRepository.java @@ -402,16 +402,21 @@ public class TableRepository extends EntityRepository { public void deleteTableProfile(String fqn, String entityType, Long timestamp) { // Validate the request content String extension; + Class classMapper; if (entityType.equalsIgnoreCase(Entity.TABLE)) { extension = TABLE_PROFILE_EXTENSION; + classMapper = TableProfile.class; } else if (entityType.equalsIgnoreCase("column")) { extension = TABLE_COLUMN_PROFILE_EXTENSION; + classMapper = ColumnProfile.class; + } else if (entityType.equalsIgnoreCase("system")) { + extension = SYSTEM_PROFILE_EXTENSION; + classMapper = SystemProfile.class; } else { - throw new IllegalArgumentException("entityType must be table or column"); + throw new IllegalArgumentException("entityType must be table, column or system"); } - TableProfile storedTableProfile = - JsonUtils.readValue(getExtensionAtTimestamp(fqn, extension, timestamp), TableProfile.class); + Object storedTableProfile = JsonUtils.readValue(getExtensionAtTimestamp(fqn, extension, timestamp), classMapper); if (storedTableProfile == null) { throw new EntityNotFoundException(String.format("Failed to find table profile for %s at %s", fqn, timestamp)); }