hanyuzheng7 commented on code in PR #23173:
URL: https://github.com/apache/flink/pull/23173#discussion_r1491937994


##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/CollectionFunctionsITCase.java:
##########
@@ -1370,4 +1371,145 @@ private Stream<TestSetSpec> arraySliceTestCases() {
                                         + "ARRAY_SLICE(<ARRAY>, <INTEGER>)")
                         .testSqlValidationError("ARRAY_SLICE(null)", "Illegal 
use of 'NULL'"));
     }
+
+    private Stream<TestSetSpec> arrayExceptTestCases() {
+        return Stream.of(
+                
TestSetSpec.forFunction(BuiltInFunctionDefinitions.ARRAY_EXCEPT)
+                        .onFieldsWithData(
+                                new Integer[] {1, 2, 2},
+                                null,
+                                new Row[] {
+                                    Row.of(true, LocalDate.of(2022, 4, 20)),
+                                    Row.of(true, LocalDate.of(1990, 10, 14)),
+                                    null
+                                },
+                                new Integer[] {null, null, 1},
+                                new Integer[][] {
+                                    new Integer[] {1, null, 3}, new Integer[] 
{0}, new Integer[] {1}
+                                },
+                                new Map[] {
+                                    CollectionUtil.map(entry(1, "a"), entry(2, 
"b")),
+                                    CollectionUtil.map(entry(3, "c"), entry(4, 
"d")),
+                                    null
+                                })
+                        .andDataTypes(
+                                DataTypes.ARRAY(DataTypes.INT()),
+                                DataTypes.ARRAY(DataTypes.INT()),
+                                DataTypes.ARRAY(
+                                        DataTypes.ROW(DataTypes.BOOLEAN(), 
DataTypes.DATE())),
+                                DataTypes.ARRAY(DataTypes.INT()),
+                                
DataTypes.ARRAY(DataTypes.ARRAY(DataTypes.INT())),
+                                DataTypes.ARRAY(DataTypes.MAP(DataTypes.INT(), 
DataTypes.STRING())))
+                        // ARRAY<INT>
+                        .testResult(
+                                $("f0").arrayExcept(new Integer[] {1, null, 
4}),
+                                "ARRAY_EXCEPT(f0, ARRAY[1, NULL, 4])",
+                                new Integer[] {2},
+                                DataTypes.ARRAY(DataTypes.INT()).nullable())
+                        .testResult(
+                                $("f0").arrayExcept(new Integer[] {1}),
+                                "ARRAY_EXCEPT(f0, ARRAY[1])",
+                                new Integer[] {2},
+                                DataTypes.ARRAY(DataTypes.INT()).nullable())
+                        .testResult(
+                                $("f0").arrayExcept(new Integer[] {42}),
+                                "ARRAY_EXCEPT(f0, ARRAY[42])",
+                                new Integer[] {1, 2},
+                                DataTypes.ARRAY(DataTypes.INT()).nullable())
+                        // arrayTwo is NULL
+                        .testResult(
+                                $("f0").arrayExcept(
+                                                lit(null, 
DataTypes.ARRAY(DataTypes.INT()))
+                                                        
.cast(DataTypes.ARRAY(DataTypes.INT()))),
+                                "ARRAY_EXCEPT(f0, CAST(NULL AS ARRAY<INT>))",
+                                new Integer[] {1, 2},
+                                DataTypes.ARRAY(DataTypes.INT()).nullable())

Review Comment:
   the second array is 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]

Reply via email to