private static void groupByQuery() throws IoTDBConnectionException, StatementExecutionException {
    List<String> paths = new ArrayList<>();
    paths.add(ROOT_SG1_D1_S1);
    paths.add(ROOT_SG1_D1_S2);
    paths.add(ROOT_SG1_D1_S3);

    List<TAggregationType> aggregations = new ArrayList<>();
    aggregations.add(TAggregationType.COUNT);
    aggregations.add(TAggregationType.SUM);
    aggregations.add(TAggregationType.MAX_VALUE);
    try (SessionDataSet sessionDataSet =
        session.executeAggregationQuery(paths, aggregations, 0, 100, 10, 20)) {
      System.out.println(sessionDataSet.getColumnNames());
      sessionDataSet.setFetchSize(1024);
      while (sessionDataSet.hasNext()) {
        System.out.println(sessionDataSet.next());
      }
    }
  }
This example shows how to insert data of TSDataType.TEXT. You can use the session interface to
write data of String type or Binary type.
example/session/src/main/java/org/apache/iotdb/SessionExample.java