liuyongvs commented on code in PR #3161:
URL: https://github.com/apache/calcite/pull/3161#discussion_r1175122427
##########
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:
don't need. array should be element with same type, and it doesn't support
implicit cast. so i guess it will throw exception. @JiajunBernoulli
--
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]