use timely::dataflow::*;
use timely_sort::Unsigned;
use ::{Collection, Data, Diff, Hashable};
use operators::arrange::ArrangeBySelf;
pub trait Consolidate<D: Data+Hashable> {
fn consolidate(&self) -> Self;
fn consolidate_u(&self) -> Self where D: Unsigned+Copy;
}
impl<G: Scope, D, R> Consolidate<D> for Collection<G, D, R>
where
D: Data+Hashable,
R: Diff,
G::Timestamp: ::lattice::Lattice+Ord,
{
fn consolidate(&self) -> Self {
self.arrange_by_self().as_collection(|d,_| d.item.clone())
}
fn consolidate_u(&self) -> Self where D: Unsigned+Copy {
self.arrange_by_self_u().as_collection(|d,_| d.item.clone())
}
}