[GitHub] [flink] Aitozi commented on a diff in pull request #22485: [FLINK-31835][planner] Fix the array type can't be converted from ext…

2023-06-12 Thread via GitHub


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 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 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>")

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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [flink] Aitozi commented on a diff in pull request #22485: [FLINK-31835][planner] Fix the array type can't be converted from ext…

2023-04-25 Thread via GitHub


Aitozi commented on code in PR #22485:
URL: https://github.com/apache/flink/pull/22485#discussion_r1177360955


##
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/stream/table/ValuesITCase.java:
##
@@ -332,7 +332,23 @@ public void testRegisteringValuesWithComplexTypes() {
 mapData.put(1, 1);
 mapData.put(2, 2);
 
-Row row = Row.of(mapData, Row.of(1, 2, 3), new Integer[] {1, 2});
+Row row = Row.of(mapData, Row.of(1, 2, 3), new int[] {1, 2});

Review Comment:
   The type of this is ROW < .., .., ARRAY>. So we have to 
provide `new int[] {1, 2}` to pass the `containsExactly`



-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org