Trait differential_dataflow::operators::join::JoinCore
source · pub trait JoinCore<G: Scope, K: 'static, V: 'static, R: Diff>where
G::Timestamp: Lattice + Ord,{
fn join_core<V2, T2, R2, I, L>(
&self,
stream2: &Arranged<G, K, V2, R2, T2>,
result: L
) -> Collection<G, I::Item, <R as Mul<R2>>::Output>
where
V2: Ord + Clone + Debug + 'static,
T2: TraceReader<K, V2, G::Timestamp, R2> + Clone + 'static,
T2::Batch: BatchReader<K, V2, G::Timestamp, R2> + 'static,
R2: Diff,
R: Mul<R2>,
<R as Mul<R2>>::Output: Diff,
I: IntoIterator,
I::Item: Data,
L: Fn(&K, &V, &V2) -> I + 'static;
}Expand description
Matches the elements of two arranged traces.
This method is used by the various join implementations, but it can also be used
directly in the event that one has a handle to an Arranged<G,T>, perhaps because
the arrangement is available for re-use, or from the output of a group operator.
Required Methods
sourcefn join_core<V2, T2, R2, I, L>(
&self,
stream2: &Arranged<G, K, V2, R2, T2>,
result: L
) -> Collection<G, I::Item, <R as Mul<R2>>::Output>where
V2: Ord + Clone + Debug + 'static,
T2: TraceReader<K, V2, G::Timestamp, R2> + Clone + 'static,
T2::Batch: BatchReader<K, V2, G::Timestamp, R2> + 'static,
R2: Diff,
R: Mul<R2>,
<R as Mul<R2>>::Output: Diff,
I: IntoIterator,
I::Item: Data,
L: Fn(&K, &V, &V2) -> I + 'static,
fn join_core<V2, T2, R2, I, L>(
&self,
stream2: &Arranged<G, K, V2, R2, T2>,
result: L
) -> Collection<G, I::Item, <R as Mul<R2>>::Output>where
V2: Ord + Clone + Debug + 'static,
T2: TraceReader<K, V2, G::Timestamp, R2> + Clone + 'static,
T2::Batch: BatchReader<K, V2, G::Timestamp, R2> + 'static,
R2: Diff,
R: Mul<R2>,
<R as Mul<R2>>::Output: Diff,
I: IntoIterator,
I::Item: Data,
L: Fn(&K, &V, &V2) -> I + 'static,
Joins two arranged collections with the same key type.
Each matching pair of records (key, val1) and (key, val2) are subjected to the result function,
which produces something implementing IntoIterator, where the output collection will have
This trait is implemented for arrangements (Arranged<G, T>) rather than collections. The Join trait
contains the implementations for collections.
Examples
extern crate timely;
extern crate differential_dataflow;
use differential_dataflow::input::Input;
use differential_dataflow::operators::arrange::ArrangeByKey;
use differential_dataflow::operators::join::JoinCore;
use differential_dataflow::trace::Trace;
use differential_dataflow::trace::implementations::ord::OrdValSpine;
use differential_dataflow::hashable::OrdWrapper;
fn main() {
::timely::example(|scope| {
let x = scope.new_collection_from(vec![(0u32, 1), (1, 3)]).1
.arrange_by_key();
let y = scope.new_collection_from(vec![(0, 'a'), (1, 'b')]).1
.arrange_by_key();
let z = scope.new_collection_from(vec![(1, 'a'), (3, 'b')]).1;
x.join_core(&y, |_key, &a, &b| Some((a, b)))
.assert_eq(&z);
});
}