kiszk commented on a change in pull request #25300: [SPARK-28503][SQL] Return
null result on cast an out-of-range value to a integral type
URL: https://github.com/apache/spark/pull/25300#discussion_r312589799
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
##########
@@ -1150,11 +1338,45 @@ case class Cast(child: Expression, dataType: DataType,
timeZoneId: Option[String
case DateType =>
(c, evPrim, evNull) => code"$evNull = true;"
case TimestampType =>
- (c, evPrim, evNull) => code"$evPrim = (byte)
${timestampToIntegerCode(c)};"
+ val longValue = ctx.freshName("longValue")
Review comment:
Among `castToByteCode`, `castToShortCode`, and `castToIntCode`, can we do
refactoring by introducing a helper function that has arguments type as
`String`, `MaxValue`, `MinValue`? As a result, we can reduce a similar code.
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]