Skip to content

Commit 32b1824

Browse files
committed
Fix ice delete --dry-run
1 parent 767a5da commit 32b1824

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

ice/src/main/java/com/altinity/ice/cli/Main.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -493,10 +493,14 @@ void delete(
493493
String partitionJson,
494494
@CommandLine.Option(
495495
names = "--dry-run",
496-
description = "Log files that would be deleted without actually deleting them",
497-
defaultValue = "true")
498-
boolean dryRun)
496+
description =
497+
"Log files that would be deleted without actually deleting them (true by default)")
498+
Boolean dryRun)
499499
throws IOException {
500+
if (dryRun == null) {
501+
dryRun = true;
502+
}
503+
500504
try (RESTCatalog catalog = loadCatalog(this.configFile())) {
501505
List<PartitionFilter> partitions = new ArrayList<>();
502506
if (partitionJson != null && !partitionJson.isEmpty()) {

ice/src/main/java/com/altinity/ice/cli/internal/cmd/Delete.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,17 @@ public static void run(
6262

6363
if (!filesToDelete.isEmpty()) {
6464
if (dryRun) {
65-
logger.info("Dry run: The following files would be deleted:");
6665
for (DataFile file : filesToDelete) {
67-
logger.info(" {}", file.path());
66+
logger.info("To be deleted: {}", file.location());
6867
}
6968
} else {
7069
RewriteFiles rewrite = table.newRewrite();
7170
for (DataFile deleteFile : filesToDelete) {
71+
logger.info("Deleting {}", deleteFile.location());
7272
rewrite.deleteFile(deleteFile);
7373
}
7474
rewrite.commit();
75-
logger.info("Partition(s) deleted.");
7675
}
77-
} else {
78-
logger.info("No files found for the partition(s).");
7976
}
8077
}
8178
}

0 commit comments

Comments
 (0)