Skip to content

Should fresh IdentifierFieldIds (Follow-up for PR2465) #2528

Closed

Description

@dixingxing0

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

Activity

  1. changed the title [-]Add `freshIdentifierFieldIds` in TableMetadata[/-] [+]Should fresh `IdentifierFieldIds` (Follow-up for PR2465)[/+] on Apr 27, 2021
  2. jackye1995 commented on Apr 27, 2021

    @jackye1995
    Contributor

    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.

  3. jackye1995 commented on Apr 28, 2021

    @jackye1995
    Contributor

    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.

  4. dixingxing0 commented on Apr 28, 2021

    @dixingxing0
    ContributorAuthor

    Yes, i've changed the comment to avoid misleading, i'm looking forward to see the subsequent PR.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions