You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2022/10/15 00:40:23 UTC

[GitHub] [pinot] walterddr commented on a diff in pull request #9602: consolidate FunctionRegistry for v1/v2 engines

walterddr commented on code in PR #9602:
URL: https://github.com/apache/pinot/pull/9602#discussion_r996227764


##########
pinot-common/src/main/java/org/apache/pinot/common/function/FunctionRegistry.java:
##########
@@ -140,8 +133,30 @@ public static boolean containsFunction(String functionName) {
    */
   @Nullable
   public static FunctionInfo getFunctionInfo(String functionName, int numParameters) {
-    Map<Integer, FunctionInfo> functionInfoMap = FUNCTION_INFO_MAP.get(canonicalize(functionName));
-    return functionInfoMap != null ? functionInfoMap.get(numParameters) : null;
+    Collection<Map.Entry<String, Function>> allFunctions = FUNCTION_MAP.range(canonicalize(functionName), true);
+    if (allFunctions.isEmpty()) {
+      return null;
+    }
+
+    List<Function> matchingFunctions = allFunctions
+        .stream()
+        .map(Map.Entry::getValue)
+        .filter(fun -> fun.getParameters().size() == numParameters)
+        .collect(Collectors.toList());

Review Comment:
   if we can we should avoid doing stream compute on every get function info. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org