diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/OlapScanNode.java b/fe/fe-core/src/main/java/org/apache/doris/planner/OlapScanNode.java index 49d961be5c8228..68be7541043fe8 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/planner/OlapScanNode.java +++ b/fe/fe-core/src/main/java/org/apache/doris/planner/OlapScanNode.java @@ -1344,6 +1344,8 @@ public boolean getShouldColoScan() { // If scan is key search, should not enable the shared scan opt to prevent the performance problem // 1. where contain the eq or in expr of key column slot // 2. key column slot is distribution column and first column + // FIXME: this is not a good check, we can not guarantee that the predicate we check can truly + // help to prune the data, so we should check the predicate's effect on the data. protected boolean isKeySearch() { List whereSlot = Lists.newArrayList(); for (Expr conjunct : conjuncts) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/ScanNode.java b/fe/fe-core/src/main/java/org/apache/doris/planner/ScanNode.java index 648eac047d450c..99184df1453759 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/planner/ScanNode.java +++ b/fe/fe-core/src/main/java/org/apache/doris/planner/ScanNode.java @@ -708,7 +708,7 @@ public boolean shouldDisableSharedScan() { return isKeySearch() || !enableShardScan; } - public boolean haveLimitAndConjunts() { - return hasLimit() && !conjuncts.isEmpty(); + public boolean shouldUseOneInstance() { + return hasLimit() && conjuncts.isEmpty(); } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/Coordinator.java b/fe/fe-core/src/main/java/org/apache/doris/qe/Coordinator.java index d0f03aa00e1b77..96ed3649007a4a 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/Coordinator.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/Coordinator.java @@ -1752,9 +1752,9 @@ private void computeFragmentHosts() throws Exception { //the scan instance num should not larger than the tablets num expectedInstanceNum = Math.min(perNodeScanRanges.size(), parallelExecInstanceNum); } - // if have limit and conjunts, only need 1 instance to save cpu and + // if have limit and no conjuncts, only need 1 instance to save cpu and // mem resource - if (node.isPresent() && node.get().haveLimitAndConjunts()) { + if (node.isPresent() && node.get().shouldUseOneInstance()) { expectedInstanceNum = 1; } @@ -1765,9 +1765,9 @@ private void computeFragmentHosts() throws Exception { int expectedInstanceNum = Math.min(parallelExecInstanceNum, leftMostNode.getNumInstances()); expectedInstanceNum = Math.max(expectedInstanceNum, 1); - // if have limit and conjunts, only need 1 instance to save cpu and + // if have limit and conjuncts, only need 1 instance to save cpu and // mem resource - if (node.isPresent() && node.get().haveLimitAndConjunts()) { + if (node.isPresent() && node.get().shouldUseOneInstance()) { expectedInstanceNum = 1; }