use of org.apache.storm.trident.operation.TridentMultiReducerContext in project storm by apache.
the class GroupedMultiReducerExecutor method prepare.
@Override
public void prepare(Map conf, TridentMultiReducerContext context) {
for (int i = 0; i < _groupFields.size(); i++) {
_groupFactories.add(context.makeProjectionFactory(i, _groupFields.get(i)));
_inputFactories.add(context.makeProjectionFactory(i, _inputFields.get(i)));
}
_reducer.prepare(conf, new TridentMultiReducerContext((List) _inputFactories));
}
use of org.apache.storm.trident.operation.TridentMultiReducerContext in project storm by apache.
the class MultiReducerProcessor method prepare.
@Override
public void prepare(Map<String, Object> conf, TopologyContext context, TridentContext tridentContext) {
List<Factory> parents = tridentContext.getParentTupleFactories();
this.context = tridentContext;
streamToIndex = new HashMap<>();
List<String> parentStreams = tridentContext.getParentStreams();
for (int i = 0; i < parentStreams.size(); i++) {
streamToIndex.put(parentStreams.get(i), i);
}
projectionFactories = new ProjectionFactory[projectFields.size()];
for (int i = 0; i < projectFields.size(); i++) {
projectionFactories[i] = new ProjectionFactory(parents.get(i), projectFields.get(i));
}
collector = new FreshCollector(tridentContext);
reducer.prepare(conf, new TridentMultiReducerContext((List) Arrays.asList(projectionFactories)));
}
use of org.apache.storm.trident.operation.TridentMultiReducerContext in project storm by apache.
the class MultiReducerProcessor method prepare.
@Override
public void prepare(Map conf, TopologyContext context, TridentContext tridentContext) {
List<Factory> parents = tridentContext.getParentTupleFactories();
_context = tridentContext;
_streamToIndex = new HashMap<>();
List<String> parentStreams = tridentContext.getParentStreams();
for (int i = 0; i < parentStreams.size(); i++) {
_streamToIndex.put(parentStreams.get(i), i);
}
_projectionFactories = new ProjectionFactory[_projectFields.size()];
for (int i = 0; i < _projectFields.size(); i++) {
_projectionFactories[i] = new ProjectionFactory(parents.get(i), _projectFields.get(i));
}
_collector = new FreshCollector(tridentContext);
_reducer.prepare(conf, new TridentMultiReducerContext((List) Arrays.asList(_projectionFactories)));
}
use of org.apache.storm.trident.operation.TridentMultiReducerContext in project storm by apache.
the class GroupedMultiReducerExecutor method prepare.
@Override
public void prepare(Map<String, Object> conf, TridentMultiReducerContext context) {
for (int i = 0; i < groupFields.size(); i++) {
groupFactories.add(context.makeProjectionFactory(i, groupFields.get(i)));
inputFactories.add(context.makeProjectionFactory(i, inputFields.get(i)));
}
reducer.prepare(conf, new TridentMultiReducerContext((List) inputFactories));
}
Aggregations