Skip to content

Commit

Permalink
fixed test case for subtract
Browse files Browse the repository at this point in the history
  • Loading branch information
ajprabhu09 committed Jul 6, 2020
1 parent 8a288e3 commit 408520c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/rdd/rdd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ pub trait Rdd: RddBase + 'static {
{
self.subtract_with_num_partition(other, self.number_of_splits())
}

fn subtract_with_num_partition<T>(
&self,
other: Arc<T>,
Expand Down
16 changes: 15 additions & 1 deletion tests/test_rdd.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::collections::HashSet;
use std::fs::{create_dir_all, File};
use std::io::prelude::*;
use std::sync::Arc;
Expand Down Expand Up @@ -681,5 +682,18 @@ fn test_subtract() {
let first = sc.parallelize(col1, 4);
let second = sc.parallelize(col2, 4);
let ans = first.subtract(Arc::new(second));
assert_eq!(ans.collect().unwrap(), vec![19, 12, 10, 1, 0, 2])
// assert_eq!(HashSet::from_iter(ans.collect().unwrap().iter().cloned()), HashSet::from_iter(vec![19, 12, 10, 1, 0, 2].iter().cloned()));

let mut expected_vec = vec![19, 12, 10, 1, 0, 2];
expected_vec.sort();
let mut actual = ans.collect().unwrap();
actual.sort();



println!("{:?}",expected_vec);
println!("{:?}",actual);

assert_eq!(actual,expected_vec)

}

0 comments on commit 408520c

Please sign in to comment.