Skip to content

Commit 5bb9784

Browse files
committed
Simplify constraints
1 parent a6cda14 commit 5bb9784

File tree

1 file changed

+14
-19
lines changed

1 file changed

+14
-19
lines changed

differential-dataflow/examples/columnar.rs

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ fn main() {
2323
worker: timely::WorkerConfig::default(),
2424
};
2525

26-
let keys: usize = std::env::args().nth(1).unwrap().parse().unwrap();
27-
let size: usize = std::env::args().nth(2).unwrap().parse().unwrap();
26+
let keys: usize = std::env::args().nth(1).expect("missing argument 1").parse().unwrap();
27+
let size: usize = std::env::args().nth(2).expect("missing argument 2").parse().unwrap();
2828

2929
let timer1 = ::std::time::Instant::now();
3030
let timer2 = timer1.clone();
@@ -226,7 +226,7 @@ mod container {
226226
}
227227

228228
use timely::container::PushInto;
229-
impl<C: Columnar, T> PushInto<T> for Column<C> where C::Container: columnar::Push<T> {
229+
impl<T, C: Columnar<Container: columnar::Push<T>>> PushInto<T> for Column<C> {
230230
#[inline]
231231
fn push_into(&mut self, item: T) {
232232
use columnar::Push;
@@ -408,12 +408,9 @@ pub mod batcher {
408408

409409
impl<'a, D, T, R, C2> PushInto<&'a mut Column<(D, T, R)>> for Chunker<C2>
410410
where
411-
D: Columnar,
412-
for<'b> D::Ref<'b>: Ord + Copy,
413-
T: Columnar,
414-
for<'b> T::Ref<'b>: Ord + Copy,
415-
R: Columnar + Semigroup + for<'b> Semigroup<R::Ref<'b>>,
416-
for<'b> R::Ref<'b>: Ord,
411+
D: for<'b> Columnar<Ref<'b>: Ord>,
412+
T: for<'b> Columnar<Ref<'b>: Ord>,
413+
R: for<'b> Columnar<Ref<'b>: Ord> + for<'b> Semigroup<R::Ref<'b>>,
417414
C2: Container + for<'b, 'c> PushInto<(D::Ref<'b>, T::Ref<'b>, &'c R)>,
418415
{
419416
fn push_into(&mut self, container: &'a mut Column<(D, T, R)>) {
@@ -485,7 +482,12 @@ pub mod batcher {
485482
head: usize,
486483
}
487484

488-
impl<D: Ord + Columnar, T: Ord + Columnar, R: Columnar> ContainerQueue<Column<(D, T, R)>> for ColumnQueue<(D, T, R)> {
485+
impl<D, T, R> ContainerQueue<Column<(D, T, R)>> for ColumnQueue<(D, T, R)>
486+
where
487+
D: for<'a> Columnar<Ref<'a>: Ord>,
488+
T: for<'a> Columnar<Ref<'a>: Ord>,
489+
R: Columnar,
490+
{
489491
fn next_or_alloc(&mut self) -> Result<<(D, T, R) as Columnar>::Ref<'_>, Column<(D, T, R)>> {
490492
if self.is_empty() {
491493
Err(std::mem::take(&mut self.list))
@@ -502,11 +504,6 @@ pub mod batcher {
502504
let (data1, time1, _) = self.peek();
503505
let (data2, time2, _) = other.peek();
504506

505-
let data1 = <D as Columnar>::into_owned(data1);
506-
let data2 = <D as Columnar>::into_owned(data2);
507-
let time1 = <T as Columnar>::into_owned(time1);
508-
let time2 = <T as Columnar>::into_owned(time2);
509-
510507
(data1, time1).cmp(&(data2, time2))
511508
}
512509
fn from(list: Column<(D, T, R)>) -> Self {
@@ -527,17 +524,15 @@ pub mod batcher {
527524

528525
impl<D, T, R> MergerChunk for Column<(D, T, R)>
529526
where
530-
D: Ord + Columnar + 'static,
531-
T: Ord + timely::PartialOrder + Clone + Columnar + 'static,
532-
for<'a> <T as Columnar>::Ref<'a> : Copy,
527+
D: Columnar + 'static,
528+
T: timely::PartialOrder + Clone + Columnar + 'static,
533529
R: Default + Semigroup + Columnar + 'static
534530
{
535531
type TimeOwned = T;
536532
type DiffOwned = R;
537533

538534
fn time_kept((_, time, _): &Self::Item<'_>, upper: &AntichainRef<Self::TimeOwned>, frontier: &mut Antichain<Self::TimeOwned>) -> bool {
539535
let time = T::into_owned(*time);
540-
// let time = unimplemented!();
541536
if upper.less_equal(&time) {
542537
frontier.insert(time);
543538
true

0 commit comments

Comments
 (0)