private void convertToTabletsAndInsert(
      List<String> deviceIds,
      List<Long> times,
      List<List<String>> measurementsList,
      List<List<TSDataType>> typesList,
      List<List<Object>> valuesList,
      int deviceSize,
      boolean isAligned)
      throws IoTDBConnectionException, StatementExecutionException {
    // device -> measurement -> <type,if null>
    Map<String, Map<String, Pair<TSDataType, Boolean>>> deviceMeasuremenMap =
        new HashMap<>(deviceSize + 1, 1);
    // device -> row count
    Map<String, Integer> rowMap = new HashMap<>(deviceSize + 1, 1);
    // first build measurementTypeMap and rowMap
    for (int rowIndex = 0; rowIndex < deviceIds.size(); rowIndex++) {
      String device = deviceIds.get(rowIndex);
      List<String> measurements = measurementsList.get(rowIndex);
      List<TSDataType> types = typesList.get(rowIndex);
      Map<String, Pair<TSDataType, Boolean>> measurementMap =
          deviceMeasuremenMap.computeIfAbsent(
              device, k -> new HashMap<>(measurements.size() + 1, 1));
      for (int colIndex = 0; colIndex < measurements.size(); colIndex++) {
        String measurement = measurements.get(colIndex);
        if (!measurementMap.containsKey(measurement)) {
          measurementMap.put(measurement, new Pair<>(types.get(colIndex), true));
        }
      }
      rowMap.merge(device, 1, Integer::sum);
    }
    // device -> schema
    Map<String, List<IMeasurementSchema>> schemaMap = new HashMap<>(deviceSize + 1, 1);
    // use measurementTypeMap to build schemaMap
    for (Map.Entry<String, Map<String, Pair<TSDataType, Boolean>>> entry :
        deviceMeasuremenMap.entrySet()) {
      List<IMeasurementSchema> schemaList = new ArrayList<>(entry.getValue().size() + 1);
      for (Map.Entry<String, Pair<TSDataType, Boolean>> schemaEntry : entry.getValue().entrySet()) {
        schemaList.add(
            new MeasurementSchema(schemaEntry.getKey(), schemaEntry.getValue().getLeft()));
      }
      schemaMap.put(entry.getKey(), schemaList);
    }
    // device -> tablet
    Map<String, Tablet> tablets = new HashMap<>(deviceSize + 1, 1);
    // use schemaMap and rowMap to build tablets and insert
    for (int rowIndex = 0; rowIndex < deviceIds.size(); rowIndex++) {
      String device = deviceIds.get(rowIndex);
      Tablet tablet =
          tablets.computeIfAbsent(
              device, k -> new Tablet(device, schemaMap.get(device), rowMap.get(device)));
      addRecordToTablet(
          tablet,
          times.get(rowIndex),
          measurementsList.get(rowIndex),
          valuesList.get(rowIndex),
          deviceMeasuremenMap.get(device));
    }
    if (isAligned) {
      insertAlignedTablets(tablets);
    } else {
      insertTablets(tablets);
    }
  }
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