hequn8128 commented on a change in pull request #7235: [FLINK-10976] [table]
Add support for aggregate to table API
URL: https://github.com/apache/flink/pull/7235#discussion_r240877640
##########
File path:
flink-libraries/flink-table/src/test/scala/org/apache/flink/table/api/stream/table/stringexpr/AggregateStringExpressionTest.scala
##########
@@ -128,4 +128,71 @@ class AggregateStringExpressionTest extends TableTestBase
{
verifyTableEquals(resJava, resScala)
}
+
+ @Test
+ def testNonGroupedTableAggregate(): Unit = {
+ val util = streamTestUtil()
+ val t = util.addTable[(Int, Long, String)]('a, 'b, 'c)
+
+ val testAgg = new CountMinMax
+ util.tableEnv.registerFunction("testAgg", testAgg)
+
+ // Expression / Scala API
+ val resScala = t
+ .aggregate(testAgg('a))
+ .select('f0, 'f1)
+
+ // String / Java API
+ val resJava = t
+ .aggregate("testAgg(a)")
+ .select("f0, f1")
+
+ verifyTableEquals(resScala, resJava)
+ }
+
+ @Test
+ def testTableAggregate(): Unit = {
Review comment:
How about renaming it to `testAggregate`. To distinguish from the todo
`flatAggregate`, `TableAggregateFunction`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services