private void analyzeHavingBase(
      Analysis analysis,
      QueryStatement queryStatement,
      ISchemaTree schemaTree,
      UnaryOperator<Expression> havingExpressionAnalyzer,
      MPPQueryContext queryContext) {
    // get removeWildcard Expressions in Having
    List<Expression> conJunctions =
        ExpressionAnalyzer.bindSchemaForPredicate(
            queryStatement.getHavingCondition().getPredicate(),
            queryStatement.getFromComponent().getPrefixPaths(),
            schemaTree,
            true,
            queryContext);
    Expression havingExpression =
        PredicateUtils.combineConjuncts(
            conJunctions.stream().distinct().collect(Collectors.toList()));
    havingExpression = havingExpressionAnalyzer.apply(havingExpression);

    TSDataType outputType = analyzeExpressionType(analysis, havingExpression);
    if (outputType != TSDataType.BOOLEAN) {
      throw new SemanticException(
          String.format(
              "The output type of the expression in HAVING clause should be BOOLEAN, actual data type: %s.",
              outputType));
    }

    analysis.setHavingExpression(havingExpression);
  }
process select component for align by device.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/AnalyzeVisitor.java