Search in sources :

Example 1 with TridentMultiReducerContext

use of storm.trident.operation.TridentMultiReducerContext in project storm by nathanmarz.

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<String, Integer>();
    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(storm.trident.tuple.TridentTupleView.ProjectionFactory) Factory(storm.trident.tuple.TridentTuple.Factory) ProjectionFactory(storm.trident.tuple.TridentTupleView.ProjectionFactory) List(java.util.List) TridentMultiReducerContext(storm.trident.operation.TridentMultiReducerContext)

Example 2 with TridentMultiReducerContext

use of storm.trident.operation.TridentMultiReducerContext in project storm by nathanmarz.

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));
}
Also used : List(java.util.List) ArrayList(java.util.ArrayList) TridentMultiReducerContext(storm.trident.operation.TridentMultiReducerContext)

Example 3 with TridentMultiReducerContext

use of storm.trident.operation.TridentMultiReducerContext in project jstorm by alibaba.

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<String, Integer>();
    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(storm.trident.tuple.TridentTupleView.ProjectionFactory) Factory(storm.trident.tuple.TridentTuple.Factory) ProjectionFactory(storm.trident.tuple.TridentTupleView.ProjectionFactory) List(java.util.List) TridentMultiReducerContext(storm.trident.operation.TridentMultiReducerContext)

Example 4 with TridentMultiReducerContext

use of storm.trident.operation.TridentMultiReducerContext in project jstorm by alibaba.

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));
}
Also used : List(java.util.List) ArrayList(java.util.ArrayList) TridentMultiReducerContext(storm.trident.operation.TridentMultiReducerContext)

Aggregations

List (java.util.List)4 TridentMultiReducerContext (storm.trident.operation.TridentMultiReducerContext)4 ArrayList (java.util.ArrayList)2 Factory (storm.trident.tuple.TridentTuple.Factory)2 ProjectionFactory (storm.trident.tuple.TridentTupleView.ProjectionFactory)2