Trait differential_dataflow::operators::group::Group
source · pub trait Group<G: Scope, K: Data, V: Data, R: Diff>where
G::Timestamp: Lattice + Ord,{
fn group<L, V2: Data, R2: Diff>(
&self,
logic: L
) -> Collection<G, (K, V2), R2>
where
L: Fn(&K, &[(&V, R)], &mut Vec<(V2, R2)>) + 'static;
}Expand description
Extension trait for the group differential dataflow method.
Required Methods
sourcefn group<L, V2: Data, R2: Diff>(&self, logic: L) -> Collection<G, (K, V2), R2>where
L: Fn(&K, &[(&V, R)], &mut Vec<(V2, R2)>) + 'static,
fn group<L, V2: Data, R2: Diff>(&self, logic: L) -> Collection<G, (K, V2), R2>where
L: Fn(&K, &[(&V, R)], &mut Vec<(V2, R2)>) + 'static,
Groups records by their first field, and applies reduction logic to the associated values.
Examples
extern crate timely;
extern crate differential_dataflow;
use differential_dataflow::input::Input;
use differential_dataflow::operators::Group;
fn main() {
::timely::example(|scope| {
// report the first value for each group
scope.new_collection_from(1 .. 10).1
.map(|x| (x / 3, x))
.group(|_key, src, dst| {
dst.push((*src[0].0, 1))
});
});
}