diff --git a/pyiceberg/expressions/visitors.py b/pyiceberg/expressions/visitors.py index 9eb2241643..26698921b5 100644 --- a/pyiceberg/expressions/visitors.py +++ b/pyiceberg/expressions/visitors.py @@ -1451,8 +1451,8 @@ def visit_bound_predicate(self, predicate: BoundPredicate[Any]) -> BooleanExpres # predicate. For example, ts = 2019-01-01T03:00:00 matches the hour projection but not # the day, but does match the original predicate. strict_projection = part.transform.strict_project(name=part.name, pred=predicate) - if incl_projection is not None: - result = Or(result, incl_projection) + if strict_projection is not None: + result = Or(result, strict_projection) return result diff --git a/pyiceberg/transforms.py b/pyiceberg/transforms.py index 606c3f415b..6dcae59e49 100644 --- a/pyiceberg/transforms.py +++ b/pyiceberg/transforms.py @@ -551,10 +551,10 @@ def project(self, name: str, pred: BoundPredicate[L]) -> Optional[UnboundPredica return pred.as_unbound(Reference(name)) elif isinstance(pred, BoundLiteralPredicate): return pred.as_unbound(Reference(name), pred.literal) - elif isinstance(pred, (BoundIn, BoundNotIn)): + elif isinstance(pred, BoundSetPredicate): return pred.as_unbound(Reference(name), pred.literals) else: - raise ValueError(f"Could not project: {pred}") + return None def strict_project(self, name: str, pred: BoundPredicate[Any]) -> Optional[UnboundPredicate[Any]]: if isinstance(pred, BoundUnaryPredicate): @@ -564,7 +564,7 @@ def strict_project(self, name: str, pred: BoundPredicate[Any]) -> Optional[Unbou elif isinstance(pred, BoundSetPredicate): return pred.as_unbound(Reference(name), pred.literals) else: - raise ValueError(f"Could not project: {pred}") + return None @property def preserves_order(self) -> bool: