private void analyze(Expression expression) {
    Visitor visitor = new Visitor();
    if (!visitor.process(expression, null)) {
      throw new SemanticException(
          String.format(
              "'%s' must be an aggregate expression or appear in GROUP BY clause", expression));
    }
  }
Checks whether an expression is constant with respect to the group
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/AggregationAnalyzer.java