Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nag9s/78db55392b3db88adc5ee1606312716c to your computer and use it in GitHub Desktop.
Save nag9s/78db55392b3db88adc5ee1606312716c to your computer and use it in GitHub Desktop.
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