Trait differential_dataflow::operators::distinct::DistinctTotal [] [src]

pub trait DistinctTotal<G: Scope, K: Data, R: Diff> where
    G::Timestamp: TotalOrder + Lattice + Ord
{ fn distinct_total(&self) -> Collection<G, K, isize>;
fn distinct_total_u(&self) -> Collection<G, K, isize>
    where
        K: Unsigned + Copy
; }

Extension trait for the distinct differential dataflow method.

Required 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::DistinctTotal;

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();
    });
}

Reduces the collection to one occurrence of each distinct element.

This method is a specialization for when the key is an unsigned integer fit for distributing the data.

Examples

extern crate timely;
extern crate differential_dataflow;

use differential_dataflow::input::Input;
use differential_dataflow::operators::DistinctTotal;

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

Implementors