use of storm.trident.tuple.TridentTupleView.ProjectionFactory in project storm by nathanmarz.
the class AggregateProcessor method prepare.
@Override
public void prepare(Map conf, TopologyContext context, TridentContext tridentContext) {
List<Factory> parents = tridentContext.getParentTupleFactories();
if (parents.size() != 1) {
throw new RuntimeException("Aggregate operation can only have one parent");
}
_context = tridentContext;
_collector = new FreshCollector(tridentContext);
_projection = new ProjectionFactory(parents.get(0), _inputFields);
_agg.prepare(conf, new TridentOperationContext(context, _projection));
}
use of storm.trident.tuple.TridentTupleView.ProjectionFactory in project storm by nathanmarz.
the class EachProcessor method prepare.
@Override
public void prepare(Map conf, TopologyContext context, TridentContext tridentContext) {
List<Factory> parents = tridentContext.getParentTupleFactories();
if (parents.size() != 1) {
throw new RuntimeException("Each operation can only have one parent");
}
_context = tridentContext;
_collector = new AppendCollector(tridentContext);
_projection = new ProjectionFactory(parents.get(0), _inputFields);
_function.prepare(conf, new TridentOperationContext(context, _projection));
}
use of storm.trident.tuple.TridentTupleView.ProjectionFactory 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)));
}
use of storm.trident.tuple.TridentTupleView.ProjectionFactory in project storm by nathanmarz.
the class PartitionPersistProcessor method prepare.
@Override
public void prepare(Map conf, TopologyContext context, TridentContext tridentContext) {
List<Factory> parents = tridentContext.getParentTupleFactories();
if (parents.size() != 1) {
throw new RuntimeException("Partition persist operation can only have one parent");
}
_context = tridentContext;
_state = (State) context.getTaskData(_stateId);
_projection = new ProjectionFactory(parents.get(0), _inputFields);
_collector = new FreshCollector(tridentContext);
_updater.prepare(conf, new TridentOperationContext(context, _projection));
}
use of storm.trident.tuple.TridentTupleView.ProjectionFactory 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)));
}
Aggregations