@Override
    public void alterJob(AlterLoadStmt stmt) throws DdlException {
        writeLock();

        try {
            if (stmt.getAnalyzedJobProperties().containsKey(LoadStmt.PRIORITY)) {
                priority = LoadPriority.priorityByName(stmt.getAnalyzedJobProperties().get(LoadStmt.PRIORITY));
                AlterLoadJobOperationLog log = new AlterLoadJobOperationLog(id,
                        stmt.getAnalyzedJobProperties());
                GlobalStateMgr.getCurrentState().getEditLog().logAlterLoadJob(log);

                for (LoadTask loadTask : newLoadingTasks) {
                    GlobalStateMgr.getCurrentState().getLoadingLoadTaskScheduler().updatePriority(
                            loadTask.getSignature(),
                            priority);
                }
            }

        } finally {
            writeUnlock();
        }

    }
@Test
    public void testAlterLoad(@Injectable LoadStmt loadStmt,
                              @Injectable AlterLoadStmt alterLoadStmt,
                              @Injectable DataDescription dataDescription,
                              @Injectable LabelName labelName,
                              @Injectable Database database,
                              @Injectable OlapTable olapTable,
                              @Mocked GlobalStateMgr globalStateMgr) {

        String label = "label";
        long dbId = 1;
        String tableName = "table";
        String databaseName = "database";
        List<DataDescription> dataDescriptionList = Lists.newArrayList();
        dataDescriptionList.add(dataDescription);
        BrokerDesc brokerDesc = new BrokerDesc("broker0", Maps.newHashMap());
        Map<String, String> properties = new HashMap<>();
        properties.put(LoadStmt.PRIORITY, "HIGH");

        new Expectations() {
            {
                loadStmt.getLabel();
                minTimes = 0;
                result = labelName;
                labelName.getDbName();
                minTimes = 0;
                result = databaseName;
                labelName.getLabelName();
                minTimes = 0;
                result = label;
                globalStateMgr.getDb(databaseName);
                minTimes = 0;
                result = database;
                loadStmt.getDataDescriptions();
                minTimes = 0;
                result = dataDescriptionList;
                dataDescription.getTableName();
                minTimes = 0;
                result = tableName;
                database.getTable(tableName);
                minTimes = 0;
                result = olapTable;
                dataDescription.getPartitionNames();
                minTimes = 0;
                result = null;
                database.getId();
                minTimes = 0;
                result = dbId;
                loadStmt.getBrokerDesc();
                minTimes = 0;
                result = brokerDesc;
                loadStmt.getEtlJobType();
                minTimes = 0;
                result = EtlJobType.BROKER;
                alterLoadStmt.getAnalyzedJobProperties();
                minTimes = 0;
                result = properties;
            }
        };

        try {
            BrokerLoadJob brokerLoadJob = (BrokerLoadJob) BulkLoadJob.fromLoadStmt(loadStmt, null);
            Assert.assertEquals(Long.valueOf(dbId), Deencapsulation.getField(brokerLoadJob, "dbId"));
            Assert.assertEquals(label, Deencapsulation.getField(brokerLoadJob, "label"));
            Assert.assertEquals(JobState.PENDING, Deencapsulation.getField(brokerLoadJob, "state"));
            Assert.assertEquals(EtlJobType.BROKER, Deencapsulation.getField(brokerLoadJob, "jobType"));
            brokerLoadJob.alterJob(alterLoadStmt);
        } catch (DdlException e) {
            Assert.fail(e.getMessage());
        }

    }