Fokko commented on code in PR #539: URL: https://github.com/apache/iceberg-python/pull/539#discussion_r1879010689
########## pyiceberg/transforms.py: ########## @@ -766,6 +858,47 @@ def _truncate_number( return None +def _truncate_number_strict( + name: str, pred: BoundLiteralPredicate[L], transform: Callable[[Optional[L]], Optional[L]] +) -> Optional[UnboundPredicate[Any]]: + boundary = pred.literal + + if not isinstance(boundary, (LongLiteral, DecimalLiteral, DateLiteral, TimestampLiteral)): + raise ValueError(f"Expected a numeric literal, got: {type(boundary)}") + + if isinstance(pred, BoundLessThan): + return LessThan(Reference(name), _transform_literal(transform, boundary)) + elif isinstance(pred, BoundLessThanOrEqual): + return LessThan(Reference(name), _transform_literal(transform, boundary.increment())) # type: ignore + elif isinstance(pred, BoundGreaterThan): + return GreaterThan(Reference(name), _transform_literal(transform, boundary)) + elif isinstance(pred, BoundGreaterThanOrEqual): + return GreaterThan(Reference(name), _transform_literal(transform, boundary.decrement())) # type: ignore Review Comment: Hey @ZENOTME Again, thanks for pointing this out. It turns out that most of these oddities are caused by a bug that was part of Iceberg `≤0.10.0`. We did not port this to PyIceberg: https://github.com/apache/iceberg/blob/ac6509a4e469f808bebb8b713a5c4213f98ff4a5/api/src/main/java/org/apache/iceberg/transforms/ProjectionUtil.java#L275 -- 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