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



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
##########
@@ -356,10 +357,11 @@ class Analyzer(override val catalogManager: 
CatalogManager)
             DatetimeSub(l, r, DateAddYMInterval(l, UnaryMinus(r, f)))
           case (TimestampType, YearMonthIntervalType) =>
             DatetimeSub(l, r, TimestampAddYMInterval(l, UnaryMinus(r, f)))
-          case (CalendarIntervalType, CalendarIntervalType) => s
+          case (CalendarIntervalType, CalendarIntervalType) |
+               (DayTimeIntervalType, DayTimeIntervalType) => s

Review comment:
       The `YearMonthIntervalType` is handled by the default case `case _ => 
s`. We need to handle `CalendarIntervalType` and `DayTimeIntervalType` 
especially otherwise they will be casted to some unexpected type in the base 
arithmetic ops `+`/`-`




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