Skip to content

Relation::from_antijoin is broken #39

Closed
@ecstatic-morse

Description

@ecstatic-morse

Relation::from_antijoin always returns an empty Relation, regardless of its inputs. That's because the antijoin helper, which takes a JoinInput as its first parameter, operates only on recent tuples.

datafrog/src/join.rs

Lines 65 to 73 in 5bda2f0

let results = input1
.recent()
.iter()
.filter(|(ref key, _)| {
tuples2 = gallop(tuples2, |k| k < key);
tuples2.first() != Some(key)
})
.map(|(ref key, ref val)| logic(key, val))
.collect::<Vec<_>>();

This is correct for variables, but Relations, which don't change during iteration, only have stable tuples. See #36 (comment) for the reason this must be the case.

To fix this, we should refactor the antijoin helper to work directly on Relations, and pass the proper input from Variable::from_antijoin and Relation::from_antijoin. A regression test is needed as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions