public class IterativeConditionRunner extends RichIterativeCondition<RowData>
RichIterativeCondition
wrapper to delegate invocation to the code generated RichIterativeCondition
.IterativeCondition.Context<T>
Constructor and Description |
---|
IterativeConditionRunner(GeneratedFunction<RichIterativeCondition<RowData>> generatedFunction) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Tear-down method for the user code.
|
boolean |
filter(RowData value,
IterativeCondition.Context<RowData> ctx)
The filter function that evaluates the predicate.
|
void |
open(Configuration parameters)
Initialization method for the function.
|
getIterationRuntimeContext, getRuntimeContext, setRuntimeContext
public IterativeConditionRunner(GeneratedFunction<RichIterativeCondition<RowData>> generatedFunction)
public void open(Configuration parameters) throws Exception
RichFunction
The configuration object passed to the function can be used for configuration and initialization. The configuration contains all parameters that were configured on the function in the program composition.
public class MyFilter extends RichFilterFunction<String> {
private String searchString;
public void open(Configuration parameters) {
this.searchString = parameters.getString("foo");
}
public boolean filter(String value) {
return value.equals(searchString);
}
}
By default, this method does nothing.
open
in interface RichFunction
open
in class RichIterativeCondition<RowData>
parameters
- The configuration containing the parameters attached to the contract.Exception
- Implementations may forward exceptions, which are caught by the runtime.
When the runtime catches an exception, it aborts the task and lets the fail-over logic
decide whether to retry the task execution.Configuration
public boolean filter(RowData value, IterativeCondition.Context<RowData> ctx) throws Exception
IterativeCondition
IMPORTANT: The system assumes that the function does not modify the elements on which the predicate is applied. Violating this assumption can lead to incorrect results.
filter
in class IterativeCondition<RowData>
value
- The value to be tested.ctx
- The IterativeCondition.Context
used for the evaluation of the function and provides access to
the already accepted events in the pattern (see IterativeCondition.Context.getEventsForPattern(String)
).true
for values that should be retained, false
for values to be
filtered out.Exception
- This method may throw exceptions. Throwing an exception will cause the
operation to fail and may trigger recovery.public void close() throws Exception
RichFunction
This method can be used for clean up work.
close
in interface RichFunction
close
in class RichIterativeCondition<RowData>
Exception
- Implementations may forward exceptions, which are caught by the runtime.
When the runtime catches an exception, it aborts the task and lets the fail-over logic
decide whether to retry the task execution.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.