private void executeSetDatabaseStatement(Statement statement)
      throws LoadFileException, AuthException {
    // 1.check Authority
    TSStatus status =
        AuthorityChecker.checkAuthority(
            statement, loadTsFileAnalyzer.context.getSession().getUserName());
    if (status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
      throw new AuthException(TSStatusCode.representOf(status.getCode()), status.getMessage());
    }

    // 2.execute setDatabase statement
    final long queryId = SessionManager.getInstance().requestQueryId();
    final ExecutionResult result =
        Coordinator.getInstance()
            .executeForTreeModel(
                statement,
                queryId,
                null,
                "",
                loadTsFileAnalyzer.partitionFetcher,
                loadTsFileAnalyzer.schemaFetcher,
                IoTDBDescriptor.getInstance().getConfig().getQueryTimeoutThreshold(),
                false);
    if (result.status.code != TSStatusCode.SUCCESS_STATUS.getStatusCode()
        && result.status.code != TSStatusCode.DATABASE_ALREADY_EXISTS.getStatusCode()
        // In tree model, if the user creates a conflict database concurrently, for instance, the
        // database created by user is root.db.ss.a, the auto-creation failed database is root.db,
        // we wait till "getOrCreatePartition" to judge if the time series (like root.db.ss.a.e /
        // root.db.ss.a) conflicts with the created database. just do not throw exception here.
        && result.status.code != TSStatusCode.DATABASE_CONFLICT.getStatusCode()) {
      LOGGER.warn(
          "Create database error, statement: {}, result status is: {}", statement, result.status);
      throw new LoadFileException(
          String.format(
              "Create database error, statement: %s, result status is: %s",
              statement, result.status));
    }
  }
This can only be invoked after all timeseries in the current tsfile have been processed.
Otherwise, the isAligned status may be wrong.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/load/TreeSchemaAutoCreatorAndVerifier.java