Interface Driver<S extends org.apache.flink.api.common.functions.Function,OT>
-
- Type Parameters:
S- The type of stub driven by this driver.OT- The data type of the records produced by this driver.
- All Known Subinterfaces:
ResettableDriver<S,OT>
- All Known Implementing Classes:
AbstractCachedBuildSideJoinDriver,AbstractOuterJoinDriver,AllGroupCombineDriver,AllGroupReduceDriver,AllReduceDriver,BuildFirstCachedJoinDriver,BuildSecondCachedJoinDriver,CoGroupDriver,CoGroupRawDriver,CoGroupWithSolutionSetFirstDriver,CoGroupWithSolutionSetSecondDriver,CrossDriver,FlatMapDriver,FullOuterJoinDriver,GroupReduceCombineDriver,GroupReduceDriver,JoinDriver,JoinWithSolutionSetFirstDriver,JoinWithSolutionSetSecondDriver,LeftOuterJoinDriver,MapDriver,MapPartitionDriver,NoOpDriver,ReduceCombineDriver,ReduceDriver,RightOuterJoinDriver,UnionWithTempOperator
public interface Driver<S extends org.apache.flink.api.common.functions.Function,OT>The interface to be implemented by all drivers that run alone (or as the primary driver) in a task. A driver implements the actual code to perform a batch operation, like map(), reduce(), join(), or coGroup().- See Also:
TaskContext
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcancel()This method is invoked when the driver must aborted in mid processing.voidcleanup()This method is invoked in any case (clean termination and exception) at the end of the tasks operation.intgetNumberOfDriverComparators()Gets the number of comparators required for this driver.intgetNumberOfInputs()Gets the number of inputs that the task has.Class<S>getStubType()Gets the class of the stub type that is run by this task.voidprepare()This method is called before the user code is opened.voidrun()The main operation method of the task.voidsetup(TaskContext<S,OT> context)
-
-
-
Method Detail
-
setup
void setup(TaskContext<S,OT> context)
-
getNumberOfInputs
int getNumberOfInputs()
Gets the number of inputs that the task has.- Returns:
- The number of inputs.
-
getNumberOfDriverComparators
int getNumberOfDriverComparators()
Gets the number of comparators required for this driver.- Returns:
- The number of comparators required for this driver.
-
getStubType
Class<S> getStubType()
Gets the class of the stub type that is run by this task. For example, a MapTask should returnMapFunction.class.- Returns:
- The class of the stub type run by the task.
-
prepare
void prepare() throws ExceptionThis method is called before the user code is opened. An exception thrown by this method signals failure of the task.- Throws:
Exception- Exceptions may be forwarded and signal task failure.
-
run
void run() throws Exception
The main operation method of the task. It should call the user code with the data subsets until the input is depleted.- Throws:
Exception- Any exception thrown by this method signals task failure. Because exceptions in the user code typically signal situations where this instance in unable to proceed, exceptions from the user code should be forwarded.
-
cleanup
void cleanup() throws ExceptionThis method is invoked in any case (clean termination and exception) at the end of the tasks operation.- Throws:
Exception- Exceptions may be forwarded.
-
-