cloud-fan commented on a change in pull request #32314:
URL: https://github.com/apache/spark/pull/32314#discussion_r620093720
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/intervalExpressions.scala
##########
@@ -402,6 +403,19 @@ case class DivideYMInterval(
override def inputTypes: Seq[AbstractDataType] = Seq(YearMonthIntervalType,
NumericType)
override def dataType: DataType = YearMonthIntervalType
+ def checkDivideOverflow(month: Int, num: Any): Unit = {
+ if (month == Int.MinValue) {
+ num match {
+ case l: Long if l == -1L => throw
QueryExecutionErrors.overflowInIntegralDivideError()
+ case number: Number if number.doubleValue() == -1.0D =>
+ throw QueryExecutionErrors.overflowInIntegralDivideError()
+ case decimal: Decimal if decimal.equals(Decimal.apply(-1)) =>
Review comment:
I think @MaxGekk 's comment is very clear. The only unreasonable case is
`... / -1`, not `... / -1.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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]