gortiz commented on code in PR #12302:
URL: https://github.com/apache/pinot/pull/12302#discussion_r1463164751
##########
pinot-common/src/main/java/org/apache/pinot/common/function/FunctionRegistry.java:
##########
@@ -68,22 +83,67 @@ private FunctionRegistry() {
}
ScalarFunction scalarFunction =
method.getAnnotation(ScalarFunction.class);
if (scalarFunction.enabled()) {
- // Annotated function names
- String[] scalarFunctionNames = scalarFunction.names();
+ // Parse annotated function names and alias
+ Set<String> scalarFunctionNames =
Arrays.stream(scalarFunction.names()).collect(Collectors.toSet());
+ if (scalarFunctionNames.size() == 0) {
+ scalarFunctionNames.add(method.getName());
+ }
+ boolean nullableParameters = scalarFunction.nullableParameters();
+ boolean varArg = scalarFunction.isVarArg();
+ registerFunction(method, scalarFunctionNames, nullableParameters,
varArg);
+ }
+ }
+ Set<Class<?>> classes =
+ PinotReflectionUtils.getClassesThroughReflection(".*\\.function\\..*",
ScalarFunction.class);
Review Comment:
Why do we prefer to use reflection instead of [Service Provider
Interface](https://www.baeldung.com/java-spi) like we did in index-spi?
--
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]