Created
August 18, 2015 20:24
-
-
Save ponkin/12762746afcef1fcf3b1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Recursive joins | |
def stepOver(prevStep: RDD[(String, String)], iteration: Int = 1): RDD[(String, String)] = { | |
val currStep = index.cogroup(prevStep.map( _.swap )).flatMapValues(pair => | |
for (i <- pair._1.iterator; ps <- pair._2.iterator) | |
yield (ps, i) // ps - initial vertex, i - next vertex in path | |
).setName( s"""Step_$iteration""").persist() | |
val count = currStep.count() | |
if (count == 0 || iteration == 25) currStep | |
else currStep union stepOver(currStep, iteration + 1) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment