@Override
    protected Boolean visitFunctionCall(FunctionCall node, Void context) {
      if (isAggregationFunction(node.getName().toString())) {
        List<FunctionCall> aggregateFunctions = extractAggregateFunctions(node.getArguments());

        if (!aggregateFunctions.isEmpty()) {
          throw new SemanticException(
              String.format(
                  "Cannot nest aggregations inside aggregation '%s': %s",
                  node.getName(), aggregateFunctions));
        }

        return true;
      }

      return node.getArguments().stream().allMatch(expression -> process(expression, context));
    }
visitor returns true if all expressions are constant with respect to the group.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/AggregationAnalyzer.java