From 91daa7da589258ef1a7fd86c7f1ebf9da07e190b Mon Sep 17 00:00:00 2001 From: Lin Liu <141371752+linliu-code@users.noreply.github.com> Date: Tue, 28 Nov 2023 19:03:50 -0800 Subject: [PATCH] [HUDI-7102] Fix bugs related to time travel queries (#10102) --- .../hudi/common/table/log/BaseHoodieLogRecordReader.java | 2 +- .../src/main/scala/org/apache/hudi/DefaultSource.scala | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/hudi-common/src/main/java/org/apache/hudi/common/table/log/BaseHoodieLogRecordReader.java b/hudi-common/src/main/java/org/apache/hudi/common/table/log/BaseHoodieLogRecordReader.java index 300b767ab704..3f2ceefaf583 100644 --- a/hudi-common/src/main/java/org/apache/hudi/common/table/log/BaseHoodieLogRecordReader.java +++ b/hudi-common/src/main/java/org/apache/hudi/common/table/log/BaseHoodieLogRecordReader.java @@ -260,7 +260,7 @@ private void scanInternalV1(Option keySpecOpt) { && !HoodieTimeline.compareTimestamps(logBlock.getLogBlockHeader().get(INSTANT_TIME), HoodieTimeline.LESSER_THAN_OR_EQUALS, this.latestInstantTime )) { // hit a block with instant time greater than should be processed, stop processing further - break; + continue; } if (logBlock.getBlockType() != CORRUPT_BLOCK && logBlock.getBlockType() != COMMAND_BLOCK) { if (!completedInstantsTimeline.containsOrBeforeTimelineStarts(instantTime) diff --git a/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/DefaultSource.scala b/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/DefaultSource.scala index c619f61cb2c6..0c8f45c335e2 100644 --- a/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/DefaultSource.scala +++ b/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/DefaultSource.scala @@ -270,8 +270,7 @@ object DefaultSource { new IncrementalRelation(sqlContext, parameters, userSchema, metaClient) case (MERGE_ON_READ, QUERY_TYPE_SNAPSHOT_OPT_VAL, false) => - val isTimeTravelQuery = parameters.contains(TIME_TRAVEL_AS_OF_INSTANT.key()) - if (fileFormatUtils.isDefined && !isTimeTravelQuery) { + if (fileFormatUtils.isDefined) { new HoodieMergeOnReadSnapshotHadoopFsRelationFactory( sqlContext, metaClient, parameters, userSchema, isBootstrap = false).build() } else {