CountAggregation.COUNT_STAR_FUNCTION,
ImmutableList.<Symbol>of(new InputColumn(0, DataTypes.LONG)),
Aggregation.Step.PARTIAL,
Aggregation.Step.FINAL);
CollectNode collectNode = new CollectNode(
"count",
table.getRouting(WhereClause.MATCH_ALL),
ImmutableList.<Symbol>of(),
Arrays.<Projection>asList(new AggregationProjection(ImmutableList.of(countAggregationPartial))));
collectNode.maxRowGranularity(RowGranularity.DOC);
collectNode.outputTypes(ImmutableList.<DataType>of(DataTypes.UNDEFINED));
MergeNode mergeNode = new MergeNode("local count merge", collectNode.executionNodes().size());
mergeNode.projections(ImmutableList.<Projection>of(new AggregationProjection(ImmutableList.of(countAggregationFinal))));
Plan plan = new Plan();
plan.add(collectNode);
plan.add(mergeNode);
return plan;