MaxGekk commented on code in PR #36199:
URL: https://github.com/apache/spark/pull/36199#discussion_r850534442
##########
sql/core/src/test/scala/org/apache/spark/sql/errors/QueryExecutionErrorsSuite.scala:
##########
@@ -324,4 +324,16 @@ class QueryExecutionErrorsSuite extends QueryTest
assert(e5.getSqlState === "42000")
assert(e5.getMessage === "Cannot parse decimal")
}
+
+ test("CAST_CAUSES_OVERFLOW") {
+ val e = intercept[SparkArithmeticException] {
+ sql("set spark.sql.ansi.enabled=true")
Review Comment:
Please, don't set the config in this way. It will affects the tests that
will be added after this test. Use `withSQLConf` instead of it.
##########
sql/core/src/test/scala/org/apache/spark/sql/errors/QueryExecutionErrorsSuite.scala:
##########
@@ -324,4 +324,16 @@ class QueryExecutionErrorsSuite extends QueryTest
assert(e5.getSqlState === "42000")
assert(e5.getMessage === "Cannot parse decimal")
}
+
+ test("CAST_CAUSES_OVERFLOW") {
+ val e = intercept[SparkArithmeticException] {
+ sql("set spark.sql.ansi.enabled=true")
+ sql("select CAST(CAST('9999-12-31T12:13:14.56789Z' AS TIMESTAMP) AS
INT)").collect()
Review Comment:
Can you use the timestamp literal instead of cast:
`timestamp'9999-12-31T12:13:14.56789Z'`?
##########
sql/core/src/test/scala/org/apache/spark/sql/errors/QueryExecutionErrorsSuite.scala:
##########
@@ -324,4 +324,16 @@ class QueryExecutionErrorsSuite extends QueryTest
assert(e5.getSqlState === "42000")
assert(e5.getMessage === "Cannot parse decimal")
}
+
+ test("CAST_CAUSES_OVERFLOW") {
Review Comment:
add the specific title like:
```suggestion
test("CAST_CAUSES_OVERFLOW: from timestamp to int") {
```
--
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]