Trait differential_dataflow::operators::reduce::ReduceCore

source ·
pub trait ReduceCore<G: Scope, K: ToOwned + ?Sized, V: Data, R: Semigroup>
where G::Timestamp: Lattice + Ord,
{ // Required method fn reduce_core<L, Bu, T2>( &self, name: &str, logic: L, ) -> Arranged<G, TraceAgent<T2>> where T2: for<'a> Trace<Key<'a> = &'a K, Time = G::Timestamp> + 'static, for<'a> T2::Val<'a>: IntoOwned<'a, Owned = V>, T2::Batch: Batch, Bu: Builder<Time = T2::Time, Input = Vec<((K::Owned, V), T2::Time, T2::Diff)>, Output = T2::Batch>, L: FnMut(&K, &[(&V, R)], &mut Vec<(V, T2::Diff)>, &mut Vec<(V, T2::Diff)>) + 'static; // Provided method fn reduce_abelian<L, Bu, T2>( &self, name: &str, logic: L, ) -> Arranged<G, TraceAgent<T2>> where T2: for<'a> Trace<Key<'a> = &'a K, Time = G::Timestamp> + 'static, for<'a> T2::Val<'a>: IntoOwned<'a, Owned = V>, T2::Diff: Abelian, T2::Batch: Batch, Bu: Builder<Time = T2::Time, Input = Vec<((K::Owned, V), T2::Time, T2::Diff)>, Output = T2::Batch>, L: FnMut(&K, &[(&V, R)], &mut Vec<(V, T2::Diff)>) + 'static { ... } }
Expand description

Extension trait for the reduce_core differential dataflow method.

Required Methods§

source

fn reduce_core<L, Bu, T2>( &self, name: &str, logic: L, ) -> Arranged<G, TraceAgent<T2>>
where T2: for<'a> Trace<Key<'a> = &'a K, Time = G::Timestamp> + 'static, for<'a> T2::Val<'a>: IntoOwned<'a, Owned = V>, T2::Batch: Batch, Bu: Builder<Time = T2::Time, Input = Vec<((K::Owned, V), T2::Time, T2::Diff)>, Output = T2::Batch>, L: FnMut(&K, &[(&V, R)], &mut Vec<(V, T2::Diff)>, &mut Vec<(V, T2::Diff)>) + 'static,

Solves for output updates when presented with inputs and would-be outputs.

Unlike reduce_arranged, this method may be called with an empty input, and it may not be safe to index into the first element. At least one of the two collections will be non-empty.

Provided Methods§

source

fn reduce_abelian<L, Bu, T2>( &self, name: &str, logic: L, ) -> Arranged<G, TraceAgent<T2>>
where T2: for<'a> Trace<Key<'a> = &'a K, Time = G::Timestamp> + 'static, for<'a> T2::Val<'a>: IntoOwned<'a, Owned = V>, T2::Diff: Abelian, T2::Batch: Batch, Bu: Builder<Time = T2::Time, Input = Vec<((K::Owned, V), T2::Time, T2::Diff)>, Output = T2::Batch>, L: FnMut(&K, &[(&V, R)], &mut Vec<(V, T2::Diff)>) + 'static,

Applies reduce to arranged data, and returns an arrangement of output data.

This method is used by the more ergonomic reduce, distinct, and count methods, although it can be very useful if one needs to manually attach and re-use existing arranged collections.

§Examples
use differential_dataflow::input::Input;
use differential_dataflow::operators::reduce::ReduceCore;
use differential_dataflow::trace::Trace;
use differential_dataflow::trace::implementations::{ValBuilder, ValSpine};

::timely::example(|scope| {

    let trace =
    scope.new_collection_from(1 .. 10u32).1
         .map(|x| (x, x))
         .reduce_abelian::<_,ValBuilder<_,_,_,_>,ValSpine<_,_,_,_>>(
            "Example",
             move |_key, src, dst| dst.push((*src[0].0, 1))
         )
         .trace;
});

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<G, K, V, R> ReduceCore<G, K, V, R> for Collection<G, (K, V), R>