vladanvasi-db commented on code in PR #47846:
URL: https://github.com/apache/spark/pull/47846#discussion_r1730825824
##########
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/util/IntervalUtilsSuite.scala:
##########
@@ -379,6 +384,15 @@ class IntervalUtilsSuite extends SparkFunSuite with
SQLHelper {
assert(negate(new CalendarInterval(1, 2, 3)) === new CalendarInterval(-1,
-2, -3))
}
+ test("parsing second_nano string") {
+ val parsingException = intercept[SparkIllegalArgumentException] {
+ toDTInterval("12", "33.33.33", 1)
+ }
+
+ assert(parsingException.getErrorClass ===
"INTERVAL_ERROR.SECOND_NANO_FORMAT")
+ assert(parsingException.getSqlState === "22009")
+ }
+
Review Comment:
I tried using `checkError()`, however, it is convenient for `SparkRuntime`
exceptions. All of the exceptions thrown in this case are
`SparkIllegalArgument` exceptions, thus the parameters are not adequate for
checking with the function `checkError()`. If you want, I can convert this one
and maybe some others to `SparkRuntime` exceptions and then check them with
`checkError()`
--
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]