Skip to content

Commit eb0e134

Browse files
committed
add detailed check
1 parent 8455f61 commit eb0e134

File tree

2 files changed

+33
-8
lines changed

2 files changed

+33
-8
lines changed

src/iceberg/manifest_writer.cc

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,17 @@ Result<std::unique_ptr<ManifestWriter>> ManifestWriter::MakeV1Writer(
7272
std::optional<int64_t> snapshot_id, std::string_view manifest_location,
7373
std::shared_ptr<FileIO> file_io, std::shared_ptr<PartitionSpec> partition_spec,
7474
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");
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");
7786
}
7887

7988
auto adapter = std::make_unique<ManifestEntryAdapterV1>(
@@ -92,8 +101,17 @@ Result<std::unique_ptr<ManifestWriter>> ManifestWriter::MakeV2Writer(
92101
std::optional<int64_t> snapshot_id, std::string_view manifest_location,
93102
std::shared_ptr<FileIO> file_io, std::shared_ptr<PartitionSpec> partition_spec,
94103
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");
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");
97115
}
98116
auto adapter = std::make_unique<ManifestEntryAdapterV2>(
99117
snapshot_id, std::move(partition_spec), std::move(current_schema), content);
@@ -114,10 +132,18 @@ Result<std::unique_ptr<ManifestWriter>> ManifestWriter::MakeV3Writer(
114132
ManifestContent content) {
115133
auto adapter = std::make_unique<ManifestEntryAdapterV3>(
116134
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");
135+
if (manifest_location.empty()) {
136+
return InvalidArgument("Manifest location cannot be empty");
137+
}
138+
if (!file_io) {
139+
return InvalidArgument("FileIO cannot be null");
140+
}
141+
if (!partition_spec) {
142+
return InvalidArgument("PartitionSpec cannot be null");
143+
}
144+
if (!current_schema) {
145+
return InvalidArgument("Current schema cannot be null");
119146
}
120-
121147
ICEBERG_RETURN_UNEXPECTED(adapter->Init());
122148
ICEBERG_RETURN_UNEXPECTED(adapter->StartAppending());
123149

src/iceberg/table_scan.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,6 @@ Result<std::vector<std::shared_ptr<FileScanTask>>> DataTableScan::PlanFiles() co
270270

271271
std::vector<std::shared_ptr<FileScanTask>> tasks;
272272
ICEBERG_ASSIGN_OR_RAISE(auto partition_spec, context_.table_metadata->PartitionSpec());
273-
// auto partition_schema = context_.table_metadata->Schema().value();
274273

275274
// Get the table schema and partition type
276275
ICEBERG_ASSIGN_OR_RAISE(auto current_schema, context_.table_metadata->Schema());

0 commit comments

Comments
 (0)