differential_dataflow::operators::reduce

Trait Threshold

Source
pub trait Threshold<G: Scope, K: Data, R1: Semigroup>
where G::Timestamp: Lattice + Ord,
{ // Required method fn threshold_named<R2: Ord + Abelian + 'static, F: FnMut(&K, &R1) -> R2 + 'static>( &self, name: &str, thresh: F, ) -> Collection<G, K, R2>; // Provided methods fn threshold<R2: Ord + Abelian + 'static, F: FnMut(&K, &R1) -> R2 + 'static>( &self, thresh: F, ) -> Collection<G, K, R2> { ... } fn distinct(&self) -> Collection<G, K, isize> { ... } fn distinct_core<R2: Ord + Abelian + 'static + From<i8>>( &self, ) -> Collection<G, K, R2> { ... } }
Expand description

Extension trait for the threshold and distinct differential dataflow methods.

Required Methods§

Source

fn threshold_named<R2: Ord + Abelian + 'static, F: FnMut(&K, &R1) -> R2 + 'static>( &self, name: &str, thresh: F, ) -> Collection<G, K, R2>

A threshold with the ability to name the operator.

Provided Methods§

Source

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

Transforms the multiplicity of records.

The threshold function is obliged to map R1::zero to R2::zero, or at least the computation may behave as if it does. Otherwise, the transformation can be nearly arbitrary: the code does not assume any properties of threshold.

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

::timely::example(|scope| {
    // report at most one of each key.
    scope.new_collection_from(1 .. 10).1
         .map(|x| x / 3)
         .threshold(|_,c| c % 2);
});
Source

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

Reduces the collection to one occurrence of each distinct element.

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

::timely::example(|scope| {
    // report at most one of each key.
    scope.new_collection_from(1 .. 10).1
         .map(|x| x / 3)
         .distinct();
});
Source

fn distinct_core<R2: Ord + Abelian + 'static + From<i8>>( &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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<G, K: Data, T1, R1: Semigroup> Threshold<G, K, R1> for Arranged<G, T1>
where G: Scope<Timestamp = T1::Time>, T1: for<'a> TraceReader<Key<'a> = &'a K, Val<'a> = &'a (), Diff = R1> + Clone + 'static, for<'a> T1::Key<'a>: IntoOwned<'a, Owned = K>,

Source§

impl<G: Scope, K: ExchangeData + Hashable, R1: ExchangeData + Semigroup> Threshold<G, K, R1> for Collection<G, K, R1>
where G::Timestamp: Lattice + Ord,