[
https://issues.apache.org/jira/browse/FLINK-14275?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16950055#comment-16950055
]
hailong wang commented on FLINK-14275:
--------------------------------------
Hi, [~jark], thanks for you tip. In my side, we just need to say whether
aggregate function(reduce function, fold function) is RichFunction in
WindowOperator.open():
{code:java}
if (windowStateDescriptor instanceof AggregatingStateDescriptor) {
AggregateFunction aggregateFunction = ((AggregatingStateDescriptor)
windowStateDescriptor).getAggregateFunction();
if
(RichAggregateFunction.class.isAssignableFrom(aggregateFunction.getClass())) {
((RichAggregateFunction)aggregateFunction).setRuntimeContext(getRuntimeContext());
((RichAggregateFunction)aggregateFunction).open(new Configuration());
}
}
{code}
If there is something I haven't considered?
By doing this, we can change AggregateAggFunction to extend
RichAggregateFunction.
So that, UDAF can be initialized in GroupWindowAggregate
> Window Aggregate function support a RichFunction
> ------------------------------------------------
>
> Key: FLINK-14275
> URL: https://issues.apache.org/jira/browse/FLINK-14275
> Project: Flink
> Issue Type: Improvement
> Components: API / DataStream
> Affects Versions: 1.9.0
> Reporter: hailong wang
> Priority: Major
>
> Now, window aggregate function cannot be a RichFunction. In other words, open
> function can not be invoked and runtimeContext cannot be fetched in
> RichAggregateFunction.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)