Peng-Lei commented on a change in pull request #34494:
URL: https://github.com/apache/spark/pull/34494#discussion_r750959137
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
##########
@@ -1755,6 +1850,10 @@ abstract class CastBase extends UnaryExpression with
TimeZoneAwareExpression wit
castFractionToIntegralTypeCode("long", LongType.catalogString)
case x: NumericType =>
(c, evPrim, evNull) => code"$evPrim = (long) $c;"
+ case x: DayTimeIntervalType =>
+ castDayTimeIntervalToIntegralTypeCode(x.endField, "Long")
+ case x: YearMonthIntervalType =>
+ castYearMonthIntervalToIntegralTypeCode(x.endField, "Int")
Review comment:
Here we use `Int` instead of `Long`, as we use
`yearMonthIntervaltoInt().toLong` instead of define the function
`yearMonthIntervaltoLong`. also I think no problem that assign int value to
long result.
--
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]