MaxGekk commented on a change in pull request #33889:
URL: https://github.com/apache/spark/pull/33889#discussion_r701272912



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/intervalExpressions.scala
##########
@@ -615,15 +615,19 @@ case class DivideYMInterval(
   @transient
   private lazy val evalFunc: (Int, Any) => Any = right.dataType match {
     case LongType => (months: Int, num) =>
+      if (num == 0) throw QueryExecutionErrors.divideByZeroError()

Review comment:
       We don't need to double check proactively that `num` is 0. 
`LongMath.divide` will do that for you. Just catch the Java exception, and 
replace it by Spark's one.




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