NobiGo commented on code in PR #3263:
URL: https://github.com/apache/calcite/pull/3263#discussion_r1241065965
##########
testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java:
##########
@@ -5415,6 +5415,31 @@ private static void checkIf(SqlOperatorFixture f) {
f.checkNull("array_distinct(null)");
}
+ @Test void testArrayJoinFunc() {
+ final SqlOperatorFixture f0 = fixture();
+ f0.setFor(SqlLibraryOperators.ARRAY_JOIN);
+ f0.checkFails("^array_join(array['aa', 'b', 'c'], '-')^", "No match found
for function"
+ + " signature ARRAY_JOIN\\(<CHAR\\(2\\) ARRAY>, <CHARACTER>\\)",
false);
+
+ final SqlOperatorFixture f = f0.withLibrary(SqlLibrary.SPARK);
+ f.checkScalar("array_join(array['aa', 'b', 'c'], '-')", "aa-b-c",
+ "VARCHAR NOT NULL");
+ f.checkScalar("array_join(array[null, 'aa', null, 'b', null], '-',
'empty')",
+ "empty-aa-empty-b-empty", "VARCHAR NOT NULL");
+ f.checkScalar("array_join(array[null, 'aa', null, 'b', null], '-')",
"aa-b",
+ "VARCHAR NOT NULL");
+ f.checkScalar("array_join(array[null, x'aa', null, x'bb', null], '-')",
"aa-bb",
Review Comment:
What do you mean x'aa' ? Looks like some skill I don't know.
##########
testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java:
##########
@@ -5594,6 +5619,90 @@ private static void checkIf(SqlOperatorFixture f) {
f.checkNull("array_union(cast(null as integer array), cast(null as integer
array))");
}
+ /** Tests {@code ARRAYS_OVERLAP} function from Spark. */
+ @Test void testArraysOverlapFunc() {
+ final SqlOperatorFixture f0 = fixture();
+ f0.setFor(SqlLibraryOperators.ARRAYS_OVERLAP);
+ f0.checkFails("^arrays_overlap(array[1, 2], array[2])^",
+ "No match found for function signature ARRAYS_OVERLAP\\("
+ + "<INTEGER ARRAY>, <INTEGER ARRAY>\\)", false);
+
+ final SqlOperatorFixture f = f0.withLibrary(SqlLibrary.SPARK);
+ f.checkScalar("arrays_overlap(array[1, 2], array[2])", true,
+ "BOOLEAN NOT NULL");
+ f.checkScalar("arrays_overlap(array[1, 2], array[3])", false,
+ "BOOLEAN NOT NULL");
+ f.checkScalar("arrays_overlap(array[1, null], array[1])", true,
Review Comment:
I want to confirm this `arrays_overlap(array[1, null], array[1])` the
datatype is Boolean not BOOLEAN NOT NULL?
--
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]