Search in sources :

Example 1 with Aggregator

use of com.hazelcast.aggregation.Aggregator in project hazelcast by hazelcast.

the class CallerRunsAccumulationExecutor method execute.

@Override
@SuppressWarnings("unchecked")
public AggregationResult execute(Aggregator aggregator, Collection<QueryableEntry> entries, Collection<Integer> partitionIds) {
    Aggregator resultAggregator = serializationService.toObject(serializationService.toData(aggregator));
    try {
        for (QueryableEntry entry : entries) {
            resultAggregator.accumulate(entry);
        }
    } finally {
        resultAggregator.onAccumulationFinished();
    }
    AggregationResult result = new AggregationResult(resultAggregator);
    result.setPartitionIds(partitionIds);
    return result;
}
Also used : Aggregator(com.hazelcast.aggregation.Aggregator) QueryableEntry(com.hazelcast.query.impl.QueryableEntry)

Example 2 with Aggregator

use of com.hazelcast.aggregation.Aggregator in project hazelcast by hazelcast.

the class ParallelAccumulationExecutor method execute.

@Override
@SuppressWarnings("unchecked")
public AggregationResult execute(Aggregator aggregator, Collection<QueryableEntry> entries, Collection<Integer> partitionIds) {
    Collection<Aggregator> chunkAggregators = accumulateParallel(aggregator, entries);
    Aggregator resultAggregator = clone(aggregator);
    try {
        for (Aggregator chunkAggregator : chunkAggregators) {
            resultAggregator.combine(chunkAggregator);
        }
    } finally {
        resultAggregator.onCombinationFinished();
    }
    AggregationResult result = new AggregationResult(resultAggregator);
    result.setPartitionIds(partitionIds);
    return result;
}
Also used : Aggregator(com.hazelcast.aggregation.Aggregator)

Example 3 with Aggregator

use of com.hazelcast.aggregation.Aggregator in project hazelcast by hazelcast.

the class CallerRunsAccumulationExecutor method execute.

@Override
@SuppressWarnings("unchecked")
public AggregationResult execute(Aggregator aggregator, Iterable<QueryableEntry> entries, PartitionIdSet partitionIds) {
    Aggregator resultAggregator = serializationService.toObject(serializationService.toData(aggregator));
    try {
        for (QueryableEntry entry : entries) {
            resultAggregator.accumulate(entry);
        }
    } finally {
        resultAggregator.onAccumulationFinished();
    }
    AggregationResult result = new AggregationResult(resultAggregator, serializationService);
    result.setPartitionIds(partitionIds);
    return result;
}
Also used : Aggregator(com.hazelcast.aggregation.Aggregator) QueryableEntry(com.hazelcast.query.impl.QueryableEntry)

Example 4 with Aggregator

use of com.hazelcast.aggregation.Aggregator in project hazelcast by hazelcast.

the class ParallelAccumulationExecutor method execute.

@Override
@SuppressWarnings("unchecked")
public AggregationResult execute(Aggregator aggregator, Iterable<QueryableEntry> entries, PartitionIdSet partitionIds) {
    Collection<Aggregator> chunkAggregators = accumulateParallel(aggregator, entries);
    Aggregator resultAggregator = clone(aggregator);
    try {
        for (Aggregator chunkAggregator : chunkAggregators) {
            resultAggregator.combine(chunkAggregator);
        }
    } finally {
        resultAggregator.onCombinationFinished();
    }
    AggregationResult result = new AggregationResult(resultAggregator, serializationService);
    result.setPartitionIds(partitionIds);
    return result;
}
Also used : Aggregator(com.hazelcast.aggregation.Aggregator)

Aggregations

Aggregator (com.hazelcast.aggregation.Aggregator)4 QueryableEntry (com.hazelcast.query.impl.QueryableEntry)2