public static void bindTypeForBuiltinAggregationNonSeriesInputExpressions(
      String functionName,
      List<Expression> inputExpressions,
      List<List<Expression>> outputExpressionLists) {
    switch (functionName.toLowerCase()) {
      case SqlConstant.AVG:
      case SqlConstant.SUM:
      case SqlConstant.EXTREME:
      case SqlConstant.MIN_VALUE:
      case SqlConstant.MAX_VALUE:
      case SqlConstant.COUNT:
      case SqlConstant.COUNT_TIME:
      case SqlConstant.MIN_TIME:
      case SqlConstant.MAX_TIME:
      case SqlConstant.FIRST_VALUE:
      case SqlConstant.LAST_VALUE:
      case SqlConstant.TIME_DURATION:
      case SqlConstant.MODE:
      case SqlConstant.STDDEV:
      case SqlConstant.STDDEV_POP:
      case SqlConstant.STDDEV_SAMP:
      case SqlConstant.VARIANCE:
      case SqlConstant.VAR_POP:
      case SqlConstant.VAR_SAMP:
      case SqlConstant.MAX_BY:
      case SqlConstant.MIN_BY:
        return;
      case SqlConstant.COUNT_IF:
        Expression keepExpression = inputExpressions.get(1);
        if (keepExpression instanceof ConstantOperand) {
          outputExpressionLists.add(Collections.singletonList(keepExpression));
          return;
        } else if (keepExpression instanceof CompareBinaryExpression) {
          Expression leftExpression =
              ((CompareBinaryExpression) keepExpression).getLeftExpression();
          Expression rightExpression =
              ((CompareBinaryExpression) keepExpression).getRightExpression();
          if (leftExpression instanceof TimeSeriesOperand
              && leftExpression.getExpressionString().equalsIgnoreCase("keep")
              && rightExpression.isConstantOperand()) {
            outputExpressionLists.add(
                Collections.singletonList(
                    ExpressionUtils.reconstructBinaryExpression(
                        keepExpression,
                        new TimeSeriesOperand(
                            ((TimeSeriesOperand) leftExpression).getPath(), TSDataType.INT64),
                        rightExpression)));
            return;
          } else {
            throw new SemanticException(
                String.format(
                    "Please check input keep condition of Aggregation function [%s]",
                    functionName));
          }
        } else {
          throw new SemanticException(
              String.format(
                  "Keep condition of Aggregation function [%s] need to be constant or compare expression constructed by keep and a long number",
                  functionName));
        }
      default:
        throw new IllegalArgumentException("Invalid Aggregation function: " + functionName);
    }
  }
Bind Type for non-series input Expressions of AggregationFunction and check Semantic

<p>.e.g COUNT_IF(s1>1, keep>2, 'ignoreNull'='false'), we bind type {@link TSDataType#INT64} for
'keep'
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/TypeInferenceUtils.java