sandeep-katta commented on a change in pull request #28600:
URL: https://github.com/apache/spark/pull/28600#discussion_r429033795



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala
##########
@@ -337,11 +340,19 @@ trait DivModLike extends BinaryArithmetic {
     } else {
       s"${eval2.value} == 0"
     }
-    val javaType = CodeGenerator.javaType(dataType)
+    val isIntegralDiv = this.isInstanceOf[IntegralDivide]
+    // From SPARK-16323 IntegralDivision returns Long data type
+    val javaType = if (isIntegralDiv) JAVA_LONG else 
CodeGenerator.javaType(dataType)
+    val operandJavaType = if (isIntegralDiv) operandsDataType match {
+      case _: IntegerType => JAVA_LONG

Review comment:
       I ran the `select -2147483648 / -1 ` query in some of the databases, 
results are as below
   
   MySQL => 2147483648
   
   PostgresSQl9.6 => Out of Integer Range exception
   
   mariaDB => 2147483648
   
   MS Sql Server 2017 => 2147483648




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



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

Reply via email to