richardstartin commented on a change in pull request #8382:
URL: https://github.com/apache/pinot/pull/8382#discussion_r832652223



##########
File path: 
pinot-common/src/main/java/org/apache/pinot/common/function/FunctionInvoker.java
##########
@@ -131,4 +133,19 @@ public Object invoke(Object[] arguments) {
           "Caught exception while invoking method: " + _method + " with 
arguments: " + Arrays.toString(arguments), e);
     }
   }
+
+  /**
+   * Whether method is a scalar function with nullableParameters property set 
to true.
+   */
+  public boolean hasNullableParameters() {
+    for (final Annotation annotation : _method.getAnnotations()) {
+      if (annotation.annotationType().equals(ScalarFunction.class)) {
+        final ScalarFunction scalarFunctionAnnotation = (ScalarFunction) 
annotation;
+        if (scalarFunctionAnnotation.nullableParameters()) {
+          return true;
+        }
+      }
+    }
+    return false;

Review comment:
       I think the following would be cleaner (and probably more efficient)
   ```java
   return _method.isAnnotationPresent(ScalarFunction.class) && 
_method.getAnnotation(ScalarFunction.class).nullableParameters();
   ```




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