Search in sources :

Example 6 with Factory

use of org.apache.storm.trident.tuple.TridentTuple.Factory 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)));
}
Also used : ProjectionFactory(org.apache.storm.trident.tuple.TridentTupleView.ProjectionFactory) Factory(org.apache.storm.trident.tuple.TridentTuple.Factory) ProjectionFactory(org.apache.storm.trident.tuple.TridentTupleView.ProjectionFactory) List(java.util.List) TridentMultiReducerContext(org.apache.storm.trident.operation.TridentMultiReducerContext)

Aggregations

Factory (org.apache.storm.trident.tuple.TridentTuple.Factory)6 ProjectionFactory (org.apache.storm.trident.tuple.TridentTupleView.ProjectionFactory)6 TridentOperationContext (org.apache.storm.trident.operation.TridentOperationContext)4 ArrayList (java.util.ArrayList)1 List (java.util.List)1 TridentMultiReducerContext (org.apache.storm.trident.operation.TridentMultiReducerContext)1 TridentContext (org.apache.storm.trident.planner.processor.TridentContext)1 State (org.apache.storm.trident.state.State)1 RootFactory (org.apache.storm.trident.tuple.TridentTupleView.RootFactory)1 DirectedSubgraph (org.jgrapht.graph.DirectedSubgraph)1 TopologicalOrderIterator (org.jgrapht.traverse.TopologicalOrderIterator)1