MasseGuillaume commented on code in PR #3161:
URL: https://github.com/apache/calcite/pull/3161#discussion_r1171711696


##########
testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java:
##########
@@ -5167,6 +5167,18 @@ private static void checkIf(SqlOperatorFixture f) {
     f.checkNull("array_concat(cast(null as integer array), array[1])");
   }
 
+  /** Tests {@code ARRAY_DISTINCT} function from Spark. */
+  @Test void testArrayDistinctFunc() {
+    SqlOperatorFixture f = fixture()
+        .setFor(SqlLibraryOperators.ARRAY_DISTINCT)
+        .withLibrary(SqlLibrary.SPARK);
+    f.checkScalar("array_distinct(array[1, 2, 2, 1])", "[1, 2]",
+        "INTEGER NOT NULL ARRAY NOT NULL");
+    f.checkScalar("array_distinct(array[null, 1, null])", "[null, 1]",
+        "INTEGER ARRAY NOT NULL");
+    f.checkNull("array_distinct(null)");
+  }

Review Comment:
   `array[1, 2]`: is a simpler form, if somethings is wrong with more complex 
forms (eg `array[1, 2, null]`) it's helpful to debug.
   `array[1]`: it's helpful to check for 1 off errors in the return type 
inference



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