rambleraptor commented on code in PR #4004:
URL: https://github.com/apache/iceberg-python/pull/4004#discussion_r4067821411
##########
pyiceberg/expressions/__init__.py:
##########
@@ -698,6 +698,11 @@ class SetPredicate(UnboundPredicate, ABC):
def __init__(
self, term: str | UnboundTerm, literals: Iterable[Any] |
Iterable[LiteralValue] | None = None, **kwargs: Any
) -> None:
+ # `In.__new__` and `NotIn.__new__` have to build the literal set to
pick the predicate
+ # class, so they initialize the instance with it. Without this guard
the set is built twice.
+ if hasattr(self, "literals"):
Review Comment:
This feels like a code smell to me. If this particular object already has
literals set, then we shouldn't be calling the constructor on it again.
--
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]