gty404 commented on code in PR #437:
URL: https://github.com/apache/iceberg-cpp/pull/437#discussion_r2647380257


##########
src/iceberg/table_metadata.cc:
##########
@@ -740,6 +898,57 @@ int32_t 
TableMetadataBuilder::Impl::ReuseOrCreateNewPartitionSpecId(
   return new_spec_id;
 }
 
+int32_t TableMetadataBuilder::Impl::ReuseOrCreateNewSchemaId(
+    const Schema& new_schema) const {
+  // if the schema already exists, use its id; otherwise use the highest id + 1
+  auto new_schema_id = 
metadata_.current_schema_id.value_or(Schema::kInitialSchemaId);
+  for (auto& schema : metadata_.schemas) {
+    auto schema_id = schema->schema_id().value_or(Schema::kInitialSchemaId);

Review Comment:
   Yes, we should give a default value when parsing the metadata JSON for an 
iceberg v1 table, and other fields should be handled similarly.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to