snuyanzin commented on code in PR #3706:
URL: https://github.com/apache/calcite/pull/3706#discussion_r1512696170


##########
testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java:
##########
@@ -6277,6 +6277,19 @@ void checkRegexpExtract(SqlOperatorFixture f0, 
FunctionAlias functionAlias) {
     f.checkScalar("rand_integer(2, 11)", 1, "INTEGER NOT NULL");
   }
 
+  /** Test case for <a 
href="https://issues.apache.org/jira/browse/CALCITE-6283";>
+   * [CALCITE-6283] Function array_append with a NULL array argument crashes 
with
+   * NullPointerException</a>. */
+  @Test void testArrayNullFunc() {
+    final String expected = "Illegal use of 'NULL'";
+    final SqlOperatorFixture f = fixture().withLibrary(SqlLibrary.SPARK);
+    f.checkFails("^array_append(null, 2)^", expected, false);
+    f.checkFails("^array_prepend(null, 2)^", expected, false);
+    f.checkFails("^array_remove(null, 2)^", expected, false);
+    f.checkFails("^array_contains(null, 2)^", expected, false);
+    f.checkFails("^array_position(null, 2)^", expected, false);

Review Comment:
   It seems there is a similar issue for `array_min/array_max` should we fix it 
within this issue or create a separate one?



-- 
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]

Reply via email to