cloud-fan commented on a change in pull request #34494:
URL: https://github.com/apache/spark/pull/34494#discussion_r750877856
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
##########
@@ -1502,6 +1541,20 @@ abstract class CastBase extends UnaryExpression with
TimeZoneAwareExpression wit
code"""
$evPrim = $util.durationToMicros($util.microsToDuration($c),
(byte)${it.endField});
"""
+ case ByteType | ShortType | IntegerType =>
+ assert(it.startField == it.endField)
+ val util = IntervalUtils.getClass.getCanonicalName.stripSuffix("$")
+ (c, evPrim, _) =>
+ code"""
+ $evPrim = $util.intToDayTimeInterval($c, (byte)${it.endField});
+ """
+ case LongType =>
Review comment:
ditto, we can unify the two cases and write `if-else`
--
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]