yihua commented on code in PR #11947:
URL: https://github.com/apache/hudi/pull/11947#discussion_r1806033883
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/sources/helpers/IncrSourceHelper.java:
##########
@@ -174,6 +168,63 @@ 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 beginCompletionTime;
Review Comment:
Fixed.
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/sources/helpers/IncrSourceHelper.java:
##########
@@ -174,6 +168,63 @@ 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 beginCompletionTime;
+ RangeType rangeType;
+
+ if (lastCkptStr.isPresent() && !lastCkptStr.get().isEmpty()) {
+ beginCompletionTime = lastCkptStr.get();
+ rangeType = RangeType.OPEN_CLOSED;
+ } else if (missingCheckpointStrategy != null) {
+ rangeType = RangeType.CLOSED_CLOSED;
+ switch (missingCheckpointStrategy) {
+ case READ_UPTO_LATEST_COMMIT:
+ beginCompletionTime = DEFAULT_BEGIN_TIMESTAMP;
+ // disrespect numInstantsFromConfig when reading up to latest
+ numInstantsFromConfig = -1;
+ break;
+ case READ_LATEST:
+ // rely on IncrementalQueryAnalyzer to use the latest completed
instant
+ beginCompletionTime = null;
+ break;
+ default:
+ throw new IllegalArgumentException("Unknown missing checkpoint
strategy: " + missingCheckpointStrategy);
+ }
+ } else {
+ throw new IllegalArgumentException("Missing begin instant for
incremental pull. For reading from latest "
Review Comment:
Fixed.
--
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]