JingsongLi commented on code in PR #10860:
URL: https://github.com/apache/paimon/pull/10860#discussion_r4479121044
##########
paimon-core/src/main/java/org/apache/paimon/table/FallbackReadFileStoreTable.java:
##########
@@ -246,7 +276,55 @@ 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);
+ if (coreOptions().isChainTable()) {
+ return new FallbackReadScan(first, second, wrapped.schema(),
scanCreator);
+ }
+ boolean otherIsEmpty =
+ Objects.equals(other.coreOptions().scanSnapshotId(),
EMPTY_BRANCH_SNAPSHOT_ID);
Review Comment:
[P2] Skip schema comparison for the resolved empty branch. I created an
empty fallback branch, added a nullable column to that branch, and read main at
snapshot 1. The factory resolves the fallback to `-1`, but `validateSchema()`
runs first and the scan fails with a row-type mismatch. The branch has no
splits to interpret. Bypass its schema check when it resolves to empty and keep
validation for branches that may supply rows.
##########
paimon-core/src/main/java/org/apache/paimon/table/FileStoreTableFactory.java:
##########
@@ -104,19 +104,21 @@ public static FileStoreTable create(
table = createChainTable(table, fileIO, tablePath, dynamicOptions,
catalogEnvironment);
} else if (!StringUtils.isNullOrWhitespaceOnly(fallbackBranch)) {
FileStoreTable otherTable =
- createOtherBranchTable(
- fileIO, tablePath, fallbackBranch, dynamicOptions,
catalogEnvironment);
+ createOtherBranchTable(fileIO, tablePath, fallbackBranch,
catalogEnvironment);
if (otherTable != null) {
- table = new FallbackReadFileStoreTable(table, otherTable,
true);
+ table =
+ new FallbackReadFileStoreTable(table, otherTable, true)
+ .copy(dynamicOptions.toMap());
Review Comment:
[P1] Align snapshots selected by persisted table options. With
`scan.fallback-branch=other` and `scan.snapshot-id=1` saved in the main table
schema, the public `FileStoreTableFactory.create(fileIO, path)` passes an empty
dynamic map here. The main scan reads snapshot 1 while the other scan remains
on latest. In a local round trip I committed row `2=20` on `other` strictly
after snapshot 1, and the historical result was `[1=10, 2=20]` despite the
default `allow-earliest-snapshot=false`. This also applies to the primary
branch constructor. Resolve the effective selector from the main table options,
respecting overrides and removals, and cover a factory load with no dynamic
options.
--
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]