Trait differential_dataflow::operators::join::JoinUnsigned
[−]
[src]
pub trait JoinUnsigned<G: Scope, U: Unsigned + Data + Default, V: Data> where G::Timestamp: LeastUpperBound { fn join_map_u<V2: Data, D: Data, R: Fn(&U, &V, &V2) -> D + 'static>(&self, other: &Collection<G, (U, V2)>, logic: R) -> Collection<G, D>; fn semijoin_u(&self, other: &Collection<G, U>) -> Collection<G, (U, V)>; fn join_u<V2: Data>(&self, other: &Collection<G, (U, V2)>) -> Collection<G, (U, V, V2)> { ... } }
Matches pairs (key, val1)
and (key, val2)
for dense unsigned integer keys.
These methods are optimizations of the general Join
trait to use Vec
indices rather than
a more generic hash map. This can substantially reduce the amount of computation and memory
required, but it will allocate as much memory as the largest identifier and so may have poor
performance if the absolute range of keys is large.
These method may be deprecated in preferences of an approach which allows implementors of Data
to define
their own approach to indexing data. In this case, a newtype wrapping dense unsigned integers would indicate
the indexing strategy, and the methods would simply be as above.
Required Methods
fn join_map_u<V2: Data, D: Data, R: Fn(&U, &V, &V2) -> D + 'static>(&self, other: &Collection<G, (U, V2)>, logic: R) -> Collection<G, D>
Joins two collections with dense unsigned integer keys and then applies a map function.
Examples
extern crate timely; use timely::dataflow::operators::{ToStream, Capture}; use timely::dataflow::operators::capture::Extract; use differential_dataflow::operators::Join; let data = timely::example(|scope| { let col1 = vec![((0,0),1),((1,2),1)].into_iter().to_stream(scope); let col2 = vec![((0,'a'),1),((1,'B'),1)].into_iter().to_stream(scope); // should produce records `(0 + 0,'a')` and `(1 + 2,'B')`. col1.join_map_u(&col2, |k,v1,v2| (*k + *v1, *v2)).capture(); }); let extracted = data.extract(); assert_eq!(extracted.len(), 1); assert_eq!(extracted[0].1, vec![((0,'a'),1), ((3,'B'),1)]);
fn semijoin_u(&self, other: &Collection<G, U>) -> Collection<G, (U, V)>
Semijoins a collection with dense unsigned integer keys against a set of such keys.
Examples
extern crate timely; use timely::dataflow::operators::{ToStream, Capture}; use timely::dataflow::operators::capture::Extract; use differential_dataflow::operators::Join; let data = timely::example(|scope| { let col1 = vec![((0,0),1),((1,2),1)].into_iter().to_stream(scope); let col2 = vec![(0,1)].into_iter().to_stream(scope); // should retain record `(0,0)` and discard `(1,2)`. col1.semijoin(&col2).capture(); }); let extracted = data.extract(); assert_eq!(extracted.len(), 1); assert_eq!(extracted[0].1, vec![((0,0),1)]);
Provided Methods
fn join_u<V2: Data>(&self, other: &Collection<G, (U, V2)>) -> Collection<G, (U, V, V2)>
Joins two collections with dense unsigned integer keys.
Examples
extern crate timely; use timely::dataflow::operators::{ToStream, Capture}; use timely::dataflow::operators::capture::Extract; use differential_dataflow::operators::Join; let data = timely::example(|scope| { let col1 = vec![((0,0),1),((1,2),1)].into_iter().to_stream(scope); let col2 = vec![((0,'a'),1),((1,'B'),1)].into_iter().to_stream(scope); // should produce triples `(0,0,'a')` and `(1,2,'B')`. col1.join_u(&col2).capture(); }); let extracted = data.extract(); assert_eq!(extracted.len(), 1); assert_eq!(extracted[0].1, vec![((0,0,'a'),1), ((1,2,'B'),1)]);
Implementors
impl<G: Scope, U: Unsigned + Data + Default, V: Data> JoinUnsigned<G, U, V> for Collection<G, (U, V)> where G::Timestamp: LeastUpperBound