diff --git a/fe/fe-core/src/main/java/org/apache/doris/load/loadv2/LoadManager.java b/fe/fe-core/src/main/java/org/apache/doris/load/loadv2/LoadManager.java index a54b9f98e3..e63bce7c12 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/load/loadv2/LoadManager.java +++ b/fe/fe-core/src/main/java/org/apache/doris/load/loadv2/LoadManager.java @@ -238,23 +238,29 @@ public class LoadManager implements Writable { String state = stmt.getState(); PatternMatcher matcher = PatternMatcherWrapper.createMysqlPattern(label, CaseSensibility.LABEL.getCaseSensibility()); - matchLoadJobs.addAll(loadJobs.stream().filter(job -> { - if (stmt.getOperator() != null) { - // compound - boolean labelFilter = - label.contains("%") ? matcher.match(job.getLabel()) : job.getLabel().equalsIgnoreCase(label); - boolean stateFilter = job.getState().name().equalsIgnoreCase(state); - return Operator.AND.equals(stmt.getOperator()) ? labelFilter && stateFilter : - labelFilter || stateFilter; - } - if (StringUtils.isNotEmpty(label)) { - return label.contains("%") ? matcher.match(job.getLabel()) : job.getLabel().equalsIgnoreCase(label); - } - if (StringUtils.isNotEmpty(state)) { - return job.getState().name().equalsIgnoreCase(state); - } - return false; - }).collect(Collectors.toList())); + matchLoadJobs.addAll( + loadJobs.stream() + .filter(job -> job.getState() != JobState.CANCELLED) + .filter(job -> { + if (stmt.getOperator() != null) { + // compound + boolean labelFilter = + label.contains("%") ? matcher.match(job.getLabel()) + : job.getLabel().equalsIgnoreCase(label); + boolean stateFilter = job.getState().name().equalsIgnoreCase(state); + return Operator.AND.equals(stmt.getOperator()) ? labelFilter && stateFilter : + labelFilter || stateFilter; + } + if (StringUtils.isNotEmpty(label)) { + return label.contains("%") ? matcher.match(job.getLabel()) + : job.getLabel().equalsIgnoreCase(label); + } + if (StringUtils.isNotEmpty(state)) { + return job.getState().name().equalsIgnoreCase(state); + } + return false; + }).collect(Collectors.toList()) + ); } /** @@ -492,13 +498,13 @@ public class LoadManager implements Writable { /** * This method will return the jobs info which can meet the condition of input param. * - * @param dbId used to filter jobs which belong to this db - * @param labelValue used to filter jobs which's label is or like labelValue. + * @param dbId used to filter jobs which belong to this db + * @param labelValue used to filter jobs which's label is or like labelValue. * @param accurateMatch true: filter jobs which's label is labelValue. false: filter jobs which's label like itself. - * @param statesValue used to filter jobs which's state within the statesValue set. + * @param statesValue used to filter jobs which's state within the statesValue set. * @return The result is the list of jobInfo. - * JobInfo is a list which includes the comparable object: jobId, label, state etc. - * The result is unordered. + * JobInfo is a list which includes the comparable object: jobId, label, state etc. + * The result is unordered. */ public List> getLoadJobInfosByDb(long dbId, String labelValue, boolean accurateMatch, Set statesValue) throws AnalysisException {