[ 
https://issues.apache.org/jira/browse/FLINK-9565?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16524641#comment-16524641
 ] 

yinhua.dai commented on FLINK-9565:
-----------------------------------

[~fhueske] [~twalthr]

So there are two options:

#1. using annotation like @Expensive

 
{code:java}
@Expensive
public class MyScalarFunc extends ScalarFunction {
    public Double eval(Double d) {
        // expensive logic
    }
}{code}
#2. using additional method such as evalParallel, then sample code would be
{code:java}
public class MyScalarFunc extends ScalarFunction {
    public Double evalParallel(Double d) {
        // expensive logic
    }
}
{code}
I personally prefer to option #1, I feel like it makes the code generation 
easier so we always call "eval" method, and we simply check if the scalar 
function is wrapped with @Expensive annotation, in which case we wrapped the 
generated code within a future.

> Evaluating scalar UDFs in parallel
> ----------------------------------
>
>                 Key: FLINK-9565
>                 URL: https://issues.apache.org/jira/browse/FLINK-9565
>             Project: Flink
>          Issue Type: New Feature
>          Components: Table API & SQL
>    Affects Versions: 1.4.2
>            Reporter: yinhua.dai
>            Priority: Major
>
> As per 
> [https://stackoverflow.com/questions/50790023/does-flink-sql-support-to-run-projections-in-parallel,]
>  scalar UDF in the same SQL is always evaluated sequentially even when those 
> UDF are irrelevant, it may increase latency when the UDF is time consuming 
> function.
> It would be great if Flink SQL can support to run those UDF in parallel to 
> reduce calculation latency.
>  
> cc [~fhueske]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to