gengliangwang commented on code in PR #46434:
URL: https://github.com/apache/spark/pull/46434#discussion_r1594306390


##########
sql/core/src/test/scala/org/apache/spark/sql/MathFunctionsSuite.scala:
##########
@@ -707,6 +707,11 @@ class MathFunctionsSuite extends QueryTest with 
SharedSparkSession {
       df1.select(try_divide(make_interval(col("year"), col("month")), lit(0))))
   }
 
+  test("try_remainder") {
+    val df = Seq((10, 3), (5, 5), (5, 0)).toDF("birth", "age")

Review Comment:
   Let's have some end-to-end test with decimal input as well, either in this 
test suite or in 
`sql/core/src/test/resources/sql-tests/inputs/try_arithmetic.sql`
   
   context: there was a bug found recently 
https://github.com/apache/spark/pull/46286



##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/TryEval.scala:
##########
@@ -132,6 +132,43 @@ case class TryDivide(left: Expression, right: Expression, 
replacement: Expressio
   }
 }
 
+// scalastyle:off line.size.limit
+@ExpressionDescription(
+  usage = "_FUNC_(dividend, divisor) - Returns the remainder after 
`expr1`/`expr2`. " +
+    "`dividend` must be a numeric. `divisor` must be a numeric.",
+  examples = """
+    Examples:
+      > SELECT _FUNC_(3, 2);
+       1
+      > SELECT _FUNC_(2L, 2L);
+       0
+      > SELECT _FUNC_(3.0, 2.0);
+       1.0
+      > SELECT _FUNC_(1, 0);
+       NULL
+  """,
+  since = "3.2.0",

Review Comment:
   ```suggestion
     since = "4.0.0",
   ```



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