You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by Anil <an...@gmail.com> on 2019/01/11 19:12:04 UTC

Is the eval method invoked in a thread safe manner in Fink UDF

Is the eval method invoked in a thread safe manner in Fink UDF.



--
Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/

Re: Is the eval method invoked in a thread safe manner in Fink UDF

Posted by Anil <an...@gmail.com>.
Thanks Rong!. The UDF makes a http call to another service synchronously. 




--
Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/

Re: Is the eval method invoked in a thread safe manner in Fink UDF

Posted by Rong Rong <wa...@gmail.com>.
According to the codegen result, I think each field is invoked
sequentially.

However, if you maintain internal state within your UDF, it is your
responsibility to maintain the internal state consistency.
Are you invoking external RPC in your "GetName" UDF method and that has to
be async?

--
Rong

On Sat, Jan 12, 2019 at 11:42 PM Anil <an...@gmail.com> wrote:

> Thanks Hequn!. Is it also thread safe when the same UDF is called multiple
> times in the same record.
> Is the UDF called sequentially for each fields a single record,  I have a
> query like  -
>      select GetName(data.id, 'city'), GetName(data.id, 'zone') from ......
>
>
>
>
> --
> Sent from:
> http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/
>

Re: Is the eval method invoked in a thread safe manner in Fink UDF

Posted by Anil <an...@gmail.com>.
Thanks Hequn!. Is it also thread safe when the same UDF is called multiple
times in the same record. 
Is the UDF called sequentially for each fields a single record,  I have a
query like  - 
     select GetName(data.id, 'city'), GetName(data.id, 'zone') from ......




--
Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/

Re: Is the eval method invoked in a thread safe manner in Fink UDF

Posted by Hequn Cheng <ch...@gmail.com>.
Hi Anil,

It is thread-safe.
Each udf instance will only run in one task. And for each udf, it processes
data synchronously, i.e, the next record will not be processed until the
current record is processed.

Best, Hequn

On Sat, Jan 12, 2019 at 3:12 AM Anil <an...@gmail.com> wrote:

> Is the eval method invoked in a thread safe manner in Fink UDF.
>
>
>
> --
> Sent from:
> http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/
>