pub trait ThresholdTotal<G: Scope, K: ExchangeData, R: ExchangeData + Semigroup>{
    // Required method
    fn threshold_semigroup<R2, F>(&self, thresh: F) -> Collection<G, K, R2>
       where R2: Semigroup + 'static,
             F: FnMut(&K, &R, Option<&R>) -> Option<R2> + 'static;

    // Provided methods
    fn threshold_total<R2: Abelian + 'static, F: FnMut(&K, &R) -> R2 + 'static>(
        &self,
        thresh: F,
    ) -> Collection<G, K, R2> { ... }
    fn distinct_total(&self) -> Collection<G, K, isize> { ... }
    fn distinct_total_core<R2: Abelian + From<i8> + 'static>(
        &self,
    ) -> Collection<G, K, R2> { ... }
}
Expand description

Extension trait for the distinct differential dataflow method.

Required Methods§

source

fn threshold_semigroup<R2, F>(&self, thresh: F) -> Collection<G, K, R2>
where R2: Semigroup + 'static, F: FnMut(&K, &R, Option<&R>) -> Option<R2> + 'static,

Reduces the collection to one occurrence of each distinct element.

Provided Methods§

source

fn threshold_total<R2: Abelian + 'static, F: FnMut(&K, &R) -> R2 + 'static>( &self, thresh: F, ) -> Collection<G, K, R2>

Reduces the collection to one occurrence of each distinct element.

§Examples
use differential_dataflow::input::Input;
use differential_dataflow::operators::ThresholdTotal;

::timely::example(|scope| {
    // report the number of occurrences of each key
    scope.new_collection_from(1 .. 10).1
         .map(|x| x / 3)
         .threshold_total(|_,c| c % 2);
});
source

fn distinct_total(&self) -> Collection<G, K, isize>

Reduces the collection to one occurrence of each distinct element.

This reduction only tests whether the weight associated with a record is non-zero, and otherwise ignores its specific value. To take more general actions based on the accumulated weight, consider the threshold method.

§Examples
use differential_dataflow::input::Input;
use differential_dataflow::operators::ThresholdTotal;

::timely::example(|scope| {
    // report the number of occurrences of each key
    scope.new_collection_from(1 .. 10).1
         .map(|x| x / 3)
         .distinct_total();
});
source

fn distinct_total_core<R2: Abelian + From<i8> + 'static>( &self, ) -> Collection<G, K, R2>

Distinct for general integer differences.

This method allows distinct to produce collections whose difference type is something other than an isize integer, for example perhaps an i32.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<G, K, T1> ThresholdTotal<G, K, <T1 as TraceReader>::Diff> for Arranged<G, T1>
where G: Scope<Timestamp = T1::Time>, T1: for<'a> TraceReader<Key<'a> = &'a K, Val<'a> = &'a ()> + Clone + 'static, for<'a> T1::Diff: Semigroup<T1::DiffGat<'a>> + ExchangeData, K: ExchangeData, T1::Time: TotalOrder,

source§

impl<G: Scope, K: ExchangeData + Hashable, R: ExchangeData + Semigroup> ThresholdTotal<G, K, R> for Collection<G, K, R>