Skip to content

Commit 8a04699

Browse files
authored
Loosen trait bounds on Arrange for Collection (#375)
Allows to call arrange_core on a collection that cannot be exchanged. Signed-off-by: Moritz Hoffmann <antiguru@gmail.com> Signed-off-by: Moritz Hoffmann <antiguru@gmail.com>
1 parent c2e8fef commit 8a04699

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

src/operators/arrange/arrangement.rs

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -495,10 +495,31 @@ impl<G, K, V, R> Arrange<G, K, V, R> for Collection<G, (K, V), R>
495495
where
496496
G: Scope,
497497
G::Timestamp: Lattice+Ord,
498-
K: ExchangeData+Hashable,
499-
V: ExchangeData,
500-
R: Semigroup+ExchangeData,
498+
K: Data,
499+
V: Data,
500+
R: Semigroup,
501501
{
502+
fn arrange<Tr>(&self) -> Arranged<G, TraceAgent<Tr>>
503+
where
504+
K: ExchangeData + Hashable,
505+
V: ExchangeData,
506+
R: ExchangeData,
507+
Tr: Trace + TraceReader<Key=K, Val=V, Time=G::Timestamp, R=R> + 'static, Tr::Batch: Batch
508+
{
509+
self.arrange_named("Arrange")
510+
}
511+
512+
fn arrange_named<Tr>(&self, name: &str) -> Arranged<G, TraceAgent<Tr>>
513+
where
514+
K: ExchangeData + Hashable,
515+
V: ExchangeData,
516+
R: ExchangeData,
517+
Tr: Trace + TraceReader<Key=K, Val=V, Time=G::Timestamp, R=R> + 'static, Tr::Batch: Batch
518+
{
519+
let exchange = Exchange::new(move |update: &((K,V),G::Timestamp,R)| (update.0).0.hashed().into());
520+
self.arrange_core(exchange, name)
521+
}
522+
502523
fn arrange_core<P, Tr>(&self, pact: P, name: &str) -> Arranged<G, TraceAgent<Tr>>
503524
where
504525
P: ParallelizationContract<G::Timestamp, ((K,V),G::Timestamp,R)>,

0 commit comments

Comments
 (0)