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:
-
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()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.intGets the number of comparators required for this driver.intGets the number of inputs that the task has.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 Details
-
setup
-
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
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
This 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
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
This method is invoked in any case (clean termination and exception) at the end of the tasks operation.- Throws:
Exception- Exceptions may be forwarded.
-
cancel
This method is invoked when the driver must aborted in mid processing. It is invoked asynchronously by a different thread.- Throws:
Exception- Exceptions may be forwarded.
-