private static void queryByRowRecord() {
    for (int i = 0; i < 1; i++) {
      service.submit(
          () -> {
            SessionDataSetWrapper wrapper = null;
            try {
              wrapper = sessionPool.executeQueryStatement("select * from root.sg1.d1");
              System.out.println(wrapper.getColumnNames());
              System.out.println(wrapper.getColumnTypes());
              while (wrapper.hasNext()) {
                System.out.println(wrapper.next());
              }
            } catch (IoTDBConnectionException | StatementExecutionException e) {
              LOGGER.error("Query by row record error", e);
            } finally {
              // remember to close data set finally!
              sessionPool.closeResultSet(wrapper);
            }
          });
    }
  }
Build a redirect-able SessionPool for this example
example/session/src/main/java/org/apache/iotdb/SessionPoolExample.java