:question: I was wondering how Flink handles calls...
# troubleshooting
h
❓ I was wondering how Flink handles calls to one and the same UDF that's applied multiple times in a single Flink SQL / Table API query running on a task manager... e.g. if I do `SELECT MY_UDF(col1), MY_UDF(col2) FROM some_table`: • will Flink create two instances of MY_UDF, one for each usage? • will Flink create only a single MY_UDF instance and reuse this across the two usages? • is any of the above guaranteed to be consistently applied on the same / across different Flink version? • can any such behavior be configured / forced to some degree? THX for any in-depth insights on this. 🙏 Addendum: Let's assume a single TM with parallelism=1 and deterministic scalar function.
I promise this is not an exam question 😅.
😄 1
g
What does the explain command say? 😄 If I'm not mistaken two instances will be created, because these will end up being expression nodes and code generation will be used to each from two nodes.. you ask the tough questions though and only code can tell the truth here 🥲
h
Yeah that's the thing. I'm not sure hence the question. I hoped to get a definitive answer, but I'm afraid - as you suggest - I'll have to dig into the code deeper and also verify the behaviour.