Skip to content

Instantly share code, notes, and snippets.

@gregology
Created December 11, 2014 23:46
Show Gist options
  • Save gregology/97cf4cb7ac973ac62e2e to your computer and use it in GitHub Desktop.
Save gregology/97cf4cb7ac973ac62e2e to your computer and use it in GitHub Desktop.
foo = sc.records([{'foo': 123}, {'foo': 321}])
bar = sc.records([{'bar': 123}, {'bar': 321}])
baz = sc.records([{'baz': 123}, {'baz': 321}])
qux = foo.cartesian(bar)\
.map(lambda (x,y): x.merge(y))\
.cartesian(baz)\
.map(lambda (x,y): x.merge(y))
qux.collect()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment