Github user sunjincheng121 commented on a diff in the pull request:
https://github.com/apache/flink/pull/4105#discussion_r121325300
--- Diff:
flink-libraries/flink-table/src/test/scala/org/apache/flink/table/api/scala/stream/sql/AggregationsTest.scala
---
@@ -39,4 +44,34 @@ class AggregationsTest extends TableTestBase {
streamUtil.tEnv.sql(sqlQuery)
}
+
+ @Test
+ def testUserDefinedAggregateFunctionWithScalaAccumulator(): Unit = {
+ streamUtil.addFunction("udag", new MyAgg)
+ val call = streamUtil
+ .tEnv
+ .functionCatalog
+ .lookupFunction("udag", Seq())
+ .asInstanceOf[AggFunctionCall]
+
+ val typeInfo = call.accTypeInfo
+ assertTrue(typeInfo.isInstanceOf[CaseClassTypeInfo[_]])
+ assertEquals(2, typeInfo.getTotalFields)
+ val caseTypeInfo = typeInfo.asInstanceOf[CaseClassTypeInfo[_]]
+ assertEquals(Types.LONG, caseTypeInfo.getTypeAt(0))
+ assertEquals(Types.LONG, caseTypeInfo.getTypeAt(1))
+ }
+}
+
+case class Accumulator(sum: Long, count: Long)
--- End diff --
The members of `Accumulator` must be modified.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---