KKcorps commented on a change in pull request #5440: URL: https://github.com/apache/incubator-pinot/pull/5440#discussion_r433466964
########## File path: pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/TransformFunctionFactory.java ########## @@ -112,13 +115,24 @@ public static TransformFunction get(TransformExpressionTree expression, Map<Stri switch (expression.getExpressionType()) { case FUNCTION: String functionName = expression.getValue(); - Class<? extends TransformFunction> transformFunctionClass = TRANSFORM_FUNCTION_MAP.get(functionName); + Class<? extends TransformFunction> transformFunctionClass; + FunctionInfo functionInfo = null; + if (FunctionRegistry.containsFunctionByName(functionName)) { + transformFunctionClass = ScalarTransformFunctionWrapper.class; + functionInfo = FunctionRegistry.getFunctionByName(functionName); + } else { + transformFunctionClass = TRANSFORM_FUNCTION_MAP.get(functionName); + } + if (transformFunctionClass == null) { throw new BadQueryRequestException("Unsupported transform function: " + functionName); } try { transformFunction = transformFunctionClass.newInstance(); - } catch (InstantiationException | IllegalAccessException e) { + if (functionInfo != null) { + ((ScalarTransformFunctionWrapper) transformFunction).setFunction(functionName, functionInfo); + } + } catch (Exception e) { Review comment: Why will a constructor throw BadQueryRequestException since this catch block is meant for only the constructor? ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org