private static void queryType(String series, HashMap<String, TSDataType> headerTypeMap) {
    String sql = "show timeseries " + series;
    try (SessionDataSetWrapper sessionDataSetWrapper = sessionPool.executeQueryStatement(sql)) {
      int tsIndex = sessionDataSetWrapper.getColumnNames().indexOf(ColumnHeaderConstant.TIMESERIES);
      int dtIndex = sessionDataSetWrapper.getColumnNames().indexOf(ColumnHeaderConstant.DATATYPE);
      while (sessionDataSetWrapper.hasNext()) {
        RowRecord rowRecord = sessionDataSetWrapper.next();
        List<Field> fields = rowRecord.getFields();
        String timeseries = fields.get(tsIndex).getStringValue();
        String dataType = fields.get(dtIndex).getStringValue();
        if (Objects.equals(series, timeseries)) {
          headerTypeMap.put(timeseries, getType(dataType));
        }
      }
    } catch (StatementExecutionException | IoTDBConnectionException e) {
      ioTPrinter.println("Meet error when query the type of timeseries because " + e.getMessage());
      System.exit(1);
    }
  }
if the data is aligned by time, the data will be written by this method.

@param headerNames the header names of CSV file
@param records the records of CSV file
@param failedFilePath the directory to save the failed files
iotdb-client/cli/src/main/java/org/apache/iotdb/tool/data/ImportDataTree.java