flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Darshan Singh <darshan.m...@gmail.com>
Subject how to query the output of the scalar table function
Date Fri, 30 Mar 2018 20:07:56 GMT
Hi,

I am not able to find what is best way to query the output of a scalar
table function.

Suppose I have table which has column col1 which is string.

I have a scalar function and returns a POJO
{col1V1 String, col1V2 String , col1V3 String}.


I am using following.

so table.select("sf(col1) as sfc")
.select("sfc.get('col1V1') as v1, sfc.get('col1V2') as v2 ,
sfc.get('col1V13') as v3 ")

It is working fine but strangely enough it calls the sf 3 times(each per
get) for same row. However, If I use table function it calls just once.

So to me it seems that scalar function is very expensive so if I have 10
columns and the computation is expensive it will do 10 times. Thats why I
thought maybe there is a better way to return pojo from scalar function
rather than what I have been using.

If this is the best way then I wonder if scalar functions should be used to
return single value only.

Thanks

Mime
View raw message