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


##########
python/pyiceberg/transforms.py:
##########
@@ -173,6 +206,23 @@ def apply(self, value: Optional[S]) -> Optional[int]:
     def result_type(self, source: IcebergType) -> IcebergType:
         return IntegerType()
 
+    def project(self, name: str, pred: BoundPredicate) -> 
Optional[UnboundPredicate]:
+        transformer = self.transform(pred.term.ref().field.field_type)
+
+        if isinstance(pred.term, BoundTransform):
+            return _project_transform_predicate(self, name, pred)
+        elif isinstance(pred, BoundUnaryPredicate):
+            return pred.as_unbound(Reference(name))
+        elif isinstance(pred, BoundEqualTo):
+            return pred.as_unbound(Reference(name), 
_transform_literal(transformer, pred.literal))
+        elif isinstance(pred, BoundIn):  # NotIn can't be projected
+            return pred.as_unbound(Reference(name), 
{_transform_literal(transformer, literal) for literal in pred.literals})
+        else:
+            # - Comparison predicates can't be projected, notEq can't be 
projected
+            # - Small ranges can be projected:
+            #   For example, (x > 0) and (x < 3) can be turned into in({1, 2}) 
and projected.
+            return None

Review Comment:
   Looks correct to me.



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

Reply via email to