Skip to content

Instantly share code, notes, and snippets.

@ufo22940268
Created August 7, 2017 03:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ufo22940268/9fb56db23942dae943527175cd05c3c6 to your computer and use it in GitHub Desktop.
Save ufo22940268/9fb56db23942dae943527175cd05c3c6 to your computer and use it in GitHub Desktop.
b = sc.parallelize([("a", 4), ("c", 1)])
a = sc.parallelize([("a", 2), ("a", 3), ("b", 1)])
[(k, list(v)) for k, v in a.cogroup(b).filter(lambda v: v[1][0] and v[1][1]).mapValues(lambda v: v[0]).collect()]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment