Skip to content

fix: Fallback to field.name to get field position when PARQUET:field_id is unavailable #1561

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

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

CTTY
Copy link
Contributor

@CTTY CTTY commented Jul 30, 2025

Which issue does this PR close?

What changes are included in this PR?

  • Fallback to use field.name to get field position
  • Minor typo fixes

Are these changes tested?

Yes, added uts

@liurenjie1024
Copy link
Contributor

Let's discuss in this issue: #1560 (comment)

.map(|id| id == field.id)
.unwrap_or(false)
})
.position(|arrow_field| self.arrow_field_matches_id(arrow_field, field.id))
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 we still have misunderstanding here. As I have said #1560 (comment) , for the nan_val_cnt case, we should match field to arrow array using the field's position(e.g. the rank of this field in struct) rather than by id or name. It's not easy to accomplish with currentl interface, so we should change the interface of PartnerAccessor, see comments below.

@Fokko
Copy link
Contributor

Fokko commented Aug 6, 2025

@CTTY Thanks for raising this PR, as suggested in #1560 I think we need to rely on name-mapping here.

Iceberg is designed to do operations lazy, meaning that we typically don't rewrite data unless it is neccessary. For example, if you rename a field, it will still find the field with the original name using the field-IDs. This is the case when you have a new table that has the field-IDs correctly set.

However, in the age of big-data, and to make it easier for users to migrate to Iceberg, we also support importing existing Parquet files where the field-IDs are missing. In this case, we'll use name-mapping to map names to a field-ID. In the case of a rename, the old and the new name will map to the same ID, so we can still look up the field after a rename.

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.

Need to use field.name to determine arrow field's position when PARQUET:field_id is unavailable
4 participants