liuyongvs commented on code in PR #3233:
URL: https://github.com/apache/calcite/pull/3233#discussion_r1210185791
##########
testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java:
##########
@@ -5328,6 +5328,25 @@ private static void checkIf(SqlOperatorFixture f) {
f.checkScalar("rand_integer(2, 11)", 1, "INTEGER NOT NULL");
}
+ /** Tests {@code ARRAY_COMPACT} function from Spark. */
+ @Test void testArrayCompactFunc() {
+ final SqlOperatorFixture f0 = Fixtures.forOperators(true);
+ f0.setFor(SqlLibraryOperators.ARRAY_COMPACT);
+ f0.checkFails("^array_compact(array[null, 1, null, 2])^",
+ "No match found for function signature ARRAY_COMPACT\\(<INTEGER
ARRAY>\\)", false);
+
+ final SqlOperatorFixture f = f0.withLibrary(SqlLibrary.SPARK);
+ f.checkScalar("array_compact(array[null, 1, null, 2])", "[1, 2]",
+ "INTEGER ARRAY NOT NULL");
+ f.checkScalar("array_compact(array[null])", "[]",
+ "NULL ARRAY NOT NULL");
+ f.checkScalar("array_compact(array(null))", "[]",
+ "NULL ARRAY NOT NULL");
+ f.checkScalar("array_compact(array())", "[]",
+ "UNKNOWN NOT NULL ARRAY NOT NULL");
+ f.checkNull("array_compact(null)");
+ }
Review Comment:
array() which only supports spark array constructor, while standard not.
--
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]