public final class ScalaProcessWindowFunctionWrapper<IN,OUT,KEY,W extends Window> extends ProcessWindowFunction<IN,OUT,KEY,W>
The Scala and Java Window functions differ in their type of "Iterable": - Scala WindowFunction: scala.Iterable - Java WindowFunction: java.lang.Iterable
ProcessWindowFunction.Context
Constructor and Description |
---|
ScalaProcessWindowFunctionWrapper(ProcessWindowFunction<IN,OUT,KEY,W> func) |
Modifier and Type | Method and Description |
---|---|
void |
clear(ProcessWindowFunction.Context context)
Deletes any state in the
Context when the Window is purged. |
void |
close()
Tear-down method for the user code.
|
void |
open(Configuration parameters)
Initialization method for the function.
|
void |
process(KEY key,
ProcessWindowFunction.Context context,
Iterable<IN> elements,
Collector<OUT> out)
Evaluates the window and outputs none or several elements.
|
void |
setRuntimeContext(RuntimeContext t)
Sets the function's runtime context.
|
getIterationRuntimeContext, getRuntimeContext
public ScalaProcessWindowFunctionWrapper(ProcessWindowFunction<IN,OUT,KEY,W> func)
public void process(KEY key, ProcessWindowFunction.Context context, Iterable<IN> elements, Collector<OUT> out)
ProcessWindowFunction
process
in class ProcessWindowFunction<IN,OUT,KEY,W extends Window>
key
- The key for which this window is evaluated.context
- The context in which the window is being evaluated.elements
- The elements in the window being evaluated.out
- A collector for emitting elements.public void clear(ProcessWindowFunction.Context context)
ProcessWindowFunction
Context
when the Window is purged.public void setRuntimeContext(RuntimeContext t)
RichFunction
setRuntimeContext
in interface RichFunction
setRuntimeContext
in class AbstractRichFunction
t
- The runtime context.public void open(Configuration parameters)
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 MyMapper extends FilterFunction<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 AbstractRichFunction
parameters
- The configuration containing the parameters attached to the contract.Configuration
public void close()
RichFunction
This method can be used for clean up work.
close
in interface RichFunction
close
in class AbstractRichFunction
Copyright © 2014–2018 The Apache Software Foundation. All rights reserved.