maropu commented on a change in pull request #28764:
URL: https://github.com/apache/spark/pull/28764#discussion_r438491409
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/mathExpressions.scala
##########
@@ -1325,3 +1325,94 @@ case class BRound(child: Expression, scale: Expression)
with Serializable with ImplicitCastInputTypes {
def this(child: Expression) = this(child, Literal(0))
}
+
+object WidthBucket {
+
+ def computeBucketNumber(value: Double, min: Double, max: Double, numBucket:
Long): jl.Long = {
+ if (numBucket <= 0 || numBucket == Long.MaxValue || jl.Double.isNaN(value)
|| min == max ||
+ jl.Double.isNaN(min) || jl.Double.isInfinite(min) ||
+ jl.Double.isNaN(max) || jl.Double.isInfinite(max)) {
Review comment:
At least, Pg can accept the infinity:
https://github.com/postgres/postgres/blob/master/src/test/regress/expected/numeric.out#L843-L848
Currently, this PR follows that behaviour.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]