[ https://issues.apache.org/jira/browse/FLINK-21738?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17299988#comment-17299988 ]
Jane Chan commented on FLINK-21738: ----------------------------------- Hi [~zoucao], thanks for bringing out this issue. {quote}the same result will be returned for one module, so maybe a cache should be used here to reduce time waste. {quote} IMO, a map (function definition -> which module it belongs to) in module manager does accelerate the search speed. However, the resolution order makes a difference. If there're two functions with the same name, Flink always resolves the object reference to the one in the 1st loaded module. At the same time, FLINK-21045 supports loading/unloading/changing resolution orders during a running session. So if we decide to support the cache, we may also need to keep the loading order as well. This causes the cache maintenance to become a little bit complicated. What do you think? [~jark] > reduce unnecessary method calls in ModuleManager > ------------------------------------------------- > > Key: FLINK-21738 > URL: https://issues.apache.org/jira/browse/FLINK-21738 > Project: Flink > Issue Type: Improvement > Components: Table SQL / API > Reporter: zoucao > Priority: Major > > In flink sql, if we use many functions(hive func or flink built-in func), > Flink will call method > `getFunctionDefinition` in > [ModuleManager|https://github.com/apache/flink/blob/97bfd049951f8d52a2e0aed14265074c4255ead0/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/module/ModuleManager.java#L44] > many times to load func and each module's method `listFunctions` will be > called at the same time. I think the same result will be returned for one > module, so maybe a cache should be used here to reduce time waste. -- This message was sent by Atlassian Jira (v8.3.4#803005)