presto-main/src/main/java/io/prestosql/sql/planner/sanity/TypeValidator.java/TypeValidator/visitAggregation
class TypeValidator:        @Override
        public Void visitAggregation(AggregationNode node, Void context)
        {
            visitPlan(node, context);

            AggregationNode.Step step = node.getStep();

            for (Map.Entry<Symbol, Aggregation> entry : node.getAggregations().entrySet()) {
                Symbol symbol = entry.getKey();
                Aggregation aggregation = entry.getValue();
                switch (step) {
                    case SINGLE:
                        checkSignature(symbol, aggregation.getResolvedFunction().getSignature());
                        checkCall(symbol, aggregation.getResolvedFunction().getSignature(), aggregation.getArguments());
                        break;
                    case FINAL:
                        checkSignature(symbol, aggregation.getResolvedFunction().getSignature());
                        break;
                }
            }

            return null;
        }