You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/04/13 12:15:54 UTC

[GitHub] [flink] lsyldliu commented on a diff in pull request #19423: [FLINK-27175][hive] Support to call Hive UDAF when the UDAF accepts one parameter with array type

lsyldliu commented on code in PR #19423:
URL: https://github.com/apache/flink/pull/19423#discussion_r849376103


##########
flink-connectors/flink-connector-hive/src/test/java/org/apache/flink/table/functions/hive/HiveGenericUDAFTest.java:
##########
@@ -104,11 +106,29 @@ public void testUDAFCount() throws Exception {
         udf.accumulate(acc, 0.3d);
         udf.accumulate(acc, 5.3d);
 
-        udf.merge(acc, Arrays.asList());
+        udf.merge(acc, Collections.emptyList());
 
         assertEquals(3L, udf.getValue(acc));
     }
 
+    @Test
+    public void testUDAFCollectList() throws Exception {

Review Comment:
   It would be better if add a test about `Collect_Set` function



##########
flink-connectors/flink-connector-hive/src/test/java/org/apache/flink/table/functions/hive/HiveGenericUDAFTest.java:
##########
@@ -104,11 +106,29 @@ public void testUDAFCount() throws Exception {
         udf.accumulate(acc, 0.3d);
         udf.accumulate(acc, 5.3d);
 
-        udf.merge(acc, Arrays.asList());
+        udf.merge(acc, Collections.emptyList());
 
         assertEquals(3L, udf.getValue(acc));
     }
 
+    @Test
+    public void testUDAFCollectList() throws Exception {
+        Object[] constantArgs = new Object[] {null};
+
+        DataType[] argTypes = new DataType[] {DataTypes.ARRAY(DataTypes.INT())};
+
+        HiveGenericUDAF udf = init(GenericUDAFCollectList.class, constantArgs, argTypes);
+        GenericUDAFEvaluator.AggregationBuffer acc = udf.createAccumulator();
+
+        udf.accumulate(acc, (Object[]) new Integer[] {1, 2});

Review Comment:
   Nit: The `(Object[])` is not required.



-- 
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-unsubscribe@flink.apache.org

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