CTTY commented on code in PR #11947:
URL: https://github.com/apache/hudi/pull/11947#discussion_r1797748275
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/sources/HoodieIncrSource.java:
##########
@@ -212,35 +257,43 @@ public Pair<Option<Dataset<Row>>, String>
fetchNextBatch(Option<String> lastCkpt
.collect(Collectors.toMap(Pair::getLeft, Pair::getRight));
reader = reader.options(optionsMap);
}
+ boolean shouldFullScan =
+
queryContext.getActiveTimeline().isBeforeTimelineStartsByCompletionTime(startTime)
+ && missingCheckpointStrategy ==
MissingCheckpointStrategy.READ_UPTO_LATEST_COMMIT;
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);
if (snapshotLoadQuerySplitter.isPresent()) {
- queryInfo =
snapshotLoadQuerySplitter.get().getNextCheckpoint(snapshot, queryInfo,
sourceProfileSupplier);
+ queryContext =
snapshotLoadQuerySplitter.get().getNextCheckpoint(snapshot, queryContext,
sourceProfileSupplier);
+ // update endTime/next checkpoint
+ endTime =
queryContext.getEndInstant().orElse(queryContext.getLastInstant());
}
+ Set<String> validInstants = new HashSet<>(queryContext.getInstants());
+ snapshot =
queryContext.getPredicateFilter().map(snapshot::filter).orElse(snapshot);
Review Comment:
It's set in `IncrSourceHelper#withUpdatedCheckpoint`. This is hidden because
this feature is only available for `SnapshotLoadQuerySplitter`.
In the existing code, predicateFilter is set for `QueryInfo` in the same way
here:
https://github.com/apache/hudi/commit/7a242fec8d9d9f1fc1619a2b49d3ad931c10e35f#diff-8f93bd18cf9a608544e74b53ba4c379e0cd0ff4a763c28576ba2f5b651fc377bR87
--
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]