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/16 22:47:12 UTC

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

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


##########
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:
   getting function info happens once (per function) per query, right? not on every invocation of it? I'll remove it just in case, but I'd be shocked if things that happen once per query were a bottleneck



-- 
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