Akash3121 commented on code in PR #10860:
URL: https://github.com/apache/paimon/pull/10860#discussion_r4438219302


##########
paimon-core/src/main/java/org/apache/paimon/table/FallbackReadFileStoreTable.java:
##########
@@ -246,7 +267,53 @@ public DataTableScan 
newFallbackScan(Function<FileStoreTable, DataTableScan> sca
         validateSchema();
         FileStoreTable first = wrappedFirst ? wrapped : other;
         FileStoreTable second = wrappedFirst ? other : wrapped;
-        return new FallbackReadScan(first, second, wrapped.schema(), 
scanCreator);
+        boolean otherIsEmpty =
+                other.coreOptions().scanSnapshotId() != null

Review Comment:
   [P1] Preserve the empty-branch decision across option rewriting and scan 
creation
   When `rewriteOtherOptions()` sees an empty branch, it leaves the requested 
snapshot ID in the copied options and relies on`newFallbackScan()` to check 
emptiness again. If the branch receives its first commit between `copy()` and 
`newScan()`, `latestSnapshotId()` is no longer null, so the empty scan is not 
used. Because the first new snapshot commonly has the requested ID `1`, the 
historical read silently includes data newer than the requested time even 
though `scan.fallback-branch.allow-earliest-snapshot` is false. A focused 
regression reproduced this exactly: expected `[1=10]`, but the PR returned 
`[1=10, 2=20]`. Persist the rewrite-time empty decision (or another explicit 
sentinel/resolved scan state) rather than inferring it again from mutable 
branch state at scan creation.



-- 
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]

Reply via email to