You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/04/20 15:19:48 UTC

[GitHub] [spark] cloud-fan commented on a change in pull request #32260: [SPARK-35152][SQL] ANSI mode: IntegralDivide throws exception on overflow

cloud-fan commented on a change in pull request #32260:
URL: https://github.com/apache/spark/pull/32260#discussion_r616786590



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala
##########
@@ -562,13 +577,27 @@ case class IntegralDivide(
       case d: DecimalType =>
         d.asIntegral.asInstanceOf[Integral[Any]]
     }
-    (x, y) => {
-      val res = integral.quot(x, y)
-      if (res == null) {
-        null
-      } else {
-        integral.asInstanceOf[Integral[Any]].toLong(res)
+    val _div =
+      (x: Any, y: Any) => {
+        val res = integral.quot(x, y)
+        if (res == null) {
+          null
+        } else {
+          integral.asInstanceOf[Integral[Any]].toLong(res)
+        }
       }
+
+    dataType match {
+      case LongType if failOnError =>

Review comment:
       This is not necessary because this class has `override def dataType: DataType = LongType`




-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org