public static void validateTableSchema(
      ColumnSchema incoming, ColumnSchema real, int i, InsertBaseStatement innerTreeStatement) {
    if (real == null) {
      processNonExistColumn(incoming, innerTreeStatement, i);
      return;
    }

    // check data type
    if (incoming.getType() == null || incoming.getColumnCategory() != TsTableColumnCategory.FIELD) {
      // sql insertion does not provide type
      // the type is inferred and can be inconsistent with the existing one
      innerTreeStatement.setDataType(InternalTypeManager.getTSDataType(real.getType()), i);
    } else if (!InternalTypeManager.getTSDataType(real.getType())
            .isCompatible(InternalTypeManager.getTSDataType(incoming.getType()))
        && !innerTreeStatement.isForceTypeConversion()) {
      processTypeConflictColumn(incoming, real, i, innerTreeStatement);
      return;
    }

    // check column category
    if (incoming.getColumnCategory() == null) {
      // sql insertion does not provide category
      innerTreeStatement.setColumnCategory(real.getColumnCategory(), i);
    } else if (!incoming.getColumnCategory().equals(real.getColumnCategory())) {
      throw new SemanticException(
          String.format(
              "Inconsistent column category of column %s: %s/%s",
              incoming.getName(), incoming.getColumnCategory(), real.getColumnCategory()),
          TSStatusCode.COLUMN_CATEGORY_MISMATCH.getStatusCode());
    }

    // construct measurement schema
    TSDataType tsDataType = InternalTypeManager.getTSDataType(real.getType());
    MeasurementSchema measurementSchema =
        new MeasurementSchema(
            real.getName(),
            tsDataType,
            getDefaultEncoding(tsDataType),
            TSFileDescriptor.getInstance().getConfig().getCompressor());
    innerTreeStatement.setMeasurementSchema(measurementSchema, i);
    try {
      innerTreeStatement.selfCheckDataTypes(i);
    } catch (DataTypeMismatchException | PathNotExistException e) {
      throw new SemanticException(e);
    }
  }
Adjust the order of ID columns in this insertion to be consistent with that from the schema
region.

@param realIdColumnSchemas id column order from the schema region
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/WrappedInsertStatement.java