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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]