Peng-Lei commented on a change in pull request #34494:
URL: https://github.com/apache/spark/pull/34494#discussion_r748037204
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
##########
@@ -81,9 +82,13 @@ object Cast {
case (StringType, CalendarIntervalType) => true
case (StringType, _: DayTimeIntervalType) => true
case (StringType, _: YearMonthIntervalType) => true
+ case (_: IntegralType, DayTimeIntervalType(s, e)) if s == e => true
+ case (_: IntegralType, YearMonthIntervalType(s, e)) if s == e => true
case (_: DayTimeIntervalType, _: DayTimeIntervalType) => true
case (_: YearMonthIntervalType, _: YearMonthIntervalType) => true
+ case (DayTimeIntervalType(s, e), _: IntegralType) if s == e => true
+ case (YearMonthIntervalType(s, e), _: IntegralType) if s == e => true
Review comment:
> Since we can cast INTERVAL DAY TO SECOND to INTERVAL SECOND, I think
it's a reasonable and convenient extension to cast INTERVAL DAY TO SECOND to
integral type directly.
So clever. You're absolutely right. I didn't think of this use case.
--
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]