Hi,

I have a Spark method that returns RDD[String], which I am converting to a
set and then comparing it to the expected output as shown in the following
code. 

1. val expected_res = Set("ID1", "ID2", "ID3")  // expected output

2. val result:RDD[String] = getData(input)  //method returns RDD[String]
3. val set_val = result.collect().toSet     // convert to set. 
4. println(set_val)                                 // prints:  Set("ID1",
"ID2", "ID3")
5. println(expected_res)                        // prints:  Set(ID1, ID2,
ID3)

// verify output
6. if( set_val == expected_res)
7.    println("true")                          // this does not get printed

The value returned by the method is almost same as expected output, but the
verification is failing. I am not sure why the expected_res in Line 5 does
not print the quotes even though Line 1 has them. Could  that be the reason
the comparison is failing? What is the right way to do the above comparison?

thanks





--
View this message in context: 
http://apache-spark-user-list.1001560.n3.nabble.com/Set-comparison-tp7696.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.

Reply via email to