[−][src]Trait differential_dataflow::operators::join::Join
Join implementations for (key,val)
data.
Required methods
fn join_map<V2, R2, D, L>(
&self,
other: &Collection<G, (K, V2), R2>,
logic: L
) -> Collection<G, D, <R as Mul<R2>>::Output> where
K: ExchangeData,
V2: ExchangeData,
R2: ExchangeData + Monoid,
R: Mul<R2>,
<R as Mul<R2>>::Output: Monoid,
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
K: ExchangeData,
V2: ExchangeData,
R2: ExchangeData + Monoid,
R: Mul<R2>,
<R as Mul<R2>>::Output: Monoid,
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
K: ExchangeData,
R2: ExchangeData + Monoid,
R: Mul<R2>,
<R as Mul<R2>>::Output: Monoid,
&self,
other: &Collection<G, K, R2>
) -> Collection<G, (K, V), <R as Mul<R2>>::Output> where
K: ExchangeData,
R2: ExchangeData + Monoid,
R: Mul<R2>,
<R as Mul<R2>>::Output: Monoid,
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
K: ExchangeData,
R2: ExchangeData + Monoid,
R: Mul<R2, Output = R>,
R: Abelian,
K: ExchangeData,
R2: ExchangeData + Monoid,
R: Mul<R2, Output = R>,
R: Abelian,
Subtracts the semijoin with other
from self
.
In the case that other
has multiplicities zero or one this results
in a relational antijoin, in which we discard input records whose key
is present in other
. If the multiplicities could be other than zero
or one, the semantic interpretation of this operator is less clear.
In almost all cases, you should ensure that other
has multiplicities
that are zero or one, perhaps by using the distinct
operator.
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, R2>(
&self,
other: &Collection<G, (K, V2), R2>
) -> Collection<G, (K, (V, V2)), <R as Mul<R2>>::Output> where
K: ExchangeData,
V2: ExchangeData,
R2: ExchangeData + Monoid,
R: Mul<R2>,
<R as Mul<R2>>::Output: Monoid,
&self,
other: &Collection<G, (K, V2), R2>
) -> Collection<G, (K, (V, V2)), <R as Mul<R2>>::Output> where
K: ExchangeData,
V2: ExchangeData,
R2: ExchangeData + Monoid,
R: Mul<R2>,
<R as Mul<R2>>::Output: Monoid,
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: ExchangeData + Hashable,
V: ExchangeData,
R: ExchangeData + Monoid,
G::Timestamp: Lattice + Ord,
[src]
G: Scope,
K: ExchangeData + Hashable,
V: ExchangeData,
R: ExchangeData + Monoid,
G::Timestamp: Lattice + Ord,
fn join_map<V2: ExchangeData, R2: ExchangeData + Monoid, D: Data, 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: Monoid,
L: Fn(&K, &V, &V2) -> D + 'static,
[src]
&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: Monoid,
L: Fn(&K, &V, &V2) -> D + 'static,
fn semijoin<R2: ExchangeData + Monoid>(
&self,
other: &Collection<G, K, R2>
) -> Collection<G, (K, V), <R as Mul<R2>>::Output> where
R: Mul<R2>,
<R as Mul<R2>>::Output: Monoid,
[src]
&self,
other: &Collection<G, K, R2>
) -> Collection<G, (K, V), <R as Mul<R2>>::Output> where
R: Mul<R2>,
<R as Mul<R2>>::Output: Monoid,
fn antijoin<R2: ExchangeData + Monoid>(
&self,
other: &Collection<G, K, R2>
) -> Collection<G, (K, V), R> where
R: Mul<R2, Output = R>,
R: Abelian,
[src]
&self,
other: &Collection<G, K, R2>
) -> Collection<G, (K, V), R> where
R: Mul<R2, Output = R>,
R: Abelian,
impl<G, Tr> Join<G, <Tr as TraceReader>::Key, <Tr as TraceReader>::Val, <Tr as TraceReader>::R> for Arranged<G, Tr> where
G: Scope,
G::Timestamp: Lattice + Ord,
Tr: TraceReader<Time = G::Timestamp> + Clone + 'static,
Tr::Key: Data + Hashable,
Tr::Val: Data,
Tr::R: Monoid,
Tr::Batch: BatchReader<Tr::Key, Tr::Val, G::Timestamp, Tr::R> + 'static,
Tr::Cursor: Cursor<Tr::Key, Tr::Val, G::Timestamp, Tr::R> + 'static,
[src]
G: Scope,
G::Timestamp: Lattice + Ord,
Tr: TraceReader<Time = G::Timestamp> + Clone + 'static,
Tr::Key: Data + Hashable,
Tr::Val: Data,
Tr::R: Monoid,
Tr::Batch: BatchReader<Tr::Key, Tr::Val, G::Timestamp, Tr::R> + 'static,
Tr::Cursor: Cursor<Tr::Key, Tr::Val, G::Timestamp, Tr::R> + 'static,
fn join_map<V2: ExchangeData, R2: ExchangeData + Monoid, D: Data, L>(
&self,
other: &Collection<G, (Tr::Key, V2), R2>,
logic: L
) -> Collection<G, D, <Tr::R as Mul<R2>>::Output> where
Tr::Key: ExchangeData,
Tr::R: Mul<R2>,
<Tr::R as Mul<R2>>::Output: Monoid,
L: Fn(&Tr::Key, &Tr::Val, &V2) -> D + 'static,
[src]
&self,
other: &Collection<G, (Tr::Key, V2), R2>,
logic: L
) -> Collection<G, D, <Tr::R as Mul<R2>>::Output> where
Tr::Key: ExchangeData,
Tr::R: Mul<R2>,
<Tr::R as Mul<R2>>::Output: Monoid,
L: Fn(&Tr::Key, &Tr::Val, &V2) -> D + 'static,
fn semijoin<R2: ExchangeData + Monoid>(
&self,
other: &Collection<G, Tr::Key, R2>
) -> Collection<G, (Tr::Key, Tr::Val), <Tr::R as Mul<R2>>::Output> where
Tr::Key: ExchangeData,
Tr::R: Mul<R2>,
<Tr::R as Mul<R2>>::Output: Monoid,
[src]
&self,
other: &Collection<G, Tr::Key, R2>
) -> Collection<G, (Tr::Key, Tr::Val), <Tr::R as Mul<R2>>::Output> where
Tr::Key: ExchangeData,
Tr::R: Mul<R2>,
<Tr::R as Mul<R2>>::Output: Monoid,
fn antijoin<R2: ExchangeData + Monoid>(
&self,
other: &Collection<G, Tr::Key, R2>
) -> Collection<G, (Tr::Key, Tr::Val), Tr::R> where
Tr::Key: ExchangeData,
Tr::R: Mul<R2, Output = Tr::R>,
Tr::R: Abelian,
[src]
&self,
other: &Collection<G, Tr::Key, R2>
) -> Collection<G, (Tr::Key, Tr::Val), Tr::R> where
Tr::Key: ExchangeData,
Tr::R: Mul<R2, Output = Tr::R>,
Tr::R: Abelian,