@@ -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
@@ -86,9 +91,12 @@ Result<std::unique_ptr<ManifestWriter>> ManifestWriter::MakeV1Writer(
8691Result<std::unique_ptr<ManifestWriter>> ManifestWriter::MakeV2Writer (
8792 std::optional<int64_t > snapshot_id, std::string_view manifest_location,
8893 std::shared_ptr<FileIO> file_io, std::shared_ptr<PartitionSpec> partition_spec,
89- ManifestContent content) {
94+ std::shared_ptr<Schema> current_schema, ManifestContent content) {
95+ if (manifest_location.empty () || !file_io || !partition_spec || !current_schema) {
96+ return InvalidArgument (" Invalid arguments to create V2 ManifestWriter" );
97+ }
9098 auto adapter = std::make_unique<ManifestEntryAdapterV2>(
91- snapshot_id, std::move (partition_spec), content);
99+ snapshot_id, std::move (partition_spec), std::move (current_schema), content);
92100 ICEBERG_RETURN_UNEXPECTED (adapter->Init ());
93101 ICEBERG_RETURN_UNEXPECTED (adapter->StartAppending ());
94102
@@ -102,9 +110,14 @@ Result<std::unique_ptr<ManifestWriter>> ManifestWriter::MakeV2Writer(
102110Result<std::unique_ptr<ManifestWriter>> ManifestWriter::MakeV3Writer (
103111 std::optional<int64_t > snapshot_id, std::optional<int64_t > first_row_id,
104112 std::string_view manifest_location, std::shared_ptr<FileIO> file_io,
105- std::shared_ptr<PartitionSpec> partition_spec, ManifestContent content) {
113+ std::shared_ptr<PartitionSpec> partition_spec, std::shared_ptr<Schema> current_schema,
114+ ManifestContent content) {
106115 auto adapter = std::make_unique<ManifestEntryAdapterV3>(
107- snapshot_id, first_row_id, std::move (partition_spec), content);
116+ snapshot_id, first_row_id, std::move (partition_spec), current_schema, content);
117+ if (manifest_location.empty () || !file_io || !partition_spec || !current_schema) {
118+ return InvalidArgument (" Invalid arguments to create V3 ManifestWriter" );
119+ }
120+
108121 ICEBERG_RETURN_UNEXPECTED (adapter->Init ());
109122 ICEBERG_RETURN_UNEXPECTED (adapter->StartAppending ());
110123
0 commit comments