diff --git a/pyiceberg/transforms.py b/pyiceberg/transforms.py index cd0d7cebcb..60a76014c3 100644 --- a/pyiceberg/transforms.py +++ b/pyiceberg/transforms.py @@ -895,16 +895,7 @@ def truncate_func(v: Any) -> Any: return lambda v: truncate_func(v) if v is not None else None def satisfies_order_of(self, other: Transform[S, T]) -> bool: - if self == other: - return True - elif ( - isinstance(self.source_type, StringType) - and isinstance(other, TruncateTransform) - and isinstance(other.source_type, StringType) - ): - return self.width >= other.width - - return False + return isinstance(other, TruncateTransform) and self.width >= other.width def to_human_string(self, _: IcebergType, value: S | None) -> str: if value is None: diff --git a/tests/test_transforms.py b/tests/test_transforms.py index d296fcdb21..53ed033bcf 100644 --- a/tests/test_transforms.py +++ b/tests/test_transforms.py @@ -512,6 +512,11 @@ def test_truncate_method(type_var: PrimitiveType, value: Any, expected_human_str assert truncate_transform.satisfies_order_of(truncate_transform) +def test_truncate_satisfies_order_of() -> None: + assert TruncateTransform(5).satisfies_order_of(TruncateTransform(3)) + assert not TruncateTransform(3).satisfies_order_of(TruncateTransform(5)) + + def test_unknown_transform() -> None: unknown_transform = UnknownTransform("unknown") # type: ignore assert str(unknown_transform) == str(eval(repr(unknown_transform)))