.getStorage()));
}
private static AggregateOperator createOverallAgg(AggregateOperator lastAgg, Map map) {
final TypeConversion wrapper = lastAgg.getType();
AggregateOperator overallAgg;
ColumnReference cr;
if (lastAgg.hasGroupBy())
cr = new ColumnReference(wrapper, 1);
else
cr = new ColumnReference(wrapper, 0);
if (lastAgg instanceof AggregateAvgOperator)
overallAgg = new AggregateAvgOperator(cr, map);
else
overallAgg = new AggregateSumOperator(cr, map);
if (lastAgg.hasGroupBy())
overallAgg.setGroupByColumns(Arrays.asList(0));
return overallAgg;
}