This file contains hidden or 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
/** | |
* compute percentile from an unsorted Spark RDD | |
* @param data: input data set of Long integers | |
* @param tile: percentile to compute (eg. 85 percentile) | |
* @return value of input data at the specified percentile | |
*/ | |
def computePercentile(data: RDD[Long], tile: Double): Double = { | |
// NIST method; data to be sorted in ascending order | |
val r = data.sortBy(x => x) | |
val c = r.count() |