Fokko commented on code in PR #5124:
URL: https://github.com/apache/iceberg/pull/5124#discussion_r917904928


##########
python/pyiceberg/transforms.py:
##########
@@ -96,6 +127,38 @@ def dedup_name(self) -> str:
     def __str__(self) -> str:
         return self.__root__
 
+    def __eq__(self, other: Any) -> bool:
+        if isinstance(other, Transform):
+            return self.__root__ == other.__root__
+        return False
+
+
+class UnboundTransform(Transform):

Review Comment:
   If I understand correctly, this is what we already have for each of the 
classes of Transforms:
   ```python
   def bucket(source_type: IcebergType, num_buckets: int) -> 
BaseBucketTransform:
       if type(source_type) in {IntegerType, LongType, DateType, TimeType, 
TimestampType, TimestamptzType}:
           return BucketNumberTransform(source_type, num_buckets)
       elif isinstance(source_type, DecimalType):
           return BucketDecimalTransform(source_type, num_buckets)
       elif isinstance(source_type, StringType):
           return BucketStringTransform(source_type, num_buckets)
       elif isinstance(source_type, BinaryType):
           return BucketBytesTransform(source_type, num_buckets)
       elif isinstance(source_type, FixedType):
           return BucketBytesTransform(source_type, num_buckets)
       elif isinstance(source_type, UUIDType):
           return BucketUUIDTransform(source_type, num_buckets)
       else:
           raise ValueError(f"Cannot bucket by type: {source_type}")
   ```
   This is actually called on the `.bind()` method by the transform:
   ```python
   bind_func = functools.partial(bucket, 
num_buckets=BaseBucketTransform.parse(v))
   ```
   As soon as the source_type is known, we can invoke the method and get the 
actual implementation.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to