Ejemplo n.º 1
0
 public void complete(FlowProcess flow_process, AggregatorCall<Object> ag_call) {
   try {
     ag_call.getOutputCollector().add(Util.coerceToTuple(ag_call.getContext()));
   } catch (Exception e) {
     throw new RuntimeException(e);
   }
 }
Ejemplo n.º 2
0
  @Override
  public void complete(FlowProcess flowProcess, AggregatorCall aggregatorCall) {
    Tuple result = new Tuple();
    result.add(min);
    result.add(max);

    aggregatorCall.getOutputCollector().add(result);
  }
Ejemplo n.º 3
0
 @Override
 public void aggregate(FlowProcess flowProcess, AggregatorCall aggregatorCall) {
   TupleEntry entry = aggregatorCall.getArguments();
   if (entry.getInteger(0) < min) {
     min = entry.getInteger(0);
   }
   if (entry.getInteger(1) > max) {
     max = entry.getInteger(1);
   }
 }
Ejemplo n.º 4
0
  public void aggregate(FlowProcess flow_process, AggregatorCall<Object> ag_call) {
    try {
      ISeq fn_args_seq = Util.coerceFromTuple(ag_call.getArguments().getTuple());
      Object o;
      if (this.args > 0) o = this.init_fn.applyTo(fn_args_seq);
      else o = this.init_fn.invoke();

      ISeq oseq = Util.coerceToSeq(o);

      ISeq currContext = (ISeq) ag_call.getContext();
      if (currContext == null) {
        ag_call.setContext(oseq);
      } else {
        ag_call.setContext(Util.coerceToSeq(this.combine_fn.applyTo(Util.cat(currContext, oseq))));
      }
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
Ejemplo n.º 5
0
 protected Tuple getResult(AggregatorCall<Tuple[]> aggregatorCall) {
   return aggregatorCall.getContext()[0];
 }
Ejemplo n.º 6
0
 public void complete(FlowProcess flowProcess, AggregatorCall<Tuple[]> aggregatorCall) {
   if (aggregatorCall.getContext()[0] != null)
     aggregatorCall.getOutputCollector().add(getResult(aggregatorCall));
 }
Ejemplo n.º 7
0
  public void aggregate(FlowProcess flowProcess, AggregatorCall<Tuple[]> aggregatorCall) {
    if (ignoreTuples != null && ignoreTuples.contains(aggregatorCall.getArguments().getTuple()))
      return;

    performOperation(aggregatorCall.getContext(), aggregatorCall.getArguments());
  }
Ejemplo n.º 8
0
 @SuppressWarnings("unchecked")
 public void start(FlowProcess flowProcess, AggregatorCall<Tuple[]> aggregatorCall) {
   if (aggregatorCall.getContext() == null) aggregatorCall.setContext(new Tuple[1]);
   else aggregatorCall.getContext()[0] = null;
 }
Ejemplo n.º 9
0
 public void start(FlowProcess flow_process, AggregatorCall<Object> ag_call) {
   ag_call.setContext(null);
 }
Ejemplo n.º 10
0
 @Override
 public void setDelegate(AggregatorCall<Context> delegate) {
   super.setDelegate(delegate);
   collector.setOutputCollector(delegate.getOutputCollector());
 }