Skip to content

Conversation

@kevinjqliu
Copy link
Contributor

@kevinjqliu kevinjqliu commented Mar 1, 2024

This PR modifies tests to explicitly check schema_id when comparing Schema.
Related to #290

Previously, many tests were written with implicit schema_id checks. For example,

    assert table.schema() == Schema(
        NestedField(field_id=1, name='id', field_type=LongType(), required=False),
        NestedField(field_id=2, name='event_ts', field_type=TimestampType(), required=False),
        NestedField(field_id=3, name='str', field_type=StringType(), required=False),
        NestedField(field_id=4, name='col_string', field_type=StringType(), required=False),
        schema_id=1,
        identifier_field_ids=[],
    )

Since Schema.__eq__ does not check for schema_id, we never check the schema_id of the Schema

@kevinjqliu kevinjqliu force-pushed the kevinjqliu/fix-schema-comparison branch from 18c6c53 to f9711b3 Compare March 2, 2024 19:22
@kevinjqliu kevinjqliu changed the title Kevinjqliu/fix schema comparison Tests should explicitly check for schema_id Mar 2, 2024
@kevinjqliu kevinjqliu marked this pull request as ready for review March 2, 2024 19:29
Copy link
Contributor

@Fokko Fokko left a comment

Choose a reason for hiding this comment

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

Thanks for updating the tests @kevinjqliu This would have caught the bug in #290 earlier 👍

@Fokko Fokko merged commit 9d01b02 into apache:main Mar 5, 2024
@kevinjqliu kevinjqliu deleted the kevinjqliu/fix-schema-comparison branch March 5, 2024 15:54
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.

2 participants