Skip to content

Instantly share code, notes, and snippets.

@gregology
Created December 11, 2014 23:46
Show Gist options
  • Select an option

  • Save gregology/97cf4cb7ac973ac62e2e to your computer and use it in GitHub Desktop.

Select an option

Save gregology/97cf4cb7ac973ac62e2e to your computer and use it in GitHub Desktop.

Revisions

  1. gregology created this gist Dec 11, 2014.
    10 changes: 10 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    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()