danny0405 commented on code in PR #11947:
URL: https://github.com/apache/hudi/pull/11947#discussion_r1806001721
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/sources/HoodieIncrSource.java:
##########
@@ -212,35 +208,58 @@ public Pair<Option<Dataset<Row>>, String>
fetchNextBatch(Option<String> lastCkpt
.collect(Collectors.toMap(Pair::getLeft, Pair::getRight));
reader = reader.options(optionsMap);
}
+
+ boolean shouldFullScan =
+ missingCheckpointStrategy ==
MissingCheckpointStrategy.READ_UPTO_LATEST_COMMIT
+ && queryContext.getActiveTimeline()
+
.isBeforeTimelineStartsByCompletionTime(analyzer.getStartCompletionTime().get());
Dataset<Row> source;
- // Do Incr pull. Set end instant if available
- if (queryInfo.isIncremental()) {
- source = reader
- .options(readOpts)
- .option(QUERY_TYPE().key(), QUERY_TYPE_INCREMENTAL_OPT_VAL())
- .option(BEGIN_INSTANTTIME().key(), queryInfo.getStartInstant())
- .option(END_INSTANTTIME().key(), queryInfo.getEndInstant())
- .option(INCREMENTAL_FALLBACK_TO_FULL_TABLE_SCAN().key(),
- props.getString(INCREMENTAL_FALLBACK_TO_FULL_TABLE_SCAN().key(),
- INCREMENTAL_FALLBACK_TO_FULL_TABLE_SCAN().defaultValue()))
- .option(INCREMENTAL_READ_HANDLE_HOLLOW_COMMIT().key(),
handlingMode.name())
- .load(srcPath);
- } else {
- // if checkpoint is missing from source table, and if strategy is set to
READ_UPTO_LATEST_COMMIT, we have to issue snapshot query
+ if (instantRange.isEmpty() || shouldFullScan) {
+ // snapshot query
Dataset<Row> snapshot = reader
.options(readOpts)
.option(DataSourceReadOptions.QUERY_TYPE().key(),
DataSourceReadOptions.QUERY_TYPE_SNAPSHOT_OPT_VAL())
.load(srcPath);
+
+ Option<String> predicate = Option.empty();
+ List<String> instantTimeList = queryContext.getInstantTimeList();
if (snapshotLoadQuerySplitter.isPresent()) {
- queryInfo =
snapshotLoadQuerySplitter.get().getNextCheckpoint(snapshot, queryInfo,
sourceProfileSupplier);
+ Option<SnapshotLoadQuerySplitter.CheckpointWithPredicates>
newCheckpointAndPredicate =
+
snapshotLoadQuerySplitter.get().getNextCheckpointWithPredicates(snapshot,
queryContext);
+ if (newCheckpointAndPredicate.isPresent()) {
+ endCompletionTime = newCheckpointAndPredicate.get().endInstant;
+ predicate =
Option.of(newCheckpointAndPredicate.get().predicateFilter);
+ instantTimeList = queryContext.getInstants().stream()
+ .filter(instant -> HoodieTimeline.compareTimestamps(
+ instant.getCompletionTime(),
HoodieTimeline.LESSER_THAN_OR_EQUALS,
newCheckpointAndPredicate.get().endInstant))
Review Comment:
The analyzer already ensure all the instants returned are included in the
completion time range, so is this filtering redundant?
--
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]