Aitozi commented on code in PR #22485:
URL: https://github.com/apache/flink/pull/22485#discussion_r1226152539
##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/stream/sql/FunctionITCase.java:
##########
@@ -1329,6 +1329,28 @@ public void testUsingAddJar() throws Exception {
"drop function lowerUdf");
}
+ @Test
+ public void testArrayWithPrimitiveType() {
+ List<Row> sourceData = Arrays.asList(Row.of(1, 2), Row.of(3, 4));
+ TestCollectionTableFactory.reset();
+ TestCollectionTableFactory.initData(sourceData);
+
+ tEnv().executeSql(
+ "CREATE TABLE SourceTable(i INT NOT NULL, j INT NOT
NULL) WITH ('connector' = 'COLLECTION')");
+ tEnv().executeSql(
+ "CREATE FUNCTION row_of_array AS '"
+ + RowOfArrayFunction.class.getName()
+ + "'");
+ List<Row> rows =
+ CollectionUtil.iteratorToList(
+ tEnv().executeSql("SELECT row_of_array(i, j) FROM
SourceTable").collect());
+ assertThat(rows)
+ .isEqualTo(
+ Arrays.asList(
+ Row.of(Row.of(new int[] {1, 2})),
+ Row.of(Row.of(new int[] {3, 4}))));
Review Comment:
updated
##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/stream/sql/FunctionITCase.java:
##########
@@ -1756,6 +1778,14 @@ public Boolean eval(@DataTypeHint("BOOLEAN NOT NULL")
Boolean b) {
}
}
+ /** A function with Row of array with primitive type as return type for
test FLINK-31835. */
+ public static class RowOfArrayFunction extends ScalarFunction {
+ @DataTypeHint("Row<t ARRAY<INT NOT NULL>>")
Review Comment:
updated
--
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]