comphead commented on code in PR #5050:
URL: https://github.com/apache/datafusion-comet/pull/5050#discussion_r3696036995
##########
spark/src/main/scala/org/apache/comet/expressions/CometCast.scala:
##########
@@ -441,13 +437,18 @@ object CometCast
case _ => unsupported(DataTypes.DoubleType, toType)
}
- private def canCastFromDecimal(toType: DataType): SupportLevel = toType
match {
- case DataTypes.FloatType | DataTypes.DoubleType | DataTypes.ByteType |
DataTypes.ShortType |
- DataTypes.IntegerType | DataTypes.LongType | DataTypes.BooleanType |
- DataTypes.TimestampType =>
- Compatible()
- case _ => Unsupported(Some(s"Cast from DecimalType to $toType is not
supported"))
- }
+ private def canCastFromDecimal(fromType: DecimalType, toType: DataType):
SupportLevel =
+ toType match {
+ // Negative-scale source overflows natively; see #5013.
+ case DataTypes.ByteType | DataTypes.ShortType | DataTypes.IntegerType |
DataTypes.LongType |
+ DataTypes.TimestampType if fromType.scale < 0 =>
Review Comment:
should we do early return here?
--
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]