thejdeep commented on code in PR #41017:
URL: https://github.com/apache/spark/pull/41017#discussion_r1202733724
##########
core/src/main/scala/org/apache/spark/util/Utils.scala:
##########
@@ -232,6 +232,18 @@ private[spark] object Utils extends Logging {
// scalastyle:on classforname
}
+ def getQuantilesValue(
+ values: IndexedSeq[Double],
+ quantiles: Array[Double]): IndexedSeq[Double] = {
+ val count = values.size
+ val indices = quantiles.map { q => math.min((q * count).toLong, count - 1)
}
Review Comment:
Addressed it, thanks.
##########
core/src/main/scala/org/apache/spark/util/Utils.scala:
##########
@@ -232,6 +232,18 @@ private[spark] object Utils extends Logging {
// scalastyle:on classforname
}
+ def getQuantilesValue(
+ values: IndexedSeq[Double],
+ quantiles: Array[Double]): IndexedSeq[Double] = {
+ val count = values.size
+ val indices = quantiles.map { q => math.min((q * count).toLong, count - 1)
}
+ if (count > 0) {
+ indices.map(i => values(i.toInt)).toIndexedSeq
+ } else {
+ quantiles.map(_ => 0.0)
Review Comment:
Thanks for the suggestion, addressed it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]