presto-main/src/main/java/io/prestosql/sql/analyzer/AggregationAnalyzer.java/AggregationAnalyzer/analyze
class AggregationAnalyzer:    private void analyze(Expression expression)
    {
        Visitor visitor = new Visitor();
        if (!visitor.process(expression, null)) {
            throw semanticException(EXPRESSION_NOT_AGGREGATE, expression, "'%s' must be an aggregate expression or appear in GROUP BY clause", expression);
        }
    }