Trait differential_dataflow::operators::join::JoinUnsigned
[−]
[src]
pub trait JoinUnsigned<G: Scope, K: Data, V: Data, R: Diff> { fn join_map_u<V2, R2: Diff, D, L>(
&self,
other: &Collection<G, (K, V2), R2>,
logic: L
) -> Collection<G, D, <R as Mul<R2>>::Output>
where
R: Mul<R2>,
<R as Mul<R2>>::Output: Diff,
V2: Data,
D: Data,
L: Fn(&K, &V, &V2) -> D + 'static; fn semijoin_u<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_u<R2>(
&self,
other: &Collection<G, K, R2>
) -> Collection<G, (K, V), R>
where
R2: Diff,
R: Mul<R2, Output = R>; fn join_u<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_u<V2, R2: Diff, D, L>(
&self,
other: &Collection<G, (K, V2), R2>,
logic: L
) -> Collection<G, D, <R as Mul<R2>>::Output> where
R: Mul<R2>,
<R as Mul<R2>>::Output: Diff,
V2: Data,
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
R: Mul<R2>,
<R as Mul<R2>>::Output: Diff,
V2: Data,
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::JoinUnsigned; fn main() { ::timely::example(|scope| { let x = scope.new_collection_from(vec![(0u32, 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_u(&y, |_key, &a, &b| (a,b)) .assert_eq(&z); }); }
fn semijoin_u<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,val1) and key based on key, filtering the first collection by values present in the second.
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::JoinUnsigned; fn main() { ::timely::example(|scope| { let x = scope.new_collection_from(vec![(0u32, 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_u(&y) .assert_eq(&z); }); }
fn antijoin_u<R2>(
&self,
other: &Collection<G, K, R2>
) -> Collection<G, (K, V), R> where
R2: Diff,
R: Mul<R2, Output = R>,
&self,
other: &Collection<G, K, R2>
) -> Collection<G, (K, V), R> where
R2: Diff,
R: Mul<R2, Output = R>,
Matches pairs (key,val1) 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::JoinUnsigned; fn main() { ::timely::example(|scope| { let x = scope.new_collection_from(vec![(0u32, 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_u(&y) .assert_eq(&z); }); }
Provided Methods
fn join_u<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::JoinUnsigned; fn main() { ::timely::example(|scope| { let x = scope.new_collection_from(vec![(0u32, 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_u(&y) .assert_eq(&z); }); }