Ayoubhm07 commented on code in PR #4004:
URL: https://github.com/apache/iceberg-python/pull/4004#discussion_r4070164887
##########
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:
Fair point ^^ I dropped the guard....python always runs __init__ after
__new__ returns an instance so __new__ now hands over the set it built and
__init__ runs once +++ looking into it also surfaced a bug on main :: an In
built from a generator comes out empty because __new__ consumes the iterator
before __init__ reads it so the filter silently matches nothing... Regression
tests added, same speedup
--
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]