Trait differential_dataflow::operators::group::Threshold [] [src]

pub trait Threshold<G: Scope, K: Data, R1: Diff> where
    G::Timestamp: Lattice + Ord
{ fn threshold<R2: Diff, F: Fn(R1) -> R2 + 'static>(
        &self,
        thresh: F
    ) -> Collection<G, K, R2>; fn distinct(&self) -> Collection<G, K, isize> { ... } }

Extension trait for the distinct differential dataflow method.

Required Methods

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

extern crate timely;
extern crate differential_dataflow;

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

fn main() {
    ::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);
    });
}

Provided Methods

Reduces the collection to one occurrence of each distinct element.

Examples

extern crate timely;
extern crate differential_dataflow;

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

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

Implementors