@@ -82,6 +82,48 @@ class ManifestListReaderTest : public TempFileTestBase {
8282 return manifest_files;
8383 }
8484
85+ std::vector<ManifestFile> PrepareV2NonPartitionedTestManifestList () {
86+ std::vector<ManifestFile> manifest_files;
87+ std::string test_dir_prefix =
88+ " /tmp/db/db/v2_non_partitioned_test/metadata/" ;
89+
90+ std::vector<std::string> paths = {
91+ " ccb6dbcb-0611-48da-be68-bd506ea63188-m0.avro" ,
92+ " b89a10c9-a7a8-4526-99c5-5587a4ea7527-m0.avro" ,
93+ " a74d20fa-c800-4706-9ddb-66be15a5ecb0-m0.avro" ,
94+ " ae7d5fce-7245-4335-9b57-bc598c595c84-m0.avro"
95+ };
96+
97+ std::vector<int64_t > file_size = {7169 , 7170 , 7169 , 7170 };
98+
99+ std::vector<int64_t > snapshot_id = {
100+ 251167482216575399 ,
101+ 4248697313956014690 ,
102+ 281757490425433194 ,
103+ 5521202581490753283
104+ };
105+
106+ for (int i = 0 ; i < 4 ; ++i) {
107+ ManifestFile manifest_file;
108+ manifest_file.manifest_path = test_dir_prefix + paths[i];
109+ manifest_file.manifest_length = file_size[i];
110+ manifest_file.partition_spec_id = 0 ;
111+ manifest_file.content = ManifestFile::Content::kData ;
112+ manifest_file.sequence_number = 4 - i;
113+ manifest_file.min_sequence_number = 4 - i;
114+ manifest_file.added_snapshot_id = snapshot_id[i];
115+ manifest_file.added_files_count = 1 ;
116+ manifest_file.existing_files_count = 0 ;
117+ manifest_file.deleted_files_count = 0 ;
118+ manifest_file.added_rows_count = 1 ;
119+ manifest_file.existing_rows_count = 0 ;
120+ manifest_file.deleted_rows_count = 0 ;
121+
122+ manifest_files.emplace_back (manifest_file);
123+ }
124+ return manifest_files;
125+ }
126+
85127 std::shared_ptr<::arrow::fs::LocalFileSystem> local_fs_;
86128 std::shared_ptr<FileIO> file_io_;
87129};
@@ -100,4 +142,28 @@ TEST_F(ManifestListReaderTest, BasicTest) {
100142 ASSERT_EQ (read_result.value (), expected_manifest_list);
101143}
102144
145+ TEST_F (ManifestListReaderTest, V2NonPartitionedTest) {
146+ std::string path = GetResourcePath (
147+ " snap-251167482216575399-1-ccb6dbcb-0611-48da-be68-bd506ea63188.avro" );
148+
149+ auto manifest_reader_result = ManifestListReader::MakeReader (path, file_io_);
150+ ASSERT_EQ (manifest_reader_result.has_value (), true );
151+
152+ auto manifest_reader =
153+ std::move (manifest_reader_result.value ());
154+ auto read_result = manifest_reader->Files ();
155+ ASSERT_EQ (read_result.has_value (), true );
156+ ASSERT_EQ (read_result.value ().size (), 4 );
157+
158+ auto expected_manifest_list = PrepareV2NonPartitionedTestManifestList ();
159+ ASSERT_EQ (read_result.value (), expected_manifest_list);
160+
161+ // test all the manifest files are non-partitioned
162+ for (const auto & manifest : read_result.value ()) {
163+ ASSERT_EQ (manifest.partition_spec_id , 0 );
164+ ASSERT_TRUE (manifest.partitions .empty ()); //
165+ ASSERT_EQ (manifest.content , ManifestFile::Content::kData );
166+ }
167+ }
168+
103169} // namespace iceberg
0 commit comments