hddong commented on a change in pull request #1724:
URL: https://github.com/apache/hudi/pull/1724#discussion_r439790519
##########
File path:
hudi-cli/src/main/java/org/apache/hudi/cli/commands/CommitsCommand.java
##########
@@ -334,27 +351,30 @@ public String showCommitFiles(
}
}
- TableHeader header = new TableHeader().addTableHeaderField("Partition
Path").addTableHeaderField("File ID")
- .addTableHeaderField("Previous Commit").addTableHeaderField("Total
Records Updated")
- .addTableHeaderField("Total Records
Written").addTableHeaderField("Total Bytes Written")
- .addTableHeaderField("Total Errors").addTableHeaderField("File Size");
+ TableHeader header = new
TableHeader().addTableHeaderField(HoodieTableHeaderFields.HEADER_PARTITION_PATH)
+ .addTableHeaderField(HoodieTableHeaderFields.HEADER_FILE_ID)
+ .addTableHeaderField(HoodieTableHeaderFields.HEADER_PREVIOUS_COMMIT)
+
.addTableHeaderField(HoodieTableHeaderFields.HEADER_TOTAL_RECORDS_UPDATED)
+
.addTableHeaderField(HoodieTableHeaderFields.HEADER_TOTAL_RECORDS_WRITTEN)
+
.addTableHeaderField(HoodieTableHeaderFields.HEADER_TOTAL_BYTES_WRITTEN)
+ .addTableHeaderField(HoodieTableHeaderFields.HEADER_TOTAL_ERRORS)
+ .addTableHeaderField(HoodieTableHeaderFields.HEADER_FILE_SIZE);
return HoodiePrintHelper.print(header, new HashMap<>(), sortByField,
descending,
limit, headerOnly, rows, exportTableName);
}
@CliCommand(value = "commits compare", help = "Compare commits with another
Hoodie table")
- public String compareCommits(@CliOption(key = {"path"}, help = "Path of the
table to compare to") final String path)
- throws Exception {
+ public String compareCommits(@CliOption(key = {"path"}, help = "Path of the
table to compare to") final String path) {
HoodieTableMetaClient source = HoodieCLI.getTableMetaClient();
HoodieTableMetaClient target = new HoodieTableMetaClient(HoodieCLI.conf,
path);
HoodieTimeline targetTimeline =
target.getActiveTimeline().getCommitsTimeline().filterCompletedInstants();
HoodieTimeline sourceTimeline =
source.getActiveTimeline().getCommitsTimeline().filterCompletedInstants();
String targetLatestCommit =
- targetTimeline.getInstants().iterator().hasNext() ? "0" :
targetTimeline.lastInstant().get().getTimestamp();
+ targetTimeline.getInstants().iterator().hasNext() ?
targetTimeline.lastInstant().get().getTimestamp() : "0";
Review comment:
> this is a bug?
I think it is. When `hasNext` is true, we expect get the lastInstant, and
when it's false (instants is null), expect 0.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]