You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/04/22 06:45:28 UTC
[GitHub] [spark] panbingkun commented on a diff in pull request #36314: [SPARK-38736][SQL][TESTS] Test the error classes: INVALID_ARRAY_INDEX & INVALID_ARRAY_INDEX_IN_ELEMENT_AT
panbingkun commented on code in PR #36314:
URL: https://github.com/apache/spark/pull/36314#discussion_r855814432
##########
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:
ok
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org