Skip to content
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

fix: schema comparaison in writer #1854

Closed
wants to merge 2 commits into from

Conversation

PierreDubrulle
Copy link
Contributor

Description

Improving scheme comparison

Related Issue(s)

@github-actions github-actions bot added the binding/python Issues for the Python package label Nov 13, 2023
@PierreDubrulle
Copy link
Contributor Author

Add a property to the DeltaTable class to expose the table schema hash

)
hash_schema_provided = _hash_schema(schema)

if hash_schema_provided != hash_table_schema and not (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should compare actual objects and not just hashes. It is still possible for hashes to collide, despite that being unlikely.

You could write a method to normalize schema order:

def normalize_schema_order(schema: pa.Schema) -> pa.Schema:
    fields = sorted(iter(schema), key=lambda field: field.name)
    return pa.schema(fields)

And then compare those. How does that sound?

ion-elgreco added a commit that referenced this pull request Feb 25, 2024
# Description
Supersedes this PR: #1854,
@PierreDubrulle thanks for pointing it out

# Related Issue(s)
- closes #1853
@ion-elgreco ion-elgreco closed this Mar 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
binding/python Issues for the Python package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Schema comparaison in writer
3 participants