Search in sources :

Example 1 with TridentOperationContext

use of org.apache.storm.trident.operation.TridentOperationContext in project storm by apache.

the class ChainedAggregatorImpl method prepare.

public void prepare(Map conf, TridentOperationContext context) {
    _inputFactories = new ProjectionFactory[_inputFields.length];
    for (int i = 0; i < _inputFields.length; i++) {
        _inputFactories[i] = context.makeProjectionFactory(_inputFields[i]);
        _aggs[i].prepare(conf, new TridentOperationContext(context, _inputFactories[i]));
    }
}
Also used : TridentOperationContext(org.apache.storm.trident.operation.TridentOperationContext)

Example 2 with TridentOperationContext

use of org.apache.storm.trident.operation.TridentOperationContext in project storm by apache.

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));
}
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) TridentOperationContext(org.apache.storm.trident.operation.TridentOperationContext)

Example 3 with TridentOperationContext

use of org.apache.storm.trident.operation.TridentOperationContext in project storm by apache.

the class StateQueryProcessor method prepare.

@Override
public void prepare(Map conf, TopologyContext context, TridentContext tridentContext) {
    List<Factory> parents = tridentContext.getParentTupleFactories();
    if (parents.size() != 1) {
        throw new RuntimeException("State query operation can only have one parent");
    }
    _context = tridentContext;
    _state = (State) context.getTaskData(_stateId);
    _projection = new ProjectionFactory(parents.get(0), _inputFields);
    _collector = new AppendCollector(tridentContext);
    _function.prepare(conf, new TridentOperationContext(context, _projection));
}
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) TridentOperationContext(org.apache.storm.trident.operation.TridentOperationContext)

Example 4 with TridentOperationContext

use of org.apache.storm.trident.operation.TridentOperationContext in project storm by apache.

the class GroupedAggregator method prepare.

@Override
public void prepare(Map conf, TridentOperationContext context) {
    _inputFactory = context.makeProjectionFactory(_inFields);
    _groupFactory = context.makeProjectionFactory(_groupFields);
    _agg.prepare(conf, new TridentOperationContext(context, _inputFactory));
}
Also used : TridentOperationContext(org.apache.storm.trident.operation.TridentOperationContext)

Example 5 with TridentOperationContext

use of org.apache.storm.trident.operation.TridentOperationContext in project storm by apache.

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));
}
Also used : ProjectionFactory(org.apache.storm.trident.tuple.TridentTupleView.ProjectionFactory) ProjectionFactory(org.apache.storm.trident.tuple.TridentTupleView.ProjectionFactory) Factory(org.apache.storm.trident.tuple.TridentTuple.Factory) TridentOperationContext(org.apache.storm.trident.operation.TridentOperationContext)

Aggregations

TridentOperationContext (org.apache.storm.trident.operation.TridentOperationContext)7 Factory (org.apache.storm.trident.tuple.TridentTuple.Factory)4 ProjectionFactory (org.apache.storm.trident.tuple.TridentTupleView.ProjectionFactory)4 TridentTupleView (org.apache.storm.trident.tuple.TridentTupleView)1