Skip to content

Commit ea85ec4

Browse files
committed
Correct example, improve chunking
1 parent 34d77c0 commit ea85ec4

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

differential-dataflow/examples/columnar.rs

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ fn main() {
9494
buffer.clear();
9595
i += worker.peers();
9696
}
97-
data_input.send_batch(&mut container);
97+
keys_input.send_batch(&mut container);
9898
container.clear();
9999
queries += size;
100100
data_input.advance_to(data_input.time() + 1);
@@ -414,7 +414,7 @@ pub mod batcher {
414414
for<'b> T::Ref<'b>: Ord + Copy,
415415
R: Columnar + Semigroup + for<'b> Semigroup<R::Ref<'b>>,
416416
for<'b> R::Ref<'b>: Ord,
417-
C2: Container + for<'b> PushInto<&'b (D, T, R)>,
417+
C2: Container + for<'b, 'c> PushInto<(D::Ref<'b>, T::Ref<'b>, &'c R)>,
418418
{
419419
fn push_into(&mut self, container: &'a mut Column<(D, T, R)>) {
420420

@@ -431,9 +431,6 @@ pub mod batcher {
431431
let mut iter = permutation.drain(..);
432432
if let Some((data, time, diff)) = iter.next() {
433433

434-
let mut owned_data = D::into_owned(data);
435-
let mut owned_time = T::into_owned(time);
436-
437434
let mut prev_data = data;
438435
let mut prev_time = time;
439436
let mut prev_diff = <R as Columnar>::into_owned(diff);
@@ -444,12 +441,8 @@ pub mod batcher {
444441
}
445442
else {
446443
if !prev_diff.is_zero() {
447-
D::copy_from(&mut owned_data, prev_data);
448-
T::copy_from(&mut owned_time, prev_time);
449-
let tuple = (owned_data, owned_time, prev_diff);
450-
self.empty.push_into(&tuple);
451-
owned_data = tuple.0;
452-
owned_time = tuple.1;
444+
let tuple = (prev_data, prev_time, &prev_diff);
445+
self.empty.push_into(tuple);
453446
}
454447
prev_data = data;
455448
prev_time = time;
@@ -458,10 +451,8 @@ pub mod batcher {
458451
}
459452

460453
if !prev_diff.is_zero() {
461-
D::copy_from(&mut owned_data, prev_data);
462-
T::copy_from(&mut owned_time, prev_time);
463-
let tuple = (owned_data, owned_time, prev_diff);
464-
self.empty.push_into(&tuple);
454+
let tuple = (prev_data, prev_time, &prev_diff);
455+
self.empty.push_into(tuple);
465456
}
466457
}
467458
}
@@ -661,6 +652,7 @@ pub mod dd_builder {
661652
<L::ValContainer as BatchContainer>::Owned: Columnar,
662653
<L::TimeContainer as BatchContainer>::Owned: Columnar,
663654
<L::DiffContainer as BatchContainer>::Owned: Columnar,
655+
// These two constraints seem .. like we could potentially replace by `Columnar::Ref<'a>`.
664656
for<'a> L::KeyContainer: PushInto<&'a <L::KeyContainer as BatchContainer>::Owned>,
665657
for<'a> L::ValContainer: PushInto<&'a <L::ValContainer as BatchContainer>::Owned>,
666658
for<'a> <L::TimeContainer as BatchContainer>::ReadItem<'a> : IntoOwned<'a, Owned = <L::Target as Update>::Time>,

0 commit comments

Comments
 (0)