public Stream aggregate(Fields inputFields, CombinerAggregator agg, Fields functionFields) { return new ChainedAggregatorDeclarer(this, this).aggregate(inputFields, agg, functionFields).chainEnd(); }
private static StormTopology advancedPrimitives(FeederBatchSpout spout) throws IOException { TridentTopology topology = new TridentTopology(); // What if we want more than one aggregation? For that, we can use "chained" aggregations. // Note how we calculate count and sum. // The aggregated values can then be processed further, in this case into mean topology .newStream("aggregation", spout) .groupBy(new Fields("city")) .chainedAgg() .aggregate(new Count(), new Fields("count")) .aggregate(new Fields("age"), new Sum(), new Fields("age_sum")) .chainEnd() .each(new Fields("age_sum", "count"), new DivideAsDouble(), new Fields("mean_age")) .each(new Fields("city", "mean_age"), new Print()) ; // What if we want to persist results of an aggregation, but want to further process these // results? You can use "newValuesStream" for that topology .newStream("further",spout) .groupBy(new Fields("city")) .persistentAggregate(new MemoryMapState.Factory(), new Count(), new Fields("count")) .newValuesStream() .each(new Fields("city", "count"), new Print()); return topology.build(); }
public Stream aggregate(Fields inputFields, Aggregator agg, Fields functionFields) { return new ChainedAggregatorDeclarer(this, this).aggregate(inputFields, agg, functionFields).chainEnd(); }
public Stream aggregate(Fields inputFields, ReducerAggregator agg, Fields functionFields) { return new ChainedAggregatorDeclarer(this, this).aggregate(inputFields, agg, functionFields).chainEnd(); }
public Stream aggregate(Fields inputFields, CombinerAggregator agg, Fields functionFields) { projectionValidation(inputFields); return chainedAgg() .aggregate(inputFields, agg, functionFields) .chainEnd(); }
public Stream aggregate(Fields inputFields, Aggregator agg, Fields functionFields) { projectionValidation(inputFields); return chainedAgg() .aggregate(inputFields, agg, functionFields) .chainEnd(); }
public Stream aggregate(Fields inputFields, ReducerAggregator agg, Fields functionFields) { projectionValidation(inputFields); return chainedAgg() .aggregate(inputFields, agg, functionFields) .chainEnd(); }
public TridentState persistentAggregate(StateSpec spec, Fields inputFields, CombinerAggregator agg, Fields functionFields) { projectionValidation(inputFields); // replaces normal aggregation here with a global grouping because it needs to be consistent across batches return new ChainedAggregatorDeclarer(this, new GlobalAggScheme()) .aggregate(inputFields, agg, functionFields) .chainEnd() .partitionPersist(spec, functionFields, new CombinerAggStateUpdater(agg), functionFields); }
public Stream aggregate(Fields inputFields, Aggregator agg, Fields functionFields) { return new ChainedAggregatorDeclarer(this, this) .aggregate(inputFields, agg, functionFields) .chainEnd(); }
public Stream aggregate(Fields inputFields, CombinerAggregator agg, Fields functionFields) { return new ChainedAggregatorDeclarer(this, this) .aggregate(inputFields, agg, functionFields) .chainEnd(); }
public Stream aggregate(Fields inputFields, ReducerAggregator agg, Fields functionFields) { return new ChainedAggregatorDeclarer(this, this) .aggregate(inputFields, agg, functionFields) .chainEnd(); }
public Stream aggregate(Fields inputFields, Aggregator agg, Fields functionFields) { return new ChainedAggregatorDeclarer(this, this).aggregate(inputFields, agg, functionFields).chainEnd(); }
public Stream aggregate(Fields inputFields, CombinerAggregator agg, Fields functionFields) { return new ChainedAggregatorDeclarer(this, this).aggregate(inputFields, agg, functionFields).chainEnd(); }
public Stream aggregate(Fields inputFields, ReducerAggregator agg, Fields functionFields) { return new ChainedAggregatorDeclarer(this, this).aggregate(inputFields, agg, functionFields).chainEnd(); }
public Stream aggregate(Fields inputFields, Aggregator agg, Fields functionFields) { projectionValidation(inputFields); return chainedAgg() .aggregate(inputFields, agg, functionFields) .chainEnd(); }
public Stream aggregate(Fields inputFields, CombinerAggregator agg, Fields functionFields) { projectionValidation(inputFields); return chainedAgg() .aggregate(inputFields, agg, functionFields) .chainEnd(); }
public Stream aggregate(Fields inputFields, CombinerAggregator agg, Fields functionFields) { projectionValidation(inputFields); return chainedAgg() .aggregate(inputFields, agg, functionFields) .chainEnd(); }
public Stream aggregate(Fields inputFields, ReducerAggregator agg, Fields functionFields) { projectionValidation(inputFields); return chainedAgg() .aggregate(inputFields, agg, functionFields) .chainEnd(); }
public Stream aggregate(Fields inputFields, Aggregator agg, Fields functionFields) { projectionValidation(inputFields); return chainedAgg() .aggregate(inputFields, agg, functionFields) .chainEnd(); }