From ad93295d1b43881776643fb30698d5172bf6db16 Mon Sep 17 00:00:00 2001 From: zsxwing Date: Wed, 22 Apr 2015 08:12:14 +0800 Subject: [PATCH] Remove unnecessary codes --- .../org/apache/spark/util/Distribution.scala | 29 ------------------- 1 file changed, 29 deletions(-) diff --git a/core/src/main/scala/org/apache/spark/util/Distribution.scala b/core/src/main/scala/org/apache/spark/util/Distribution.scala index 5931e7bcad9e9..9aea8efa38c7a 100644 --- a/core/src/main/scala/org/apache/spark/util/Distribution.scala +++ b/core/src/main/scala/org/apache/spark/util/Distribution.scala @@ -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 @@ -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 {