Re: [PR] fix(scan): handle missing latest snapshot in range errors [paimon-cpp]

2026-09-29 Thread via GitHub


lxy-9602 merged PR #398:
URL: https://github.com/apache/paimon-cpp/pull/398


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



[PR] fix(scan): handle missing latest snapshot in range errors [paimon-cpp]

2026-09-29 Thread via GitHub


QuakeWang opened a new pull request, #398:
URL: https://github.com/apache/paimon-cpp/pull/398

   ### Purpose
   
   When no snapshots remain and the next expected snapshot ID exceeds 1, the 
streaming scan dereferences an empty optional while formatting its range error, 
throwing std::bad_optional_access instead of returning Status::Invalid.
   
   Format the missing latest snapshot ID as null. Preserve existing range 
checks and snapshot lookup behavior.
   
   ### Tests
   
   - Added regression coverage for removed snapshots and range boundaries.
   - Seven isolated branch cases passed using real Result, Status, and fmt.
   - Test source compilation checks and pre-commit checks passed.
   - Full GoogleTest execution blocked by dependency download failures.
   
   ### API and Format
   
   No changes.
   
   ### Documentation
   
   Not required; bug fix only.
   
   ### Generative AI tooling
   
   Generated-by: OpenAI Codex (GPT-6)


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



Re: [PR] fix(scan): handle missing latest snapshot in range errors [paimon-cpp]

2026-09-29 Thread via GitHub


lxy-9602 commented on code in PR #398:
URL: https://github.com/apache/paimon-cpp/pull/398#discussion_r4131030263


##
src/paimon/core/table/source/table_scan_test.cpp:
##
@@ -76,6 +77,59 @@ TEST(TableScanTest, TestNonExistTable) {
 ASSERT_NOK_WITH_MSG(TableScan::Create(std::move(context)), "not found 
latest schema");
 }
 
+TEST(TableScanTest, TestStreamingSnapshotsRemoved) {
+auto dir = UniqueTestDirectory::Create("local");
+ASSERT_TRUE(dir);
+ASSERT_TRUE(TestUtil::CopyDirectory(GetDataDir() + 
"/orc/append_09.db/append_09", dir->Str()));
+ScanContextBuilder builder(dir->Str());
+builder.AddOption(Options::FILE_FORMAT, "orc")
+.AddOption(Options::SCAN_MODE, "latest")
+.WithStreamingMode(true);
+ASSERT_OK_AND_ASSIGN(std::unique_ptr context, 
builder.Finish());
+ASSERT_OK_AND_ASSIGN(std::unique_ptr table_scan,
+ TableScan::Create(std::move(context)));
+ASSERT_OK_AND_ASSIGN(std::shared_ptr initial_plan, 
table_scan->CreatePlan());
+ASSERT_TRUE(initial_plan->Splits().empty());
+ASSERT_OK_AND_ASSIGN(std::shared_ptr waiting_plan, 
table_scan->CreatePlan());
+ASSERT_TRUE(waiting_plan->Splits().empty());
+
+LocalFileSystem fs;
+ASSERT_OK(fs.Delete(dir->Str() + "/snapshot", /*recursive=*/true));
+auto result = table_scan->CreatePlan();
+ASSERT_FALSE(result.ok());
+ASSERT_TRUE(result.status().IsInvalid());
+ASSERT_NOK_WITH_MSG(result, "The next snapshot id is 6, while the latest 
snapshot id is null");

Review Comment:
   It should be sufficient to only assert
   `ASSERT_NOK_WITH_MSG(table_scan->CreatePlan(), "The next snapshot id is 6, 
while the latest snapshot id is null")`.



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