Hi Guobao,

I just re-checked the data stream API. There is an interesting restriction
of `AggregateFunction`. It could not be a rich function. And there are
already several relevant issues [1][2][3].
I guess your scenario might be relevant to this restriction (I assume you
are using table/SQL API).

The bad news is none of these issues are implemented. I didn't find a
workaround way to access metric group in data stream API. I'm not sure it
could be done in table/SQL or not.

[1] https://issues.apache.org/jira/browse/FLINK-14275
[2] https://issues.apache.org/jira/browse/FLINK-5094
[3] https://issues.apache.org/jira/browse/FLINK-11198

Thanks,
Biao /'bɪ.aʊ/



On Wed, 4 Dec 2019 at 11:23, Jingsong Li <jingsongl...@gmail.com> wrote:

> Hi Guobao,
>
> Looks like this is from table/SQL API.
> You can override public void open(FunctionContext context)
> It should work, can you provide more information? Like:
> - version
> - which planner
> - what problem, open method never being invoked?
>
> Best,
> Jingsong Lee
>
> On Wed, Dec 4, 2019 at 11:09 AM Biao Liu <mmyy1...@gmail.com> wrote:
>
>> Hi Guobao,
>>
>> Are you using table API? I'm not familiar with table API, but for data
>> stream API, generally speaking user could do some initialization through
>> "open" method of "Rich" function, like "RichAggregateFunction".
>>
>> Thanks,
>> Biao /'bɪ.aʊ/
>>
>>
>>
>> On Tue, 3 Dec 2019 at 22:44, Guobao Li <gu...@criteo.com> wrote:
>>
>>> Hi community,
>>>
>>>
>>>
>>> I am trying to register a metric in an aggregate UDF by overriding the
>>> *open* function. According to the documentation, the *open* function
>>> can be override in order to retrieve the metric group to do the metric
>>> registration. But it works only on ScalarFunction not on AggregateFunction.
>>> Since the *open* function is not invoked by AggregateFunction. Could
>>> anyone help me out of it?
>>>
>>>
>>>
>>> Thanks,
>>>
>>> Guobao
>>>
>>>
>>>
>>
>
> --
> Best, Jingsong Lee
>

Reply via email to