String key = agg.key() ;
Var v = aggregatorsAllocated.get(key);
if ( v != null )
{
ExprAggregator eAgg = aggregatorsMap.get(v) ;
if ( ! agg.equals(eAgg.getAggregator()) )
Log.warn(Query.class, "Internal inconsistency: Aggregator: "+agg) ;
return eAgg ;
}
// Allocate.
v = allocInternVar() ;
ExprAggregator aggExpr = new ExprAggregator(v, agg) ;
aggregatorsAllocated.put(key, v) ;
aggregatorsMap.put(v, aggExpr) ;
aggregators.add(aggExpr) ;
return aggExpr ;
}