sathiyapk commented on a change in pull request #34729:
URL: https://github.com/apache/spark/pull/34729#discussion_r757959074



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/mathExpressions.scala
##########
@@ -453,40 +439,26 @@ case class Expm1(child: Expression) extends 
UnaryMathExpression(StrictMath.expm1
   examples = """
     Examples:
       > SELECT _FUNC_(-0.1);
-       -1
+       -1.0
       > SELECT _FUNC_(5);
        5
+      > SELECT _FUNC_(3.1411, 3);
+       3.141
+      > SELECT _FUNC_(3.1411, -3);
+       1000.0

Review comment:
       If scale_expr is negative, then it specifies the number of places before 
the decimal point to which to adjust the number. For example, if the scale is 
-2, then the result is a multiple of 100.
   
   REF: https://docs.snowflake.com/en/sql-reference/functions/ceil.html

##########
File path: sql/core/src/test/resources/sql-tests/results/operators.sql.out
##########
@@ -357,87 +357,87 @@ struct<COT(-1):double>
 -- !query
 select ceiling(0)
 -- !query schema
-struct<ceiling(0):bigint>
+struct<ceiling(0, 0):int>

Review comment:
       I'm not sure how to do it. Could you please show me an example in the 
code ? thanks.

##########
File path: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/MathExpressionsSuite.scala
##########
@@ -658,6 +658,38 @@ class MathExpressionsSuite extends SparkFunSuite with 
ExpressionEvalHelper {
     val intResultsB: Seq[Int] = Seq(314000000, 314200000, 314160000, 
314159000, 314159300,
       314159260) ++ Seq.fill(7)(314159265)
 
+    val doubleResultsFloor: Seq[Double] = Seq(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 
3.0, 3.1, 3.14, 3.141,
+      3.1415, 3.14159, 3.141592)
+
+    val doubleResultsCeil: Seq[Double] = Seq(1000000.0, 100000.0, 10000.0, 
1000.0, 100.0, 10.0, 4.0,
+      3.2, 3.15, 3.142, 3.1416, 3.1416, 3.141593)
+
+    val floatResultsFloor: Seq[Float] = Seq(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 
0.0f, 3.0f, 3.1f, 3.14f,
+      3.141f, 3.1414f, 3.14149f, 3.141499f)
+
+    val floatResultsCeil: Seq[Float] = Seq(1000000.0f, 100000.0f, 10000.0f, 
1000.0f, 100.0f, 10.0f,
+      4.0f, 3.2f, 3.15f, 3.142f, 3.1415f, 3.1415f, 3.1415f)
+
+    val shortResultsFloor: Seq[Short] = Seq[Short](0, 0, 30000, 31000, 31400, 
31410) ++
+      Seq.fill[Short](7)(31415)
+
+    val shortResultsCeil: Seq[Short] = Seq[Short](16960, -31072, -25536, 
32000, 31500, 31420) ++
+      Seq.fill[Short](7)(31415)
+

Review comment:
       Could anybody double check the results of Ceil for shortPI, please ?




-- 
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]

Reply via email to