@@ -70,9 +70,14 @@ Result<std::unique_ptr<Writer>> OpenFileWriter(
7070
7171Result<std::unique_ptr<ManifestWriter>> ManifestWriter::MakeV1Writer (
7272 std::optional<int64_t > snapshot_id, std::string_view manifest_location,
73- std::shared_ptr<FileIO> file_io, std::shared_ptr<PartitionSpec> partition_spec) {
74- auto adapter =
75- std::make_unique<ManifestEntryAdapterV1>(snapshot_id, std::move (partition_spec));
73+ std::shared_ptr<FileIO> file_io, std::shared_ptr<PartitionSpec> partition_spec,
74+ std::shared_ptr<Schema> current_schema) {
75+ if (manifest_location.empty () || !file_io || !partition_spec || !current_schema) {
76+ return InvalidArgument (" Invalid arguments to create V1 ManifestWriter" );
77+ }
78+
79+ auto adapter = std::make_unique<ManifestEntryAdapterV1>(
80+ snapshot_id, std::move (partition_spec), std::move (current_schema));
7681 ICEBERG_RETURN_UNEXPECTED (adapter->Init ());
7782 ICEBERG_RETURN_UNEXPECTED (adapter->StartAppending ());
7883
@@ -85,10 +90,12 @@ Result<std::unique_ptr<ManifestWriter>> ManifestWriter::MakeV1Writer(
8590
8691Result<std::unique_ptr<ManifestWriter>> ManifestWriter::MakeV2Writer (
8792 std::optional<int64_t > snapshot_id, std::string_view manifest_location,
88- std::shared_ptr<FileIO> file_io, std::shared_ptr<PartitionSpec> partition_spec,
89- ManifestContent content) {
93+ std::shared_ptr<FileIO> file_io, std::shared_ptr<PartitionSpec> partition_spec, std::shared_ptr<Schema> current_schema, ManifestContent content) {
94+ if (manifest_location.empty () || !file_io || !partition_spec || !current_schema) {
95+ return InvalidArgument (" Invalid arguments to create V2 ManifestWriter" );
96+ }
9097 auto adapter = std::make_unique<ManifestEntryAdapterV2>(
91- snapshot_id, std::move (partition_spec), content);
98+ snapshot_id, std::move (partition_spec), std::move (current_schema), content);
9299 ICEBERG_RETURN_UNEXPECTED (adapter->Init ());
93100 ICEBERG_RETURN_UNEXPECTED (adapter->StartAppending ());
94101
@@ -102,9 +109,13 @@ Result<std::unique_ptr<ManifestWriter>> ManifestWriter::MakeV2Writer(
102109Result<std::unique_ptr<ManifestWriter>> ManifestWriter::MakeV3Writer (
103110 std::optional<int64_t > snapshot_id, std::optional<int64_t > first_row_id,
104111 std::string_view manifest_location, std::shared_ptr<FileIO> file_io,
105- std::shared_ptr<PartitionSpec> partition_spec, ManifestContent content) {
112+ std::shared_ptr<PartitionSpec> partition_spec, std::shared_ptr<Schema> current_schema, ManifestContent content) {
106113 auto adapter = std::make_unique<ManifestEntryAdapterV3>(
107- snapshot_id, first_row_id, std::move (partition_spec), content);
114+ snapshot_id, first_row_id, std::move (partition_spec), current_schema, content);
115+ if (manifest_location.empty () || !file_io || !partition_spec || !current_schema) {
116+ return InvalidArgument (" Invalid arguments to create V3 ManifestWriter" );
117+ }
118+
108119 ICEBERG_RETURN_UNEXPECTED (adapter->Init ());
109120 ICEBERG_RETURN_UNEXPECTED (adapter->StartAppending ());
110121
0 commit comments