Last active
March 4, 2018 16:29
-
-
Save dgadiraju/7da6b7c3c04358007c4fae0951f14864 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
val path = "/public/retail_db" or val path = "/Users/itversity/Research/data/retail_db" | |
val rdd = sc.textFile(path + "/orders") | |
rdd.reduce((agg, ele) => { | |
if(agg.split(",")(2).toInt < ele.split(",")(2).toInt) agg else ele | |
}) | |
rdd.top(2) | |
rdd.takeOrdered(5)(Ordering[Int].reverse.on(x => x.split(",")(2).toInt)).foreach(println) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment