This is an automated email from the ASF dual-hosted git repository.

morrysnow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 1877389f12e [fix](Nereids) set card to olap table break card block 
rule (#28417)
1877389f12e is described below

commit 1877389f12e0f8078abe98e7e3f6a260e56dcd7f
Author: morrySnow <[email protected]>
AuthorDate: Fri Dec 15 10:28:05 2023 +0800

    [fix](Nereids) set card to olap table break card block rule (#28417)
    
    we have card block rule to avoid scan too many data.
    so we must set olap scan card by only scanned bucket.
---
 .../apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java  | 4 +++-
 fe/fe-core/src/main/java/org/apache/doris/planner/OlapScanNode.java   | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java
index d85115750d8..06ab5e4fdbc 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java
@@ -588,7 +588,9 @@ public class PhysicalPlanTranslator extends 
DefaultPlanVisitor<PlanFragment, Pla
         OlapScanNode olapScanNode = new 
OlapScanNode(olapScan.translatePlanNodeId(), tupleDescriptor, "OlapScanNode");
         // TODO: move all node set cardinality into one place
         if (olapScan.getStats() != null) {
-            olapScanNode.setCardinality((long) 
olapScan.getStats().getRowCount());
+            // NOTICE: we should not set stats row count
+            //   because it is whole table cardinality and will break block 
rules.
+            // olapScanNode.setCardinality((long) 
olapScan.getStats().getRowCount());
             if (context.getSessionVariable() != null && 
context.getSessionVariable().forbidUnknownColStats) {
                 for (int i = 0; i < slots.size(); i++) {
                     SlotReference slot = (SlotReference) slots.get(i);
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 15d83702ff3..f4d44c0c22f 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
@@ -1628,6 +1628,8 @@ public class OlapScanNode extends ScanNode {
     public void finalizeForNereids() {
         computeNumNodes();
         computeStatsForNereids();
+        // NOTICE: must call here to get selected tablet row count to let 
block rules work well.
+        mockRowCountInStatistic();
         if (!SessionVariable.enablePipelineEngineX()) {
             // distributionColumnIds is used for one backend node agg 
optimization, nereids do not support it.
             distributionColumnIds.clear();


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to