TJX2014 commented on code in PR #6630:
URL: https://github.com/apache/hudi/pull/6630#discussion_r965606704
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/index/HoodieIndexUtils.java:
##########
@@ -72,6 +73,26 @@ public static List<HoodieBaseFile>
getLatestBaseFilesForPartition(
return Collections.emptyList();
}
+ /**
+ * Fetches Pair of partition path and {@link FileSlice}s for interested
partitions.
+ *
+ * @param partition Partition of interest
+ * @param hoodieTable Instance of {@link HoodieTable} of interest
+ * @return the list of {@link FileSlice}
+ */
+ public static List<FileSlice> getLatestFileSlicesForPartition(
+ final String partition,
+ final HoodieTable hoodieTable) {
+ Option<HoodieInstant> latestCommitTime =
hoodieTable.getMetaClient().getCommitsTimeline()
+ .filterCompletedInstants().lastInstant();
+ if (latestCommitTime.isPresent()) {
+ return hoodieTable.getHoodieView()
+ .getLatestFileSlicesBeforeOrOn(partition,
latestCommitTime.get().getTimestamp(), true)
+ .collect(toList());
Review Comment:
Seems a little hard, because the mor log file is written in hudi-flink
module, but only hudi-spark use HoodieIndexUtils.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]