rdblue commented on code in PR #4742: URL: https://github.com/apache/iceberg/pull/4742#discussion_r884295152
########## python/src/iceberg/schema.py: ########## @@ -62,8 +62,23 @@ def __repr__(self): f"Schema(fields={repr(self.columns)}, schema_id={self.schema_id}, identifier_field_ids={self.identifier_field_ids})" ) + def __eq__(self, other) -> bool: + if not other: + return False + + if not isinstance(other, Schema): + return False + + if len(self.columns) != len(other.columns): + return False + + identifier_field_ids_is_equal = self.identifier_field_ids == other.identifier_field_ids + schema_is_equal = all([lhs == rhs for lhs, rhs in zip(self.columns, other.columns)]) + + return identifier_field_ids_is_equal and schema_is_equal + @property - def columns(self) -> Iterable[NestedField]: + def columns(self) -> Tuple[NestedField]: Review Comment: Should this be `Tuple[NestedField, ...]` since it isn't a single field in the tuple? From the [typing.Tuple docs](https://docs.python.org/3/library/typing.html#typing.Tuple): > To specify a variable-length tuple of homogeneous type, use literal ellipsis, e.g. Tuple[int, ...] -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org