fix: DELETE endpoint for profiler data (#12912)

This commit is contained in:
Teddy 2023-08-18 20:48:04 +02:00 committed by GitHub
parent a45c644bc4
commit edea862082
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -402,16 +402,21 @@ public class TableRepository extends EntityRepository<Table> {
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));
}