Trait differential_dataflow::operators::reduce::ReduceCore[][src]

pub trait ReduceCore<G: Scope, K: Data, V: Data, R: Semigroup> where
    G::Timestamp: Lattice + Ord
{ fn reduce_core<L, T2>(
        &self,
        name: &str,
        logic: L
    ) -> Arranged<G, TraceAgent<T2>>
    where
        T2: Trace + TraceReader<Key = K, Time = G::Timestamp> + 'static,
        T2::Val: Data,
        T2::R: Semigroup,
        T2::Batch: Batch<K, T2::Val, G::Timestamp, T2::R>,
        T2::Cursor: Cursor<K, T2::Val, G::Timestamp, T2::R>,
        L: FnMut(&K, &[(&V, R)], &mut Vec<(T2::Val, T2::R)>, &mut Vec<(T2::Val, T2::R)>) + 'static
; fn reduce_abelian<L, T2>(
        &self,
        name: &str,
        logic: L
    ) -> Arranged<G, TraceAgent<T2>>
    where
        T2: Trace + TraceReader<Key = K, Time = G::Timestamp> + 'static,
        T2::Val: Data,
        T2::R: Abelian,
        T2::Batch: Batch<K, T2::Val, G::Timestamp, T2::R>,
        T2::Cursor: Cursor<K, T2::Val, G::Timestamp, T2::R>,
        L: FnMut(&K, &[(&V, R)], &mut Vec<(T2::Val, T2::R)>) + 'static
, { ... } }

Extension trait for the group_arranged differential dataflow method.

Required methods

fn reduce_core<L, T2>(
    &self,
    name: &str,
    logic: L
) -> Arranged<G, TraceAgent<T2>> where
    T2: Trace + TraceReader<Key = K, Time = G::Timestamp> + 'static,
    T2::Val: Data,
    T2::R: Semigroup,
    T2::Batch: Batch<K, T2::Val, G::Timestamp, T2::R>,
    T2::Cursor: Cursor<K, T2::Val, G::Timestamp, T2::R>,
    L: FnMut(&K, &[(&V, R)], &mut Vec<(T2::Val, T2::R)>, &mut Vec<(T2::Val, T2::R)>) + 'static, 
[src]

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.

Loading content...

Provided methods

fn reduce_abelian<L, T2>(
    &self,
    name: &str,
    logic: L
) -> Arranged<G, TraceAgent<T2>> where
    T2: Trace + TraceReader<Key = K, Time = G::Timestamp> + 'static,
    T2::Val: Data,
    T2::R: Abelian,
    T2::Batch: Batch<K, T2::Val, G::Timestamp, T2::R>,
    T2::Cursor: Cursor<K, T2::Val, G::Timestamp, T2::R>,
    L: FnMut(&K, &[(&V, R)], &mut Vec<(T2::Val, T2::R)>) + 'static, 
[src]

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

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

Examples

extern crate timely;
extern crate differential_dataflow;

use differential_dataflow::input::Input;
use differential_dataflow::operators::reduce::ReduceCore;
use differential_dataflow::trace::Trace;
use differential_dataflow::trace::implementations::ord::OrdValSpine;

fn main() {
    ::timely::example(|scope| {

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

Implementors

impl<G, K, V, R> ReduceCore<G, K, V, R> for Collection<G, (K, V), R> where
    G: Scope,
    G::Timestamp: Lattice + Ord,
    K: ExchangeData + Hashable,
    V: ExchangeData,
    R: ExchangeData + Semigroup
[src]

impl<G: Scope, K: Data, V: Data, T1, R: Semigroup> ReduceCore<G, K, V, R> for Arranged<G, T1> where
    G::Timestamp: Lattice + Ord,
    T1: TraceReader<Key = K, Val = V, Time = G::Timestamp, R = R> + Clone + 'static,
    T1::Batch: BatchReader<K, V, G::Timestamp, R>,
    T1::Cursor: Cursor<K, V, G::Timestamp, R>, 
[src]

Loading content...