Skip to content

Commit

Permalink
Remove unnecessary codes
Browse files Browse the repository at this point in the history
  • Loading branch information
zsxwing committed Apr 22, 2015
1 parent a0458f9 commit ad93295
Showing 1 changed file with 0 additions and 29 deletions.
29 changes: 0 additions & 29 deletions core/src/main/scala/org/apache/spark/util/Distribution.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ package org.apache.spark.util
import java.io.PrintStream

import scala.collection.immutable.IndexedSeq
import scala.collection.mutable.ArrayBuffer

/**
* Util for getting some stats from a small sample of numeric values, with some handy
Expand Down Expand Up @@ -68,34 +67,6 @@ private[spark] class Distribution(val data: Array[Double], val startIdx: Int, va
out.println(statCounter)
showQuantiles(out)
}

def histogram(bins: Int): Seq[(Double, Int)] = {
require(bins > 0)
val stat = statCounter
val binSize = (stat.max - stat.min) / (bins - 1)
val points = new Array[Double](bins)
for (i <- 0 until (bins - 1)) {
points(i) = stat.min + binSize * i
}
points(bins - 1) = stat.max
val counts = new Array[Int](bins)
for (i <- startIdx until endIdx) {
val v = data(i)
var j = 0
var find = false
while (!find && j < bins - 1) {
if (v < points(j) + binSize / 2) {
counts(j) += 1
find = true
}
j += 1
}
if (!find) {
counts(bins - 1) += 1
}
}
points.zip(counts)
}
}

private[spark] object Distribution {
Expand Down

0 comments on commit ad93295

Please sign in to comment.