Class GroovyFunctionEvaluator
- java.lang.Object
-
- org.apache.pinot.segment.local.function.GroovyFunctionEvaluator
-
- All Implemented Interfaces:
FunctionEvaluator
public class GroovyFunctionEvaluator extends Object implements FunctionEvaluator
AnFunctionEvaluatorfor evaluating transform function expressions of a Schema field spec written in Groovy. GroovyShell is used to execute expressions. The transform expression must follow the convention Groovy({expression}, arguments1, argument2...) For example: "dimensionFieldSpecs": [ { "name": "fullName", "dataType": "STRING", "transformFunction": "Groovy({firstName+' '+lastName}, firstName, lastName)" } ]
-
-
Constructor Summary
Constructors Constructor Description GroovyFunctionEvaluator(String closure)
-
Method Summary
Modifier and Type Method Description Objectevaluate(Object[] values)Evaluates the function on the given values (same order as the arguments) and returns the result.Objectevaluate(GenericRow genericRow)Evaluate the function on the generic row and return the resultList<String>getArguments()Get the arguments of the functionstatic StringgetGroovyExpressionPrefix()
-
-
-
Constructor Detail
-
GroovyFunctionEvaluator
public GroovyFunctionEvaluator(String closure)
-
-
Method Detail
-
getGroovyExpressionPrefix
public static String getGroovyExpressionPrefix()
-
getArguments
public List<String> getArguments()
Description copied from interface:FunctionEvaluatorGet the arguments of the function- Specified by:
getArgumentsin interfaceFunctionEvaluator
-
evaluate
public Object evaluate(GenericRow genericRow)
Description copied from interface:FunctionEvaluatorEvaluate the function on the generic row and return the result- Specified by:
evaluatein interfaceFunctionEvaluator
-
evaluate
public Object evaluate(Object[] values)
Description copied from interface:FunctionEvaluatorEvaluates the function on the given values (same order as the arguments) and returns the result.- Specified by:
evaluatein interfaceFunctionEvaluator
-
-