maropu commented on a change in pull request #25253: [SPARK-28470][SQL] Cast to
decimal throws ArithemticException on overflow
URL: https://github.com/apache/spark/pull/25253#discussion_r310350262
##########
File path:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CastSuite.scala
##########
@@ -1018,4 +1019,25 @@ class CastSuite extends SparkFunSuite with
ExpressionEvalHelper {
checkEvaluation(ret, InternalRow(null))
}
}
+
+ test("SPARK-28470: Cast should honor nullOnOverflow property") {
+ withSQLConf(SQLConf.DECIMAL_OPERATIONS_NULL_ON_OVERFLOW.key -> "true") {
+ checkEvaluation(Cast(Literal("134.12"), DecimalType(3, 2)), null)
+ checkEvaluation(
+ Cast(Literal(java.sql.Timestamp.valueOf("2019-07-25 22:04:36")),
DecimalType(3, 2)), null)
Review comment:
`java.sql.Timestamp`->`Timestamp`?
----------------------------------------------------------------
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]