danny0405 commented on code in PR #17562:
URL: https://github.com/apache/hudi/pull/17562#discussion_r2625573288
##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/source/IncrementalInputSplits.java:
##########
@@ -303,6 +310,33 @@ public Result inputSplits(
}
}
+ /**
+ * Returns the incremental Hoodie source split batch.
+ *
+ * @param metaClient The meta client
+ * @param startInstant The start Instant of the splits
+ * @param cdcEnabled Whether cdc is enabled
+ *
+ * @return The list of incremental input splits or empty if there are no new
instants
+ */
+ public HoodieContinuousSplitBatch inputHoodieSourceSplits(
+ HoodieTableMetaClient metaClient,
+ @Nullable String startInstant,
+ boolean cdcEnabled) {
+ Result result = inputSplits(metaClient, startInstant, cdcEnabled);
+ List<HoodieSourceSplit> splits = result.inputSplits.stream().map(split ->
+ new HoodieSourceSplit(
+ HoodieSourceSplit.SPLIT_COUNTER.incrementAndGet(),
+ split.getBasePath().orElse(null),
+ split.getLogPaths(), split.getTablePath(),
+ split.getMergeType(), split.getFileId()
+ )
+ ).collect(Collectors.toList());
+
+ return new HoodieContinuousSplitBatch(splits, startInstant == null ?
this.conf.get(FlinkOptions.READ_START_COMMIT) : startInstant,
Review Comment:
can we just add a static method
`HoodieContinuousSplitBatch#fromResult(Result result)` and hide the
transformation, also we should just copy the `result.getEndInstant()` and
`result.getOffset()` and eliminate the additional check here?
--
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]