You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Should fresh IdentifierFieldIds (Follow-up for PR2465) #2528
Follow-up for #2465
I've tested PR-2465, i found that we should fresh IdentifierFieldIds in org.apache.iceberg.types.TypeUtil#assignFreshIds just like what freshSortOrder did . @jackye1995@openinx
I thought about that, I think the situations are a bit different between the 2 cases.
For sort order and partition spec, it has an internal reference of the updated schema which is defined only locally by the caller. So new columns can be assigned any ID. When building the replacement based on the last schema, the assignFreshIds is called to assign the correct ID to each new column. Then the spec and order needs to be updated with those information.
For identifier, it is always referencing the schema it sits in. The identifier field ID is always resolved after the actual schema is built, so the field ID is already fresh.
Sorry I think I misunderstood what you meant a bit. So I agree that the identifier should be recreated after a new struct is created in TypeUtil#assignFreshIds. I thought you were talking about refreshing the identifier at the same place as sort order in TableMetadat#buildReplacement, sorry for the misunderstanding.
The new Schema created in that method should use the constructor new Schema(struct, identfierFieldIds) instead of the current new Schema(struct), and the identifier will be refreshed at that point of time. That will be done as a part of the subsequent PR, because there are many places using the schema constructors, I plan to change them in a single pass.
Activity
[-]Add `freshIdentifierFieldIds` in TableMetadata[/-][+]Should fresh `IdentifierFieldIds` (Follow-up for PR2465)[/+]jackye1995 commentedon Apr 27, 2021
I thought about that, I think the situations are a bit different between the 2 cases.
For sort order and partition spec, it has an internal reference of the updated schema which is defined only locally by the caller. So new columns can be assigned any ID. When building the replacement based on the last schema, the
assignFreshIdsis called to assign the correct ID to each new column. Then the spec and order needs to be updated with those information.For identifier, it is always referencing the schema it sits in. The identifier field ID is always resolved after the actual schema is built, so the field ID is already fresh.
jackye1995 commentedon Apr 28, 2021
Sorry I think I misunderstood what you meant a bit. So I agree that the identifier should be recreated after a new struct is created in
TypeUtil#assignFreshIds. I thought you were talking about refreshing the identifier at the same place as sort order inTableMetadat#buildReplacement, sorry for the misunderstanding.The new
Schemacreated in that method should use the constructornew Schema(struct, identfierFieldIds)instead of the currentnew Schema(struct), and the identifier will be refreshed at that point of time. That will be done as a part of the subsequent PR, because there are many places using the schema constructors, I plan to change them in a single pass.dixingxing0 commentedon Apr 28, 2021
Yes, i've changed the comment to avoid misleading, i'm looking forward to see the subsequent PR.