private void convertToTabletAndInsert(
      String deviceId,
      List<Long> times,
      List<List<String>> measurementsList,
      List<List<TSDataType>> typesList,
      List<List<Object>> valuesList,
      boolean isAligned)
      throws IoTDBConnectionException, StatementExecutionException {
    // measurement -> <type,if null>
    Map<String, Pair<TSDataType, Boolean>> measuremenMap =
        new HashMap<>(measurementsList.get(0).size() + 1, 1);
    // build measurementType
    for (int rowIndex = 0; rowIndex < measurementsList.size(); rowIndex++) {
      List<String> measurements = measurementsList.get(rowIndex);
      List<TSDataType> types = typesList.get(rowIndex);
      for (int colIndex = 0; colIndex < measurements.size(); colIndex++) {
        String measurement = measurements.get(colIndex);
        if (!measuremenMap.containsKey(measurement)) {
          measuremenMap.put(measurement, new Pair<>(types.get(colIndex), true));
        }
      }
    }
    List<IMeasurementSchema> schemaList = new ArrayList<>(measuremenMap.size());
    // use measurementType to build schemaList
    for (Entry<String, Pair<TSDataType, Boolean>> entry : measuremenMap.entrySet()) {
      schemaList.add(new MeasurementSchema(entry.getKey(), entry.getValue().getLeft()));
    }
    // build tablet and insert
    Tablet tablet = new Tablet(deviceId, schemaList, times.size());
    for (int rowIndex = 0; rowIndex < times.size(); rowIndex++) {
      addRecordToTablet(
          tablet,
          times.get(rowIndex),
          measurementsList.get(rowIndex),
          valuesList.get(rowIndex),
          measuremenMap);
    }
    if (isAligned) {
      insertAlignedTablet(tablet);
    } else {
      insertTablet(tablet);
    }
  }
insert aligned data of several devices. Given a device, for each timestamp, the number of
measurements is the same.

@param tablets data batch in multiple device
@param sorted deprecated, whether times in each Tablet are in ascending order
iotdb-client/session/src/main/java/org/apache/iotdb/session/Session.java