Skip to content

Allow the output of a join to be filtered by an arbitrary predicate #37

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

Merged
merged 2 commits into from
Aug 27, 2021

Conversation

ecstatic-morse
Copy link
Contributor

@ecstatic-morse ecstatic-morse commented Aug 12, 2021

The purpose is to eliminate reflexive subset relations in Polonius. Currently, we do this by manually filtering the subset relation at each stage, but this is inefficient and makes things a bit harder to reason about. This change allows us to write the equivalent of the following rule.

subset(o1, o3, p) :-
    subset(o1, o2, p),
    subset(o2, o3, p),
    o1 != o3.

The signature for from_join_filtered is maximally expressive, allowing the user to inspect the shared key and both values when deciding whether to filter. I think this is good, but it's possible there's a more restrictive API that would achieve the same thing?

@lqd
Copy link
Member

lqd commented Aug 15, 2021

This is exactly what I had in mind when I added the hacky symmetry filtering to polonius: a way to filter_map the emitted tuples for these cases. So this looks good to me as well, and I personally don't mind the maximally expressive vs restricted API (but that's an interesting question indeed).

@lqd lqd merged commit 3d18dec into rust-lang:master Aug 27, 2021
@lqd
Copy link
Member

lqd commented Aug 27, 2021

thanks a bunch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants