@@ -70,9 +70,23 @@ 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 ()) {
76+ return InvalidArgument (" Manifest location cannot be empty" );
77+ }
78+ if (!file_io) {
79+ return InvalidArgument (" FileIO cannot be null" );
80+ }
81+ if (!partition_spec) {
82+ return InvalidArgument (" PartitionSpec cannot be null" );
83+ }
84+ if (!current_schema) {
85+ return InvalidArgument (" Current schema cannot be null" );
86+ }
87+
88+ auto adapter = std::make_unique<ManifestEntryAdapterV1>(
89+ snapshot_id, std::move (partition_spec), std::move (current_schema));
7690 ICEBERG_RETURN_UNEXPECTED (adapter->Init ());
7791 ICEBERG_RETURN_UNEXPECTED (adapter->StartAppending ());
7892
@@ -86,9 +100,21 @@ Result<std::unique_ptr<ManifestWriter>> ManifestWriter::MakeV1Writer(
86100Result<std::unique_ptr<ManifestWriter>> ManifestWriter::MakeV2Writer (
87101 std::optional<int64_t > snapshot_id, std::string_view manifest_location,
88102 std::shared_ptr<FileIO> file_io, std::shared_ptr<PartitionSpec> partition_spec,
89- ManifestContent content) {
103+ std::shared_ptr<Schema> current_schema, ManifestContent content) {
104+ if (manifest_location.empty ()) {
105+ return InvalidArgument (" Manifest location cannot be empty" );
106+ }
107+ if (!file_io) {
108+ return InvalidArgument (" FileIO cannot be null" );
109+ }
110+ if (!partition_spec) {
111+ return InvalidArgument (" PartitionSpec cannot be null" );
112+ }
113+ if (!current_schema) {
114+ return InvalidArgument (" Current schema cannot be null" );
115+ }
90116 auto adapter = std::make_unique<ManifestEntryAdapterV2>(
91- snapshot_id, std::move (partition_spec), content);
117+ snapshot_id, std::move (partition_spec), std::move (current_schema), content);
92118 ICEBERG_RETURN_UNEXPECTED (adapter->Init ());
93119 ICEBERG_RETURN_UNEXPECTED (adapter->StartAppending ());
94120
@@ -102,9 +128,23 @@ Result<std::unique_ptr<ManifestWriter>> ManifestWriter::MakeV2Writer(
102128Result<std::unique_ptr<ManifestWriter>> ManifestWriter::MakeV3Writer (
103129 std::optional<int64_t > snapshot_id, std::optional<int64_t > first_row_id,
104130 std::string_view manifest_location, std::shared_ptr<FileIO> file_io,
105- std::shared_ptr<PartitionSpec> partition_spec, ManifestContent content) {
131+ std::shared_ptr<PartitionSpec> partition_spec, std::shared_ptr<Schema> current_schema,
132+ ManifestContent content) {
133+ if (manifest_location.empty ()) {
134+ return InvalidArgument (" Manifest location cannot be empty" );
135+ }
136+ if (!file_io) {
137+ return InvalidArgument (" FileIO cannot be null" );
138+ }
139+ if (!partition_spec) {
140+ return InvalidArgument (" PartitionSpec cannot be null" );
141+ }
142+ if (!current_schema) {
143+ return InvalidArgument (" Current schema cannot be null" );
144+ }
106145 auto adapter = std::make_unique<ManifestEntryAdapterV3>(
107- snapshot_id, first_row_id, std::move (partition_spec), content);
146+ snapshot_id, first_row_id, std::move (partition_spec), std::move (current_schema),
147+ content);
108148 ICEBERG_RETURN_UNEXPECTED (adapter->Init ());
109149 ICEBERG_RETURN_UNEXPECTED (adapter->StartAppending ());
110150
0 commit comments