Skip to content

Commit 81ee6f6

Browse files
SteNicholasclaude
andcommitted
fix(test): let the fetch-failure inte test expect a converted missing file
TestWriteNullOnFetchFailureKeepsMissingFileFailing still asserted that a missing descriptor file fails the write when only 'blob-write-null-on-fetch-failure' is enabled. That is the behavior the previous commit deliberately removed: the FileSystem::Exists check that tells a missing file apart runs only when 'blob-write-null-on-missing-file' needs the classification, so with just the fetch-failure option a missing file is an ordinary open failure and is converted to a NULL element. Only the comment and the expected message were updated, so the test failed on CI in every build job. Rename it to TestWriteNullOnFetchFailureCoversMissingFile and assert the conversion the way the neighbouring write-null tests do: the write and commit succeed, both files keep the full row count, and the read merges them back into a row whose blob is NULL. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent ef3da8c commit 81ee6f6

1 file changed

Lines changed: 34 additions & 6 deletions

File tree

test/inte/blob_table_inte_test.cpp

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -766,9 +766,9 @@ TEST_P(BlobTableInteTest, TestWriteNullOnFetchFailure) {
766766
<< "expected:" << expected_with_rk->ToString();
767767
}
768768

769-
TEST_P(BlobTableInteTest, TestWriteNullOnFetchFailureKeepsMissingFileFailing) {
770-
// blob-write-null-on-fetch-failure does not cover a missing file, which is identified with
771-
// FileSystem::Exists and left to blob-write-null-on-missing-file.
769+
TEST_P(BlobTableInteTest, TestWriteNullOnFetchFailureCoversMissingFile) {
770+
// The existence check runs only under blob-write-null-on-missing-file, so with only
771+
// blob-write-null-on-fetch-failure a missing file is converted as an ordinary fetch failure.
772772
arrow::FieldVector fields = {arrow::field("f0", arrow::utf8()),
773773
arrow::field("f1", arrow::int32()),
774774
BlobUtils::ToArrowField("blob", true)};
@@ -788,16 +788,44 @@ TEST_P(BlobTableInteTest, TestWriteNullOnFetchFailureKeepsMissingFileFailing) {
788788

789789
std::string raw_json = R"([
790790
["str_0", 0, "blob_data_0"],
791-
["str_1", 1, "blob_data_1"]
791+
["str_1", 1, "blob_data_1"],
792+
["str_2", 2, "blob_data_2"]
792793
])";
793794
auto raw_array = std::dynamic_pointer_cast<arrow::StructArray>(
794795
arrow::ipc::internal::json::ArrayFromJSON(arrow::struct_(fields), raw_json).ValueOrDie());
795796
ASSERT_OK_AND_ASSIGN(auto desc_array, ConvertRawBlobToDescriptor(raw_array, {"blob"}));
796797
ASSERT_OK(DeleteDescriptorTarget(desc_array, "blob", /*row=*/1));
797798

798799
auto schema = arrow::schema(fields);
799-
ASSERT_NOK_WITH_MSG(WriteArray(table_path, {}, schema->field_names(), {desc_array}),
800-
"does not exist");
800+
ASSERT_OK_AND_ASSIGN(auto commit_msgs,
801+
WriteArray(table_path, {}, schema->field_names(), {desc_array}));
802+
ASSERT_OK(Commit(table_path, commit_msgs));
803+
804+
ASSERT_OK_AND_ASSIGN(auto plan, ScanTable(table_path));
805+
VerifyDataFileMetas(plan, /*expected_file_count=*/2, /*expected_row_counts=*/{3, 3},
806+
/*expected_min_seqs=*/{1, 1}, /*expected_max_seqs=*/{1, 1},
807+
/*expected_first_row_ids=*/{0, 0},
808+
/*expected_write_cols=*/
809+
{std::vector<std::string>{"f0", "f1"}, std::vector<std::string>{"blob"}});
810+
811+
ASSERT_OK_AND_ASSIGN(auto result, ReadTable(table_path, schema->field_names(), plan));
812+
ASSERT_TRUE(result.chunked_array);
813+
auto read_concat = arrow::Concatenate(result.chunked_array->chunks()).ValueOrDie();
814+
auto read_struct = std::dynamic_pointer_cast<arrow::StructArray>(read_concat);
815+
ASSERT_OK_AND_ASSIGN(auto resolved, ConvertDescriptorToRawBlob(read_struct, {"blob"}));
816+
817+
std::string expected_json = R"([
818+
["str_0", 0, "blob_data_0"],
819+
["str_1", 1, null],
820+
["str_2", 2, "blob_data_2"]
821+
])";
822+
auto expected_array = std::dynamic_pointer_cast<arrow::StructArray>(
823+
arrow::ipc::internal::json::ArrayFromJSON(arrow::struct_(fields), expected_json)
824+
.ValueOrDie());
825+
ASSERT_OK_AND_ASSIGN(auto expected_with_rk, PrependRowKindColumn(expected_array));
826+
ASSERT_TRUE(resolved->Equals(expected_with_rk))
827+
<< "result:" << resolved->ToString() << std::endl
828+
<< "expected:" << expected_with_rk->ToString();
801829
}
802830

803831
TEST_P(BlobTableInteTest, TestBasic) {

0 commit comments

Comments
 (0)