Search in sources :

Example 1 with ProjectionFactory

use of org.apache.storm.trident.tuple.TridentTupleView.ProjectionFactory 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 2 with ProjectionFactory

use of org.apache.storm.trident.tuple.TridentTupleView.ProjectionFactory 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 3 with ProjectionFactory

use of org.apache.storm.trident.tuple.TridentTupleView.ProjectionFactory in project storm by apache.

the class EachProcessor method prepare.

@Override
public void prepare(Map<String, Object> conf, TopologyContext context, TridentContext tridentContext) {
    List<Factory> parents = tridentContext.getParentTupleFactories();
    if (parents.size() != 1) {
        throw new RuntimeException("Each operation can only have one parent");
    }
    this.context = tridentContext;
    collector = new AppendCollector(tridentContext);
    projection = new ProjectionFactory(parents.get(0), inputFields);
    function.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)

Example 4 with ProjectionFactory

use of org.apache.storm.trident.tuple.TridentTupleView.ProjectionFactory in project storm by apache.

the class PartitionPersistProcessor method prepare.

@Override
public void prepare(Map<String, Object> 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");
    }
    this.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 5 with ProjectionFactory

use of org.apache.storm.trident.tuple.TridentTupleView.ProjectionFactory in project storm by apache.

the class ProjectedProcessor method prepare.

@Override
public void prepare(Map<String, Object> conf, TopologyContext context, TridentContext tridentContext) {
    if (tridentContext.getParentTupleFactories().size() != 1) {
        throw new RuntimeException("Projection processor can only have one parent");
    }
    this.context = tridentContext;
    factory = new ProjectionFactory(tridentContext.getParentTupleFactories().get(0), projectFields);
}
Also used : ProjectionFactory(org.apache.storm.trident.tuple.TridentTupleView.ProjectionFactory)

Aggregations

ProjectionFactory (org.apache.storm.trident.tuple.TridentTupleView.ProjectionFactory)13 Factory (org.apache.storm.trident.tuple.TridentTuple.Factory)10 TridentOperationContext (org.apache.storm.trident.operation.TridentOperationContext)8 List (java.util.List)2 TridentMultiReducerContext (org.apache.storm.trident.operation.TridentMultiReducerContext)2 TridentTuple (org.apache.storm.trident.tuple.TridentTuple)1