private static void prepareData() {
    try (Connection connection = EnvFactory.getEnv().getConnection();
        Statement statement = connection.createStatement()) {

      for (String sql : creationSqls) {
        statement.execute(sql);
      }

      // prepare BufferWrite file
      for (int i = 5000; i < 7000; i++) {
        statement.addBatch(
            String.format(
                Locale.ENGLISH,
                insertTemplate,
                i,
                i,
                i,
                (double) i,
                "'" + i + "'",
                "true",
                "'" + i + "'",
                "X'" + i + "'",
                "'" + i + "-01-01'",
                i));
      }
      statement.executeBatch();
      statement.clearBatch();
      statement.execute("flush");

      for (int i = 7500; i < 8500; i++) {
        statement.addBatch(
            String.format(
                Locale.ENGLISH,
                insertTemplate,
                i,
                i,
                i,
                (double) i,
                "'" + i + "'",
                "false",
                "'" + i + "'",
                "X'" + i + "'",
                "'" + i + "-01-01'",
                i));
      }
      statement.executeBatch();
      statement.clearBatch();
      statement.execute("flush");
      // prepare Unseq-File
      for (int i = 500; i < 1500; i++) {
        if (i < 1000) {
          statement.addBatch(
              String.format(
                  Locale.ENGLISH,
                  insertTemplate,
                  i,
                  i,
                  i,
                  (double) i,
                  "'" + i + "'",
                  "true",
                  "'" + i + "'",
                  "X'0" + i + "'",
                  "'1" + i + "-01-01'",
                  i));
        } else {
          statement.addBatch(
              String.format(
                  Locale.ENGLISH,
                  insertTemplate,
                  i,
                  i,
                  i,
                  (double) i,
                  "'" + i + "'",
                  "true",
                  "'" + i + "'",
                  "X'" + i + "'",
                  "'" + i + "-01-01'",
                  i));
        }
      }
      statement.executeBatch();
      statement.clearBatch();
      statement.execute("flush");
      for (int i = 3000; i < 6500; i++) {
        statement.addBatch(
            String.format(
                Locale.ENGLISH,
                insertTemplate,
                i,
                i,
                i,
                (double) i,
                "'" + i + "'",
                "false",
                "'" + i + "'",
                "X'" + i + "'",
                "'" + i + "-01-01'",
                i));
      }
      statement.executeBatch();
      statement.clearBatch();

      // prepare BufferWrite cache
      for (int i = 9000; i < 10000; i++) {
        statement.addBatch(
            String.format(
                Locale.ENGLISH,
                insertTemplate,
                i,
                i,
                i,
                (double) i,
                "'" + i + "'",
                "true",
                "'" + i + "'",
                "X'" + i + "'",
                "'" + i + "-01-01'",
                i));
      }
      statement.executeBatch();
      statement.clearBatch();
      // prepare Overflow cache
      for (int i = 2000; i < 2500; i++) {
        statement.addBatch(
            String.format(
                Locale.ENGLISH,
                insertTemplate,
                i,
                i,
                i,
                (double) i,
                "'" + i + "'",
                "false",
                "'" + i + "'",
                "X'" + i + "'",
                "'" + i + "-01-01'",
                i));
      }
      statement.executeBatch();
      statement.clearBatch();

      for (String sql : dataSet3) {
        statement.execute(sql);
      }

      for (String sql : dataSet2) {
        statement.execute(sql);
      }
    } catch (Exception e) {
      e.printStackTrace();
      fail(e.getMessage());
    }
  }
test aggregation query with more than one functions on one series
integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBAggregationIT.java