for (SingleElementSymbol expression : groupCols) {
if(expression instanceof ElementSymbol || expression instanceof AggregateSymbol) {
requiredSymbols.add(expression);
} else {
ExpressionSymbol exprSymbol = (ExpressionSymbol) expression;
Expression expr = exprSymbol.getExpression();
AggregateSymbolCollectorVisitor.getAggregates(expr, requiredSymbols, requiredSymbols);
createdSymbols.add(exprSymbol);
}
}
}
// Take credit for creating any aggregates that are needed above
for (SingleElementSymbol outputSymbol : outputCols) {
if(outputSymbol instanceof AggregateSymbol) {
AggregateSymbol agg = (AggregateSymbol)outputSymbol;
createdSymbols.add(outputSymbol);
Expression aggExpr = agg.getExpression();
if(aggExpr != null) {
AggregateSymbolCollectorVisitor.getAggregates(aggExpr, requiredSymbols, requiredSymbols);
}
OrderBy orderBy = agg.getOrderBy();
if(orderBy != null) {