Struct differential_dataflow::operators::arrange::Arranged
source · pub struct Arranged<G: Scope, K, V, R, T>where
G::Timestamp: Lattice + Ord,
T: TraceReader<K, V, G::Timestamp, R> + Clone,{
pub stream: Stream<G, T::Batch>,
pub trace: T,
}Expand description
An arranged collection of (K,V) values.
An Arranged allows multiple differential operators to share the resources (communication,
computation, memory) required to produce and maintain an indexed representation of a collection.
Fields
stream: Stream<G, T::Batch>A stream containing arranged updates.
This stream contains the same batches of updates the trace itself accepts, so there should be no additional overhead to receiving these records. The batches can be navigated just as the batches in the trace, by key and by value.
trace: TA shared trace, updated by the Arrange operator and readable by others.
Implementations
sourceimpl<G: Scope, K, V, R, T> Arranged<G, K, V, R, T>where
G::Timestamp: Lattice + Ord,
T: TraceReader<K, V, G::Timestamp, R> + Clone,
impl<G: Scope, K, V, R, T> Arranged<G, K, V, R, T>where
G::Timestamp: Lattice + Ord,
T: TraceReader<K, V, G::Timestamp, R> + Clone,
sourcepub fn enter<'a, TInner>(
&self,
child: &Child<'a, G, TInner>
) -> Arranged<Child<'a, G, TInner>, K, V, R, TraceEnter<K, V, G::Timestamp, R, T, TInner>>where
T::Batch: Clone,
K: 'static,
V: 'static,
G::Timestamp: Clone + Default + 'static,
TInner: Refines<G::Timestamp> + Lattice + Timestamp + Clone + Default + 'static,
R: 'static,
pub fn enter<'a, TInner>(
&self,
child: &Child<'a, G, TInner>
) -> Arranged<Child<'a, G, TInner>, K, V, R, TraceEnter<K, V, G::Timestamp, R, T, TInner>>where
T::Batch: Clone,
K: 'static,
V: 'static,
G::Timestamp: Clone + Default + 'static,
TInner: Refines<G::Timestamp> + Lattice + Timestamp + Clone + Default + 'static,
R: 'static,
Brings an arranged collection into a nested scope.
This method produces a proxy trace handle that uses the same backing data, but acts as if the timestamps have all been extended with an additional coordinate with the default value. The resulting collection does not vary with the new timestamp coordinate.
sourcepub fn enter_at<'a, TInner, F>(
&self,
child: &Child<'a, G, TInner>,
logic: F
) -> Arranged<Child<'a, G, TInner>, K, V, R, TraceEnterAt<K, V, G::Timestamp, R, T, TInner, F>>where
T::Batch: Clone,
K: 'static,
V: 'static,
G::Timestamp: Clone + Default + 'static,
TInner: Refines<G::Timestamp> + Lattice + Timestamp + Clone + Default + 'static,
R: 'static,
F: Fn(&K, &V, &G::Timestamp) -> TInner + 'static,
pub fn enter_at<'a, TInner, F>(
&self,
child: &Child<'a, G, TInner>,
logic: F
) -> Arranged<Child<'a, G, TInner>, K, V, R, TraceEnterAt<K, V, G::Timestamp, R, T, TInner, F>>where
T::Batch: Clone,
K: 'static,
V: 'static,
G::Timestamp: Clone + Default + 'static,
TInner: Refines<G::Timestamp> + Lattice + Timestamp + Clone + Default + 'static,
R: 'static,
F: Fn(&K, &V, &G::Timestamp) -> TInner + 'static,
Brings an arranged collection into a nested scope.
This method produces a proxy trace handle that uses the same backing data, but acts as if the timestamps have all been extended with an additional coordinate with the default value. The resulting collection does not vary with the new timestamp coordinate.
sourcepub fn filter<F>(
&self,
logic: F
) -> Arranged<G, K, V, R, TraceFilter<K, V, G::Timestamp, R, T, F>>where
T::Batch: Clone,
K: 'static,
V: 'static,
G::Timestamp: Clone + Default + 'static,
R: 'static,
F: Fn(&K, &V) -> bool + 'static,
pub fn filter<F>(
&self,
logic: F
) -> Arranged<G, K, V, R, TraceFilter<K, V, G::Timestamp, R, T, F>>where
T::Batch: Clone,
K: 'static,
V: 'static,
G::Timestamp: Clone + Default + 'static,
R: 'static,
F: Fn(&K, &V) -> bool + 'static,
Filters an arranged collection.
This method produces a new arrangement backed by the same shared
arrangement as self, paired with user-specified logic that can
filter by key and value. The resulting collection is restricted
to the keys and values that return true under the user predicate.
Examples
extern crate timely;
extern crate differential_dataflow;
use differential_dataflow::input::Input;
use differential_dataflow::operators::arrange::ArrangeByKey;
fn main() {
::timely::example(|scope| {
let arranged =
scope.new_collection_from(0 .. 10).1
.map(|x| (x, x+1))
.arrange_by_key();
arranged
.filter(|k,v| k == v)
.as_collection(|k,v| (*k,*v))
.assert_empty();
});
}sourcepub fn as_collection<D: Data, L>(&self, logic: L) -> Collection<G, D, R>where
R: Diff,
T::Batch: Clone + 'static,
K: Clone,
V: Clone,
L: Fn(&K, &V) -> D + 'static,
pub fn as_collection<D: Data, L>(&self, logic: L) -> Collection<G, D, R>where
R: Diff,
T::Batch: Clone + 'static,
K: Clone,
V: Clone,
L: Fn(&K, &V) -> D + 'static,
Flattens the stream into a Collection.
The underlying Stream<G, BatchWrapper<T::Batch>> is a much more efficient way to access the data,
and this method should only be used when the data need to be transformed or exchanged, rather than
supplied as arguments to an operator using the same key-value structure.
sourcepub fn flat_map_ref<I, L>(&self, logic: L) -> Collection<G, I::Item, R>where
R: Diff,
T::Batch: Clone + 'static,
K: Clone,
V: Clone,
I: IntoIterator,
I::Item: Data,
L: Fn(&K, &V) -> I + 'static,
pub fn flat_map_ref<I, L>(&self, logic: L) -> Collection<G, I::Item, R>where
R: Diff,
T::Batch: Clone + 'static,
K: Clone,
V: Clone,
I: IntoIterator,
I::Item: Data,
L: Fn(&K, &V) -> I + 'static,
Extracts elements from an arrangement as a collection.
The supplied logic may produce an iterator over output values, allowing either filtering or flat mapping as part of the extraction.
sourcepub fn lookup(
&self,
queries: &Stream<G, (K, G::Timestamp)>
) -> Stream<G, (K, V, G::Timestamp, R)>where
G::Timestamp: Data + Lattice + Ord + TotalOrder,
K: Data + Hashable,
V: Data,
R: Diff,
T: 'static,
pub fn lookup(
&self,
queries: &Stream<G, (K, G::Timestamp)>
) -> Stream<G, (K, V, G::Timestamp, R)>where
G::Timestamp: Data + Lattice + Ord + TotalOrder,
K: Data + Hashable,
V: Data,
R: Diff,
T: 'static,
Report values associated with keys at certain times.
This method consumes a stream of (key, time) queries and reports the corresponding stream of
(key, value, time, diff) accumulations in the self trace.
Trait Implementations
sourceimpl<G: Scope, K, V, R, T> Clone for Arranged<G, K, V, R, T>where
G::Timestamp: Lattice + Ord,
T: TraceReader<K, V, G::Timestamp, R> + Clone,
impl<G: Scope, K, V, R, T> Clone for Arranged<G, K, V, R, T>where
G::Timestamp: Lattice + Ord,
T: TraceReader<K, V, G::Timestamp, R> + Clone,
sourceimpl<G: Scope, K: Data, T1, R: Diff> Count<G, K, R> for Arranged<G, K, (), R, T1>where
G::Timestamp: Lattice + Ord,
T1: TraceReader<K, (), G::Timestamp, R> + Clone + 'static,
T1::Batch: BatchReader<K, (), G::Timestamp, R>,
impl<G: Scope, K: Data, T1, R: Diff> Count<G, K, R> for Arranged<G, K, (), R, T1>where
G::Timestamp: Lattice + Ord,
T1: TraceReader<K, (), G::Timestamp, R> + Clone + 'static,
T1::Batch: BatchReader<K, (), G::Timestamp, R>,
sourceimpl<G: Scope, K: Data, R: Diff, T1> CountTotal<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>,
impl<G: Scope, K: Data, R: Diff, T1> CountTotal<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>,
sourcefn count_total(&self) -> Collection<G, (K, R), isize>
fn count_total(&self) -> Collection<G, (K, R), isize>
sourceimpl<G: Scope, K: Data, V: Data, T1, R: Diff> Group<G, K, V, R> for Arranged<G, K, V, R, T1>where
G::Timestamp: Lattice + Ord,
T1: TraceReader<K, V, G::Timestamp, R> + Clone + 'static,
T1::Batch: BatchReader<K, V, G::Timestamp, R>,
impl<G: Scope, K: Data, V: Data, T1, R: Diff> Group<G, K, V, R> for Arranged<G, K, V, R, T1>where
G::Timestamp: Lattice + Ord,
T1: TraceReader<K, V, G::Timestamp, R> + Clone + 'static,
T1::Batch: BatchReader<K, V, G::Timestamp, R>,
sourceimpl<G: Scope, K: Data, V: Data, T1, R: Diff> GroupArranged<G, K, V, R> for Arranged<G, K, V, R, T1>where
G::Timestamp: Lattice + Ord,
T1: TraceReader<K, V, G::Timestamp, R> + Clone + 'static,
T1::Batch: BatchReader<K, V, G::Timestamp, R>,
impl<G: Scope, K: Data, V: Data, T1, R: Diff> GroupArranged<G, K, V, R> for Arranged<G, K, V, R, T1>where
G::Timestamp: Lattice + Ord,
T1: TraceReader<K, V, G::Timestamp, R> + Clone + 'static,
T1::Batch: BatchReader<K, V, G::Timestamp, R>,
sourcefn group_arranged<L, V2, T2, R2>(
&self,
logic: L
) -> Arranged<G, K, V2, R2, TraceAgent<K, V2, G::Timestamp, R2, T2>>where
V2: Data,
R2: Diff,
T2: Trace<K, V2, G::Timestamp, R2> + 'static,
T2::Batch: Batch<K, V2, G::Timestamp, R2>,
L: Fn(&K, &[(&V, R)], &mut Vec<(V2, R2)>) + 'static,
fn group_arranged<L, V2, T2, R2>(
&self,
logic: L
) -> Arranged<G, K, V2, R2, TraceAgent<K, V2, G::Timestamp, R2, T2>>where
V2: Data,
R2: Diff,
T2: Trace<K, V2, G::Timestamp, R2> + 'static,
T2::Batch: Batch<K, V2, G::Timestamp, R2>,
L: Fn(&K, &[(&V, R)], &mut Vec<(V2, R2)>) + 'static,
group to arranged data, and returns an arrangement of output data. Read moresourceimpl<G, K, V, R, T> Join<G, K, V, R> for Arranged<G, K, V, R, T>where
G: Scope,
G::Timestamp: Lattice + Ord,
K: Data + Hashable,
V: Data,
R: Diff,
T: TraceReader<K, V, G::Timestamp, R> + Clone + 'static,
T::Batch: BatchReader<K, V, G::Timestamp, R> + 'static,
impl<G, K, V, R, T> Join<G, K, V, R> for Arranged<G, K, V, R, T>where
G: Scope,
G::Timestamp: Lattice + Ord,
K: Data + Hashable,
V: Data,
R: Diff,
T: TraceReader<K, V, G::Timestamp, R> + Clone + 'static,
T::Batch: BatchReader<K, V, G::Timestamp, R> + 'static,
sourcefn join_map<V2: Data, R2: Diff, D: Data, L>(
&self,
other: &Collection<G, (K, V2), R2>,
logic: L
) -> Collection<G, D, <R as Mul<R2>>::Output>where
R: Mul<R2>,
<R as Mul<R2>>::Output: Diff,
L: Fn(&K, &V, &V2) -> D + 'static,
fn join_map<V2: Data, R2: Diff, D: Data, L>(
&self,
other: &Collection<G, (K, V2), R2>,
logic: L
) -> Collection<G, D, <R as Mul<R2>>::Output>where
R: Mul<R2>,
<R as Mul<R2>>::Output: Diff,
L: Fn(&K, &V, &V2) -> D + 'static,
sourcefn semijoin<R2: Diff>(
&self,
other: &Collection<G, K, R2>
) -> Collection<G, (K, V), <R as Mul<R2>>::Output>where
R: Mul<R2>,
<R as Mul<R2>>::Output: Diff,
fn semijoin<R2: Diff>(
&self,
other: &Collection<G, K, R2>
) -> Collection<G, (K, V), <R as Mul<R2>>::Output>where
R: Mul<R2>,
<R as Mul<R2>>::Output: Diff,
(key, val) and key based on key, producing the former with frequencies multiplied. Read moresourcefn antijoin<R2: Diff>(
&self,
other: &Collection<G, K, R2>
) -> Collection<G, (K, V), R>where
R: Mul<R2, Output = R>,
fn antijoin<R2: Diff>(
&self,
other: &Collection<G, K, R2>
) -> Collection<G, (K, V), R>where
R: Mul<R2, Output = R>,
(key, val) and key based on key, discarding values
in the first collection if their key is present in the second. Read more