Class DeltaIteration<ST,WT>
- java.lang.Object
-
- org.apache.flink.api.java.operators.DeltaIteration<ST,WT>
-
- Type Parameters:
ST- The data type of the solution set.WT- The data type of the workset (the feedback data set).
@Deprecated @Public public class DeltaIteration<ST,WT> extends Object
Deprecated.All Flink DataSet APIs are deprecated since Flink 1.18 and will be removed in a future Flink major version. You can still build your application in DataSet, but you should move to either the DataStream and/or Table API.The DeltaIteration represents the start of a delta iteration. It is created from the DataSet that represents the initial solution set via theDataSet.iterateDelta(DataSet, int, int...)method.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDeltaIteration.SolutionSetPlaceHolder<ST>Deprecated.ADataSetthat acts as a placeholder for the solution set during the iteration.static classDeltaIteration.WorksetPlaceHolder<WT>Deprecated.ADataSetthat acts as a placeholder for the workset during the iteration.
-
Constructor Summary
Constructors Constructor Description DeltaIteration(ExecutionEnvironment context, org.apache.flink.api.common.typeinfo.TypeInformation<ST> type, DataSet<ST> solutionSet, DataSet<WT> workset, org.apache.flink.api.common.operators.Keys<ST> keys, int maxIterations)Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description DataSet<ST>closeWith(DataSet<ST> solutionSetDelta, DataSet<WT> newWorkset)Deprecated.Closes the delta iteration.org.apache.flink.api.common.aggregators.AggregatorRegistrygetAggregators()Deprecated.Gets the registry for aggregators for the iteration.DataSet<ST>getInitialSolutionSet()Deprecated.Gets the initial solution set.DataSet<WT>getInitialWorkset()Deprecated.Gets the initial workset.org.apache.flink.api.common.operators.ResourceSpecgetMinResources()Deprecated.Gets the minimum resources from this iteration.StringgetName()Deprecated.Gets the name from this iteration.intgetParallelism()Deprecated.Gets the iteration's parallelism.org.apache.flink.api.common.operators.ResourceSpecgetPreferredResources()Deprecated.Gets the preferred resources from this iteration.DeltaIteration.SolutionSetPlaceHolder<ST>getSolutionSet()Deprecated.Gets the solution set of the delta iteration.DeltaIteration.WorksetPlaceHolder<WT>getWorkset()Deprecated.Gets the working set of the delta iteration.booleanisSolutionSetUnManaged()Deprecated.gets whether the solution set is in managed or unmanaged memory.DeltaIteration<ST,WT>name(String name)Deprecated.Sets the name for the iteration.DeltaIteration<ST,WT>parallelism(int parallelism)Deprecated.Sets the parallelism for the iteration.<X extends org.apache.flink.types.Value>
DeltaIteration<ST,WT>registerAggregationConvergenceCriterion(String name, org.apache.flink.api.common.aggregators.Aggregator<X> aggregator, org.apache.flink.api.common.aggregators.ConvergenceCriterion<X> convergenceCheck)Deprecated.Registers anAggregatorfor the iteration together with aConvergenceCriterion.DeltaIteration<ST,WT>registerAggregator(String name, org.apache.flink.api.common.aggregators.Aggregator<?> aggregator)Deprecated.Registers anAggregatorfor the iteration.voidsetSolutionSetUnManaged(boolean solutionSetUnManaged)Deprecated.Sets whether to keep the solution set in managed memory (safe against heap exhaustion) or unmanaged memory (objects on heap).
-
-
-
Method Detail
-
closeWith
public DataSet<ST> closeWith(DataSet<ST> solutionSetDelta, DataSet<WT> newWorkset)
Deprecated.Closes the delta iteration. This method defines the end of the delta iteration's function.- Parameters:
solutionSetDelta- The delta for the solution set. The delta will be merged into the solution set at the end of each iteration.newWorkset- The new workset (feedback data set) that will be fed back to the next iteration.- Returns:
- The DataSet that represents the result of the iteration, after the computation has terminated.
- See Also:
DataSet.iterateDelta(DataSet, int, int...)
-
getInitialSolutionSet
public DataSet<ST> getInitialSolutionSet()
Deprecated.Gets the initial solution set. This is the data set on which the delta iteration was started.Consider the following example:
DataSet<MyType> solutionSetData = ...; DataSet<AnotherType> worksetData = ...; DeltaIteration<MyType, AnotherType> iteration = solutionSetData.iteratorDelta(worksetData, 10, ...);The solutionSetData would be the data set returned by
iteration.getInitialSolutionSet();.- Returns:
- The data set that forms the initial solution set.
-
getInitialWorkset
public DataSet<WT> getInitialWorkset()
Deprecated.Gets the initial workset. This is the data set passed to the method that starts the delta iteration.Consider the following example:
DataSet<MyType> solutionSetData = ...; DataSet<AnotherType> worksetData = ...; DeltaIteration<MyType, AnotherType> iteration = solutionSetData.iteratorDelta(worksetData, 10, ...);The worksetData would be the data set returned by
iteration.getInitialWorkset();.- Returns:
- The data set that forms the initial workset.
-
getSolutionSet
public DeltaIteration.SolutionSetPlaceHolder<ST> getSolutionSet()
Deprecated.Gets the solution set of the delta iteration. The solution set represents the state that is kept across iterations.- Returns:
- The solution set of the delta iteration.
-
getWorkset
public DeltaIteration.WorksetPlaceHolder<WT> getWorkset()
Deprecated.Gets the working set of the delta iteration. The working set is constructed by the previous iteration.- Returns:
- The working set of the delta iteration.
-
name
public DeltaIteration<ST,WT> name(String name)
Deprecated.Sets the name for the iteration. The name is displayed in logs and messages.- Parameters:
name- The name for the iteration.- Returns:
- The iteration object, for function call chaining.
-
getName
public String getName()
Deprecated.Gets the name from this iteration.- Returns:
- The name of the iteration.
-
parallelism
public DeltaIteration<ST,WT> parallelism(int parallelism)
Deprecated.Sets the parallelism for the iteration.- Parameters:
parallelism- The parallelism.- Returns:
- The iteration object, for function call chaining.
-
getParallelism
public int getParallelism()
Deprecated.Gets the iteration's parallelism.- Returns:
- The iteration's parallelism, or
ExecutionConfig.PARALLELISM_DEFAULTif not set.
-
getMinResources
@PublicEvolving public org.apache.flink.api.common.operators.ResourceSpec getMinResources()
Deprecated.Gets the minimum resources from this iteration. If no minimum resources have been set, it returns the default empty resource.- Returns:
- The minimum resources of the iteration.
-
getPreferredResources
@PublicEvolving public org.apache.flink.api.common.operators.ResourceSpec getPreferredResources()
Deprecated.Gets the preferred resources from this iteration. If no preferred resources have been set, it returns the default empty resource.- Returns:
- The preferred resources of the iteration.
-
registerAggregator
@PublicEvolving public DeltaIteration<ST,WT> registerAggregator(String name, org.apache.flink.api.common.aggregators.Aggregator<?> aggregator)
Deprecated.Registers anAggregatorfor the iteration. Aggregators can be used to maintain simple statistics during the iteration, such as number of elements processed. The aggregators compute global aggregates: After each iteration step, the values are globally aggregated to produce one aggregate that represents statistics across all parallel instances. The value of an aggregator can be accessed in the next iteration.Aggregators can be accessed inside a function via the
AbstractRichFunction.getIterationRuntimeContext()method.- Parameters:
name- The name under which the aggregator is registered.aggregator- The aggregator class.- Returns:
- The DeltaIteration itself, to allow chaining function calls.
-
registerAggregationConvergenceCriterion
@PublicEvolving public <X extends org.apache.flink.types.Value> DeltaIteration<ST,WT> registerAggregationConvergenceCriterion(String name, org.apache.flink.api.common.aggregators.Aggregator<X> aggregator, org.apache.flink.api.common.aggregators.ConvergenceCriterion<X> convergenceCheck)
Deprecated.Registers anAggregatorfor the iteration together with aConvergenceCriterion. For a general description of aggregators, seeregisterAggregator(String, Aggregator)andAggregator. At the end of each iteration, the convergence criterion takes the aggregator's global aggregate value and decides whether the iteration should terminate. A typical use case is to have an aggregator that sums up the total error of change in an iteration step and have to have a convergence criterion that signals termination as soon as the aggregate value is below a certain threshold.- Parameters:
name- The name under which the aggregator is registered.aggregator- The aggregator class.convergenceCheck- The convergence criterion.- Returns:
- The DeltaIteration itself, to allow chaining function calls.
-
getAggregators
@PublicEvolving public org.apache.flink.api.common.aggregators.AggregatorRegistry getAggregators()
Deprecated.Gets the registry for aggregators for the iteration.- Returns:
- The registry with all aggregators.
-
setSolutionSetUnManaged
public void setSolutionSetUnManaged(boolean solutionSetUnManaged)
Deprecated.Sets whether to keep the solution set in managed memory (safe against heap exhaustion) or unmanaged memory (objects on heap).- Parameters:
solutionSetUnManaged- True to keep the solution set in unmanaged memory, false to keep it in managed memory.- See Also:
isSolutionSetUnManaged()
-
isSolutionSetUnManaged
public boolean isSolutionSetUnManaged()
Deprecated.gets whether the solution set is in managed or unmanaged memory.- Returns:
- True, if the solution set is in unmanaged memory (object heap), false if in managed memory.
- See Also:
setSolutionSetUnManaged(boolean)
-
-