This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new 666a7d05650 [fix](plan) only scan node with limit and no predicate can
reduce to 1 instance (#31342) (#31606)
666a7d05650 is described below
commit 666a7d056506393087794be529a7c9e83114451c
Author: Mingyu Chen <[email protected]>
AuthorDate: Fri Mar 1 14:03:24 2024 +0800
[fix](plan) only scan node with limit and no predicate can reduce to 1
instance (#31342) (#31606)
This PR #25952 introduce a opt that if a scan node has limit and
predicates, use only 1 instance to save cup and memory.
But this is wrong because we can not guarantee that the predicates can
truly help to prune the data.
So I modify the logic to remove this opt.
Now, only scan node with limit and NO predicate can reduce to only 1
instance.
---
.../src/main/java/org/apache/doris/planner/OlapScanNode.java | 2 ++
fe/fe-core/src/main/java/org/apache/doris/planner/ScanNode.java | 4 ++--
fe/fe-core/src/main/java/org/apache/doris/qe/Coordinator.java | 8 ++++----
3 files changed, 8 insertions(+), 6 deletions(-)
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 49d961be5c8..68be7541043 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 class OlapScanNode extends ScanNode {
// 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<SlotRef> 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 648eac047d4..99184df1453 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 abstract class ScanNode extends PlanNode {
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 d0f03aa00e1..96ed3649007 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 @@ public class Coordinator implements CoordInterface {
//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 @@ public class Coordinator implements CoordInterface {
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;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]