Skip to content

Commit ad93295

Browse files
committed
Remove unnecessary codes
1 parent a0458f9 commit ad93295

File tree

1 file changed

+0
-29
lines changed

1 file changed

+0
-29
lines changed

core/src/main/scala/org/apache/spark/util/Distribution.scala

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ package org.apache.spark.util
2020
import java.io.PrintStream
2121

2222
import scala.collection.immutable.IndexedSeq
23-
import scala.collection.mutable.ArrayBuffer
2423

2524
/**
2625
* 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
6867
out.println(statCounter)
6968
showQuantiles(out)
7069
}
71-
72-
def histogram(bins: Int): Seq[(Double, Int)] = {
73-
require(bins > 0)
74-
val stat = statCounter
75-
val binSize = (stat.max - stat.min) / (bins - 1)
76-
val points = new Array[Double](bins)
77-
for (i <- 0 until (bins - 1)) {
78-
points(i) = stat.min + binSize * i
79-
}
80-
points(bins - 1) = stat.max
81-
val counts = new Array[Int](bins)
82-
for (i <- startIdx until endIdx) {
83-
val v = data(i)
84-
var j = 0
85-
var find = false
86-
while (!find && j < bins - 1) {
87-
if (v < points(j) + binSize / 2) {
88-
counts(j) += 1
89-
find = true
90-
}
91-
j += 1
92-
}
93-
if (!find) {
94-
counts(bins - 1) += 1
95-
}
96-
}
97-
points.zip(counts)
98-
}
9970
}
10071

10172
private[spark] object Distribution {

0 commit comments

Comments
 (0)