yihua commented on code in PR #11947:
URL: https://github.com/apache/hudi/pull/11947#discussion_r1802567703
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/sources/helpers/IncrSourceHelper.java:
##########
@@ -174,6 +170,64 @@ public static QueryInfo generateQueryInfo(JavaSparkContext
jssc, String srcBaseP
}
}
+ public static IncrementalQueryAnalyzer getIncrementalQueryAnalyzer(
+ JavaSparkContext jssc,
+ String srcPath,
+ Option<String> lastCkptStr,
+ MissingCheckpointStrategy missingCheckpointStrategy,
+ int numInstantsFromConfig,
+ Option<SourceProfile<Integer>> latestSourceProfile) {
+ HoodieTableMetaClient metaClient = HoodieTableMetaClient.builder()
+
.setConf(HadoopFSUtils.getStorageConfWithCopy(jssc.hadoopConfiguration()))
+ .setBasePath(srcPath)
+ .setLoadActiveTimelineOnLoad(true)
+ .build();
+
+ String startTime;
+ if (lastCkptStr.isPresent() && !lastCkptStr.get().isEmpty()) {
+ startTime = lastCkptStr.get();
+ } else if (missingCheckpointStrategy != null) {
+ switch (missingCheckpointStrategy) {
+ case READ_UPTO_LATEST_COMMIT:
+ startTime = DEFAULT_BEGIN_TIMESTAMP;
+ // disrespect numInstantsFromConfig when reading up to latest
+ numInstantsFromConfig = -1;
+ break;
+ case READ_LATEST:
+ Option<HoodieInstant> lastInstant = metaClient
+ .getCommitsAndCompactionTimeline()
+ .filterCompletedInstants()
+ .lastInstant();
+ startTime = lastInstant
+ .map(hoodieInstant ->
instantTimeMinusMillis(hoodieInstant.getCompletionTime(), 1))
Review Comment:
Makes sense. I've fixed `IncrSourceHelper#getIncrementalQueryAnalyzer`
based on the semantics we discussed.
--
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]