if (projection instanceof Operation && Ops.aggOps.contains(((Operation)projection).getOperator())) {
Operation<?> aggregation = (Operation<?>)projection;
aggregator = aggregation.getOperator();
projection = aggregation.getArg(0);
}
Evaluator projectionEvaluator = evaluatorFactory.create(metadata, sources, projection);
EvaluatorFunction transformer = new EvaluatorFunction(projectionEvaluator);
List target = new ArrayList();
Iterators.addAll(target, Iterators.transform(list.iterator(), transformer));
if (aggregator != null) {
return ImmutableList.of(CollQueryFunctions.aggregate(target, projection, aggregator));