richardstartin commented on code in PR #8563:
URL: https://github.com/apache/pinot/pull/8563#discussion_r854908612


##########
pinot-common/src/main/java/org/apache/pinot/common/function/FunctionInvoker.java:
##########
@@ -124,7 +140,16 @@ public Class<?> getResultClass() {
    */
   public Object invoke(Object[] arguments) {
     try {
-      return _method.invoke(_instance, arguments);
+      if (_method.isVarArgs()) {
+        Class<?> parameterBaseClass = _parameterClasses[0].getComponentType();
+        // Convert arguments to base class
+        Class<?> klass = 
Arrays.stream(_method.getParameterTypes()).findFirst().get().getComponentType();

Review Comment:
   Support for varargs will already impose overheads, but streaming the 
parameter types will be unacceptably slow. This operation should be performed 
once and cached in the `FunctionInvoker`. It's probably better to store a 
prototype array in a field too, which you can just clone at invocation time.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to