Skip to content

Conversation

@gty404
Copy link
Contributor

@gty404 gty404 commented Dec 24, 2025

No description provided.

}
}

// TODO(GuoTao.yu): Check default values when they are supported
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we need to add the Java Schema.validateIdentifierField and call it from here?

cc @WZhuo

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Schema.validateIdentifierField should be called in Schema::Make, I can do it in a seperate PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is equivalent to java's checkCompatibility, which only checks types and default values.

// 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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we need to change Schema::schema_id to use int32_t instead of std::optional<int32_t>? It seems that we have to deal with nullopt in all places. PartitionSpec and SortOrder do not use optional for ids and Java schema uses 0 as the default. Of course we can do this in a separate PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants