sunjincheng121 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_r244670031
##########
File path: docs/dev/table/tableApi.md
##########
@@ -1682,6 +1682,36 @@ The `OverWindow` defines a range of rows over which
aggregates are computed. `Ov
{% top %}
+### Aggregate
+
+Aggregate performs an aggregate operation with an aggregate function. You have
to close the "aggregate" with a select statement and it does not support
aggregate functions in the select statement The output will be flattened if the
output type is a composite type.
+
+<div class="codetabs" markdown="1">
+<div data-lang="java" markdown="1">
+{% highlight java %}
+AggregateFunction myAggFunc = new MyAggregateFunction();
+
+tableEnv.registerFunction("myAggFunc", myAggFunc);
+Table table = input
+ .groupBy("key")
+ .aggregate("myAggFunc(a, b) as (x, y, z)")
+ .select("key, x, y, z")
+{% endhighlight %}
+</div>
+ <div data-lang="scala" markdown="1">
+{% highlight scala %}
+val myAggFunc: AggregateFunction[_, _] = new MyAggregateFunction
Review comment:
We can not using `AggregateFunction[_, _]`, otherwise we will get the error
message something like `AggregateFunction[_$2,_$3] does not take parameters`.
----------------------------------------------------------------
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