ycli12 commented on code in PR #56921:
URL: https://github.com/apache/spark/pull/56921#discussion_r3543991397
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/mathExpressions.scala:
##########
@@ -275,6 +292,21 @@ case class Ceil(child: Expression) extends
UnaryMathExpression(math.ceil, "CEIL"
case DecimalType.Fixed(_, _) =>
defineCodeGen(ctx, ev, c => s"$c.ceil()")
case LongType => defineCodeGen(ctx, ev, c => s"$c")
+ case DoubleType if failOnError =>
+ nullSafeCodeGen(ctx, ev, c => {
+ val roundedValue = ctx.freshName("roundedValue")
+ val errorContext = getContextOrNullCode(ctx)
+ s"""
+ |double $roundedValue = java.lang.Math.${funcName}($c);
Review Comment:
Addressed in 74390ca069c9 by adding `CeilFloor.doubleToLongCode` and using
it from both `Ceil` and `Floor` codegen paths. I reran `MathExpressionsSuite --
-z ceil` and `MathExpressionsSuite -- -z floor` locally.
--
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]