Class JoinProcessor<K,R,V1,V2>
- java.lang.Object
-
- org.apache.storm.streams.processors.JoinProcessor<K,R,V1,V2>
-
- All Implemented Interfaces:
Serializable
,BatchProcessor
,Processor<Pair<K,?>>
public class JoinProcessor<K,R,V1,V2> extends Object implements BatchProcessor
Provides equi-join implementation based on simple hash-join.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JoinProcessor.JoinType
-
Field Summary
Fields Modifier and Type Field Description protected ProcessorContext
context
-
Constructor Summary
Constructors Constructor Description JoinProcessor(String leftStream, String rightStream, ValueJoiner<V1,V2,R> valueJoiner)
JoinProcessor(String leftStream, String rightStream, ValueJoiner<V1,V2,R> valueJoiner, JoinProcessor.JoinType leftType, JoinProcessor.JoinType rightType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
execute(Pair<K,?> input, String sourceStream)
Executes some operations on the input and possibly emits some results.protected void
execute(T input)
Execute some operation on the input value.void
finish()
This is triggered to signal the end of the current batch of values.String
getLeftStream()
String
getRightStream()
void
init(ProcessorContext context)
Initializes the processor.protected <R> void
mayBeForwardAggUpdate(Supplier<R> result)
Forwards the result update to downstream processors.void
punctuate(String stream)
Punctuation marks end of a batch which can be used to compute and pass the results of one stage in the pipeline to the next.
-
-
-
Field Detail
-
context
protected ProcessorContext context
-
-
Constructor Detail
-
JoinProcessor
public JoinProcessor(String leftStream, String rightStream, ValueJoiner<V1,V2,R> valueJoiner)
-
JoinProcessor
public JoinProcessor(String leftStream, String rightStream, ValueJoiner<V1,V2,R> valueJoiner, JoinProcessor.JoinType leftType, JoinProcessor.JoinType rightType)
-
-
Method Detail
-
execute
public void execute(Pair<K,?> input, String sourceStream)
Executes some operations on the input and possibly emits some results. Processors that do not care about the source stream should overrideBaseProcessor.execute(Object)
instead.
-
finish
public void finish()
This is triggered to signal the end of the current batch of values. Sub classes can override this to emit the result of a batch of values, for e.g. to emit the result of an aggregate or join operation on a batch of values. If a processor does per-value operation like filter, map etc, they can choose to ignore this.
-
getLeftStream
public String getLeftStream()
-
getRightStream
public String getRightStream()
-
init
public void init(ProcessorContext context)
Initializes the processor. This is typically invoked from the underlying storm bolt's prepare method.
-
execute
protected void execute(T input)
Execute some operation on the input value. Sub classes can override this when then don't care about the source stream from where the input is received.- Parameters:
input
- the input
-
punctuate
public void punctuate(String stream)
Punctuation marks end of a batch which can be used to compute and pass the results of one stage in the pipeline to the next. For e.g. emit the results of an aggregation.
-
mayBeForwardAggUpdate
protected final <R> void mayBeForwardAggUpdate(Supplier<R> result)
Forwards the result update to downstream processors. Processors that operate on a batch of tuples, like aggregation, join etc can use this to emit the partial results on each input if they are operating in non-windowed mode.- Type Parameters:
R
- the result type- Parameters:
result
- the result function
-
-