From ddc0815abe346666bc36c8017a0097052704d624 Mon Sep 17 00:00:00 2001 From: Xin Huang Date: Wed, 22 Jan 2025 11:26:33 -0800 Subject: [PATCH] update comments --- .../main/java/io/delta/kernel/internal/replay/LogReplay.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/kernel-api/src/main/java/io/delta/kernel/internal/replay/LogReplay.java b/kernel/kernel-api/src/main/java/io/delta/kernel/internal/replay/LogReplay.java index bba1c81bfc..b60fe11785 100644 --- a/kernel/kernel-api/src/main/java/io/delta/kernel/internal/replay/LogReplay.java +++ b/kernel/kernel-api/src/main/java/io/delta/kernel/internal/replay/LogReplay.java @@ -203,7 +203,8 @@ public CloseableIterator getAddFilesAsColumnarBatches( protected Tuple2 loadTableProtocolAndMetadata( Engine engine, Optional snapshotHint, long snapshotVersion) { - // Exit early if the hint already has the info we need + // If the snapshot hint is provided and matches the expected version, load the P&M from version hint. + // If not, e.g. for the case of time travel, skip use version hint and fallback to CRC file or log replay. if (snapshotHint.isPresent() && snapshotHint.get().getVersion() == snapshotVersion) { return new Tuple2<>(snapshotHint.get().getProtocol(), snapshotHint.get().getMetadata()); } @@ -224,6 +225,7 @@ protected Tuple2 loadTableProtocolAndMetadata( // for. We need to replay the actions to get the latest protocol and metadata, but // update the hint to read the actions from the version we found to check if the // protocol and metadata are updated in the versions after the one we found. + // Building a new snapshotHit for determining the time to end the log replay loop. snapshotHint = Optional.of( new SnapshotHint(crcInfo.getVersion(), crcInfo.getProtocol(), crcInfo.getMetadata()));