zjw1111 commented on code in PR #280:
URL: https://github.com/apache/paimon-cpp/pull/280#discussion_r3966326290
##########
src/paimon/core/table/source/table_scan.cpp:
##########
@@ -255,8 +255,12 @@ Status ValidateRealtimeScan(const TableSchema&
table_schema, const CoreOptions&
return Status::Invalid("real-time union read does not support global
index splits");
}
StartupMode startup_mode = core_options.GetStartupMode();
- if (!(startup_mode == StartupMode::LatestFull() || startup_mode ==
StartupMode::Latest())) {
- return Status::Invalid("real-time union read requires the latest
snapshot");
+ const bool specified_snapshot =
Review Comment:
[P1] Reject a nonexistent explicit snapshot
When the table has no disk snapshots, `StaticFromSnapshotStartingScanner`
returns `NoSnapshot`. The resulting empty plan has no `SnapshotId`, so
`RealtimeTableScan::LoadCommittedOffsets` treats it as offset 0 and unions all
current memory rows. As a result, setting any nonexistent `scan.snapshot-id`
can succeed and return uncommitted data while the plan's snapshot ID is empty.
Please reject this case when an explicit snapshot was requested (or make the
static scanner fail when no snapshot exists), and add coverage for an empty
table with in-memory rows plus `scan.snapshot-id`. Java, Python, and Rust all
reject an explicit ID that does not exist.
--
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]