I - type of input objectO - type of output object@PublicEvolving public interface Executor<I,O> extends Serializable
RecipePipeline.| Modifier and Type | Method and Description |
|---|---|
void |
destroy()
This method provides a way for the directive to de-initialize or destroy the
resources that were acquired during the initialization phase.
|
O |
execute(I rows,
ExecutorContext context)
|
void |
initialize(Arguments args)
This method provides a way for the custom directive writer the ability to access
the arguments passed by the users.
|
void initialize(Arguments args) throws DirectiveParseException
This method is invoked only once during the initialization phase of the Executor
object. The arguments are constructed based on the definition as provided by the user in
the method above define.
Following is an example of how initialize could be used to accept the
arguments that are tokenized and parsed by the framework.
public void initialize(Arguments args) throws DirectiveParseException {
ColumnName column = args.value("column");
if (args.contains("number") {
Numeric number = args.value("number");
}
Text text = args.value("text");
Bool bool = args.value("boolean");
Expression expression = args.value("expression");
}
args - Tokenized and parsed arguments.DirectiveParseException - thrown by the user in case of any issues with validation or
ensuring the argument values are as expected.O execute(I rows, ExecutorContext context) throws DirectiveExecutionException, ErrorRowException, ReportErrorAndProceed
rows - List of input Row to be wrangled by this step.context - ExecutorContext passed to each step.Row.DirectiveExecutionExceptionErrorRowExceptionReportErrorAndProceedvoid destroy()
Transform#destroy() when the directive is invoked
within a plugin or when during Service#destroy() when invoked in the
service.
This method is specifically designed not to thrown any exceptions. So, if the
the user code is throws any exception, the system will be unable to react or
correct at this phase of invocation.Copyright © 2022 CDAP Licensed under the Apache License, Version 2.0.