Source:
public static TransformFunction get(TransformExpressionTree expression, Map<String, DataSource> dataSourceMap) { TransformFunction transformFunction; switch (expression.getExpressionType()) { case FUNCTION: String functionName = expression.getValue(); Class<? extends TransformFunction> transformFunctionClass; FunctionInfo functionInfo = null; if (FunctionRegistry.containsFunctionByName(functionName)) { transformFunctionClass = GenericTransformFunction.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(); if (functionInfo != null) { ((GenericTransformFunction) transformFunction).setFunction(functionName, functionInfo); } } catch (Exception e) { throw new RuntimeException("Caught exception while instantiating transform function: " + functionName, e); } List<TransformExpressionTree> children = expression.getChildren(); List<TransformFunction> arguments = new ArrayList<>(children.size()); for (TransformExpressionTree child : children) { arguments.add(TransformFunctionFactory.get(child, dataSourceMap)); } try { transformFunction.init(arguments, dataSourceMap); } catch (Exception e) { throw new BadQueryRequestException( "Caught exception while initializing transform function: " + transformFunction.getName(), e); } return transformFunction; case IDENTIFIER: String columnName = expression.getValue(); return new IdentifierTransformFunction(columnName, dataSourceMap.get(columnName)); case LITERAL: return new LiteralTransformFunction(expression.getValue()); default: throw new IllegalStateException(); } }

Target:
public static TransformFunction get(TransformExpressionTree expression, Map<String, DataSource> dataSourceMap) { TransformFunction transformFunction; switch (expression.getExpressionType()) { case FUNCTION: String functionName = expression.getValue(); 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 { if (functionInfo != null) { transformFunction = new ScalarTransformFunctionWrapper(functionName, functionInfo); } else { transformFunction = transformFunctionClass.newInstance(); } } catch (Exception e) { throw new RuntimeException("Caught exception while instantiating transform function: " + functionName, e); } List<TransformExpressionTree> children = expression.getChildren(); List<TransformFunction> arguments = new ArrayList<>(children.size()); for (TransformExpressionTree child : children) { arguments.add(TransformFunctionFactory.get(child, dataSourceMap)); } try { transformFunction.init(arguments, dataSourceMap); } catch (Exception e) { throw new BadQueryRequestException( "Caught exception while initializing transform function: " + transformFunction.getName(), e); } return transformFunction; case IDENTIFIER: String columnName = expression.getValue(); return new IdentifierTransformFunction(columnName, dataSourceMap.get(columnName)); case LITERAL: return new LiteralTransformFunction(expression.getValue()); default: throw new IllegalStateException(); } }