Trait differential_dataflow::operators::join::Join [] [src]

pub trait Join<G: Scope, K: Data, V: Data, R: Diff> {
    fn join_map<V2, R2: Diff, D, L>(
        &self,
        other: &Collection<G, (K, V2), R2>,
        logic: L
    ) -> Collection<G, D, <R as Mul<R2>>::Output>
    where
        V2: Data,
        R: Mul<R2>,
        <R as Mul<R2>>::Output: Diff,
        D: Data,
        L: Fn(&K, &V, &V2) -> D + 'static
;
fn semijoin<R2>(
        &self,
        other: &Collection<G, K, R2>
    ) -> Collection<G, (K, V), <R as Mul<R2>>::Output>
    where
        R2: Diff,
        R: Mul<R2>,
        <R as Mul<R2>>::Output: Diff
;
fn antijoin<R2>(
        &self,
        other: &Collection<G, K, R2>
    ) -> Collection<G, (K, V), R>
    where
        R2: Diff,
        R: Mul<R2, Output = R>
; fn join<V2: Data, R2: Diff>(
        &self,
        other: &Collection<G, (K, V2), R2>
    ) -> Collection<G, (K, V, V2), <R as Mul<R2>>::Output>
    where
        R: Mul<R2>,
        <R as Mul<R2>>::Output: Diff
, { ... } }

Join implementations for (key,val) data.

Required Methods

Matches pairs (key,val1) and (key,val2) based on key and then applies a function.

Examples

extern crate timely;
extern crate differential_dataflow;

use differential_dataflow::input::Input;
use differential_dataflow::operators::Join;

fn main() {
    ::timely::example(|scope| {

        let x = scope.new_collection_from(vec![(0, 1), (1, 3)]).1;
        let y = scope.new_collection_from(vec![(0, 'a'), (1, 'b')]).1;
        let z = scope.new_collection_from(vec![(1, 'a'), (3, 'b')]).1;

        x.join_map(&y, |_key, &a, &b| (a,b))
         .assert_eq(&z);
    });
}

Matches pairs (key, val) and key based on key, producing the former with frequencies multiplied.

When the second collection contains frequencies that are either zero or one this is the more traditional relational semijoin. When the second collection may contain multiplicities, this operation may scale up the counts of the records in the first input.

Examples

extern crate timely;
extern crate differential_dataflow;

use differential_dataflow::input::Input;
use differential_dataflow::operators::Join;

fn main() {
    ::timely::example(|scope| {

        let x = scope.new_collection_from(vec![(0, 1), (1, 3)]).1;
        let y = scope.new_collection_from(vec![0, 2]).1;
        let z = scope.new_collection_from(vec![(0, 1)]).1;

        x.semijoin(&y)
         .assert_eq(&z);
    });
}

Matches pairs (key, val) and key based on key, discarding values in the first collection if their key is present in the second.

Examples

extern crate timely;
extern crate differential_dataflow;

use differential_dataflow::input::Input;
use differential_dataflow::operators::Join;

fn main() {
    ::timely::example(|scope| {

        let x = scope.new_collection_from(vec![(0, 1), (1, 3)]).1;
        let y = scope.new_collection_from(vec![0, 2]).1;
        let z = scope.new_collection_from(vec![(1, 3)]).1;

        x.antijoin(&y)
         .assert_eq(&z);
    });
}

Provided Methods

Matches pairs (key,val1) and (key,val2) based on key and then applies a function.

Examples

extern crate timely;
extern crate differential_dataflow;

use differential_dataflow::input::Input;
use differential_dataflow::operators::Join;

fn main() {
    ::timely::example(|scope| {

        let x = scope.new_collection_from(vec![(0, 1), (1, 3)]).1;
        let y = scope.new_collection_from(vec![(0, 'a'), (1, 'b')]).1;
        let z = scope.new_collection_from(vec![(0, 1, 'a'), (1, 3, 'b')]).1;

        x.join(&y)
         .assert_eq(&z);
    });
}

Implementors