-
Notifications
You must be signed in to change notification settings - Fork 551
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extract predicate filtering from data model #1079
Extract predicate filtering from data model #1079
Conversation
@@ -225,6 +225,20 @@ def _sample_indices(self, sample_size: int) -> Iterable[RecordIDPair]: | |||
return sample_ids | |||
|
|||
|
|||
def _filter_canopy_predicates( | |||
predicates: Iterable[Predicate], canopies: bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fgregg this preserves the logic that was here before, but I wanted to check that this actually is the logic that we want. I was wondering if this was actually intending to filter out canopies? Because that's not what it currently does, if you pass canopies=True, then it only includes canopies, it filters out non-canopies.
eg perhaps this is intended to be:
def _filter_canopy_predicates(
predicates: Iterable[Predicate], canopies: bool
) -> set[Predicate]:
if canopies:
return set(predicates)
result = set()
for predicate in predicates:
if hasattr(predicate, "index"):
is_canopy = hasattr(predicate, "canopy")
if is_canopy:
result.add(predicate)
else:
result.add(predicate)
return result
37c0e36
to
74874ac
Compare
All benchmarks (diff):
|
I have no idea why the tests are failing, since they weren't failing just a few commits ago and I don't see what could have changed. Looking at the logs I think all the dependencies stayed the same, but maybe I missed something. but dependencies shouldn't be related to this? Reinstalling |
I think editable install is failing due to pypa/setuptools#3497? |
i'm not sure that datamodel isn't the right owner of predicates, since it knows about the fields? |
but i suppose the narrower question is whether we want datamodel to care about whether we want certain types of predicates. |
can you rebase this so we can get tests going, @NickCrews ? |
I think I see what you're saying, and I think I agree. Yes, this PR is just slightly improving the situation. |
Part of the quest to remove the implementation details of predicates out of DataModel and into the things that actually care about them. This slightly changes the behavior in the test because we don't do any filtering either way, so we use ALL predicates from the variable definitions
74874ac
to
7e26aaf
Compare
Can we get this merged since it's an improvement, and then come back later to fully extract predicates? |
thanks for the ping! yes, let's do it. |
Part of the quest to remove the implementation details
of predicates out of DataModel and into the things that
actually care about them.
This slightly changes the behavior in the test because we don't
do any filtering either way, so we use ALL predicates from the
variable definitions
Inspired by #1065 (comment)
@fgregg this is ready for review