MaxGekk commented on code in PR #36314:
URL: https://github.com/apache/spark/pull/36314#discussion_r855790606
##########
sql/core/src/test/scala/org/apache/spark/sql/errors/QueryExecutionAnsiErrorsSuite.scala:
##########
@@ -77,4 +77,23 @@ class QueryExecutionAnsiErrorsSuite extends QueryTest with
SharedSparkSession {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|""".stripMargin)
}
+
+ test("INVALID_ARRAY_INDEX: get element from array") {
+ val e = intercept[SparkArrayIndexOutOfBoundsException] {
+ sql("select array(1, 2, 3, 4, 5)[8]").collect()
+ }
+ assert(e.getErrorClass === "INVALID_ARRAY_INDEX")
+ assert(e.getMessage === "Invalid index: 8, numElements: 5. " +
+ "If necessary set spark.sql.ansi.enabled to false to bypass this error.")
Review Comment:
Could you use the `checkErrorClass` method added by
https://github.com/apache/spark/pull/36287. BTW, the method checks the tag in
error messages.
--
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]