This is an automated email from the ASF dual-hosted git repository.
kxiao 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 79a146de54c [Opt](pipeline) disable shared scan in key point search
(#24797)
79a146de54c is described below
commit 79a146de54cff35cbcce9494b7f6f17952042a77
Author: HappenLee <[email protected]>
AuthorDate: Fri Sep 22 22:46:11 2023 +0800
[Opt](pipeline) disable shared scan in key point search (#24797)
---
.../org/apache/doris/planner/OlapScanNode.java | 45 ++++++++++++++++++++++
.../java/org/apache/doris/planner/ScanNode.java | 4 ++
.../main/java/org/apache/doris/qe/Coordinator.java | 1 +
3 files changed, 50 insertions(+)
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 806000c6373..1e69185a256 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
@@ -1281,6 +1281,51 @@ public class OlapScanNode extends ScanNode {
return shouldColoScan;
}
+ @Override
+ // 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
+ public boolean isKeySearch() {
+ List<SlotRef> whereSlot = Lists.newArrayList();
+ for (Expr conjunct : conjuncts) {
+ if (conjunct instanceof BinaryPredicate) {
+ BinaryPredicate binaryPredicate = (BinaryPredicate) conjunct;
+ if (binaryPredicate.getOp().isEquivalence()) {
+ if (binaryPredicate.getChild(0) instanceof SlotRef) {
+ whereSlot.add((SlotRef) binaryPredicate.getChild(0));
+ }
+ if (binaryPredicate.getChild(1) instanceof SlotRef) {
+ whereSlot.add((SlotRef) binaryPredicate.getChild(1));
+ }
+ }
+ }
+
+ if (conjunct instanceof InPredicate) {
+ InPredicate inPredicate = (InPredicate) conjunct;
+ if (!inPredicate.isNotIn()) {
+ if (inPredicate.getChild(0) instanceof SlotRef) {
+ whereSlot.add((SlotRef) inPredicate.getChild(0));
+ }
+ if (inPredicate.getChild(1) instanceof SlotRef) {
+ whereSlot.add((SlotRef) inPredicate.getChild(1));
+ }
+ }
+ }
+ }
+
+ for (SlotRef slotRef : whereSlot) {
+ String columnName =
slotRef.getDesc().getColumn().getName().toLowerCase();
+ if (olapTable != null) {
+ if (olapTable.getDistributionColumnNames().contains(columnName)
+ &&
olapTable.getBaseSchema().get(0).getName().toLowerCase().equals(columnName)) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
@Override
protected void toThrift(TPlanNode msg) {
List<String> keyColumnNames = new ArrayList<String>();
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 ef42ae1e4eb..b5b365886e5 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
@@ -641,4 +641,8 @@ public abstract class ScanNode extends PlanNode {
scanRangeLocation.addToLocations(location);
return scanRangeLocation;
}
+
+ public boolean isKeySearch() {
+ return false;
+ }
}
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 f4a03f9c073..14d720540ea 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
@@ -1758,6 +1758,7 @@ public class Coordinator {
if (!enablePipelineEngine || perNodeScanRanges.size()
> parallelExecInstanceNum
|| (node.isPresent() &&
node.get().getShouldColoScan())
|| (node.isPresent() && node.get() instanceof
FileScanNode)
+ || (node.isPresent() &&
node.get().isKeySearch())
|| Config.disable_shared_scan) {
int expectedInstanceNum = 1;
if (parallelExecInstanceNum > 1) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]