gengliangwang commented on a change in pull request #32260: URL: https://github.com/apache/spark/pull/32260#discussion_r616845726
########## 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 => + (x: Any, y: Any) => { + if (x == Long.MinValue && y == -1) { Review comment: Yeah it's tricky. It is hard to reuse the`doGenCode` here so I added a new flag `isIntegralDivide`. The original idea is to keep the special handling code in `IntegralDivide` if possible. But now it seems asymmetric in both sides.. -- 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