-
Notifications
You must be signed in to change notification settings - Fork 76
feat: add schema update to table metadata builder #437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
7836c3e to
62960f3
Compare
012079a to
16e797e
Compare
| } | ||
| } | ||
|
|
||
| // TODO(GuoTao.yu): Check default values when they are supported |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
No description provided.