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
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,
&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,
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); }); }
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,
&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,
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); }); }
fn antijoin<R2>(&self, other: &Collection<G, K, R2>) -> Collection<G, (K, V), R> where
R2: Diff,
R: Mul<R2, Output = R>,
R2: Diff,
R: Mul<R2, Output = R>,
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
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,
&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,
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
impl<G, K, V, R> Join<G, K, V, R> for Collection<G, (K, V), R> where
G: Scope,
K: Data + Hashable,
V: Data,
R: Diff,
G::Timestamp: Lattice + Ord,impl<G, K, V, R, T> Join<G, K, V, R> for Arranged<G, K, V, R, T> where
G: Scope,
G::Timestamp: Lattice + Ord,
K: Data + Hashable,
V: Data,
R: Diff,
T: TraceReader<K, V, G::Timestamp, R> + Clone + 'static,
T::Batch: BatchReader<K, V, G::Timestamp, R> + 'static,