Trait differential_dataflow::operators::threshold::ThresholdTotal
[−]
[src]
pub trait ThresholdTotal<G: Scope, K: Data, R: Diff> where
G::Timestamp: TotalOrder + Lattice + Ord, { fn threshold_total<R2: Diff, F: Fn(R) -> R2 + 'static>(
&self,
thresh: F
) -> Collection<G, K, R2>; fn distinct_total(&self) -> Collection<G, K, isize> { ... } }
Extension trait for the distinct
differential dataflow method.
Required Methods
fn threshold_total<R2: Diff, F: Fn(R) -> R2 + 'static>(
&self,
thresh: F
) -> Collection<G, K, R2>
&self,
thresh: F
) -> Collection<G, K, R2>
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::ThresholdTotal; fn main() { ::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); }); }
Provided Methods
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
extern crate timely; extern crate differential_dataflow; use differential_dataflow::input::Input; use differential_dataflow::operators::ThresholdTotal; fn main() { ::timely::example(|scope| { // report the number of occurrences of each key scope.new_collection_from(1 .. 10).1 .map(|x| x / 3) .distinct_total(); }); }
Implementors
impl<G: Scope, K: Data + Hashable, R: Diff> ThresholdTotal<G, K, R> for Collection<G, K, R> where
G::Timestamp: TotalOrder + Lattice + Ord,impl<G: Scope, K: Data, R: Diff, T1> ThresholdTotal<G, K, R> for Arranged<G, K, (), R, T1> where
G::Timestamp: TotalOrder + Lattice + Ord,
T1: TraceReader<K, (), G::Timestamp, R> + Clone + 'static,
T1::Batch: BatchReader<K, (), G::Timestamp, R>,