Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. a = ["abababab", "ccffccff", "123123", "56575656"]
  2. b = ["ab", "55", "adfadf", "123", "5656"]
  3. output = [True, False, True, True]
  4.  
  5. val a = sc.parallelize(List("abababab", "ccffccff", "123123", "56575656"))
  6. val b = sc.parallelize(List("ab", "55", "adfadf", "123", "5656"))
  7.  
  8. a.cartesian(b)
  9. .map({case (x,y) => (x, x contains y) })
  10. .reduceByKey(_ || _).map(w => w._1 + "," + w._2).saveAsTextFile("./output.txt")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement