rdblue commented on code in PR #6128:
URL: https://github.com/apache/iceberg/pull/6128#discussion_r1022171762


##########
python/pyiceberg/transforms.py:
##########
@@ -511,6 +590,31 @@ def preserves_order(self) -> bool:
     def source_type(self) -> IcebergType:
         return self._source_type
 
+    def project(self, name: str, pred: BoundPredicate) -> 
Optional[UnboundPredicate]:
+        field_type = pred.term.ref().field.field_type
+
+        if isinstance(pred.term, BoundTransform):
+            return _project_transform_predicate(self, name, pred)
+
+        # Implement startswith and notstartswith for string (and probably 
binary)
+        # https://github.com/apache/iceberg/issues/6112
+
+        if isinstance(pred, BoundUnaryPredicate):
+            return pred.as_unbound(Reference(name))
+
+        if isinstance(field_type, (IntegerType, LongType, DecimalType)):
+            if isinstance(pred, BoundLiteralPredicate):
+                return _truncate_number(name, pred, self.transform(field_type))
+            elif isinstance(pred, BoundIn):
+                return _transform_set(name, pred, self.transform(field_type))

Review Comment:
   Minor: this case could be moved to the higher level since it is the same for 
both numeric and array types.



-- 
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