-
Notifications
You must be signed in to change notification settings - Fork 209
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
Add Refs metadata table #602
Conversation
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.
Looking good @geruh. I've left one small comment 👍
pyiceberg/table/__init__.py
Outdated
|
||
ref_schema = pa.schema([ | ||
pa.field('name', pa.string(), nullable=False), | ||
pa.field('type', pa.string(), nullable=False), |
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.
What do you think of changing this field into a categorical? https://pandas.pydata.org/docs/user_guide/categorical.html#series-creation
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.
Hey Fokko, I looked into this for both pandas and pyarrow and it offers a few benefits like reduced memory usage and improved performance on sorting and filtering. Since we're only dealing with branch
or tag
, this is ideal. However, this does stray from the Java implementation which uses a string type. But I think we should be fine with this difference, because in both pyarrow and pandas, this type seems to be well supported and can be easily converted to string if needed. Also, this would be beneficial for huge tables with many references.
In pyarrow, this would be implemented as a dictionary type mapping integers to strings. Also, this could be added to the other metadata tables such as the operation field in the snapshots table.
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.
Thanks, and yes, I agree that it is okay to diverge from the Java implementation here since it is just an implementation detail.
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.
Looks great, just a nit in the test from my side!
@geruh Thanks for creating this PR! Can you resolve the conflicts so we can get this in? Thanks! |
Thanks @geruh for working on this 🙌 |
This PR adds the Refs metadata table the existing inspect logic for Iceberg tables as listed in #511. The refs metadata table in Iceberg stores the table's known snapshot references including branches, and tags.
Usage