From b926fd225108b098a4e24ecb26d1d25292d98abf Mon Sep 17 00:00:00 2001 From: xiejiann Date: Mon, 15 Apr 2024 17:59:19 +0800 Subject: [PATCH] fix test --- .../jobs/rewrite/CostBasedRewriteJob.java | 18 ++++------ .../runtime_filter/test_pushdown_setop.out | 35 +++++++------------ 2 files changed, 19 insertions(+), 34 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/rewrite/CostBasedRewriteJob.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/rewrite/CostBasedRewriteJob.java index 2a7f0903b2501c..1ff91dfbac9c6e 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/rewrite/CostBasedRewriteJob.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/rewrite/CostBasedRewriteJob.java @@ -91,17 +91,13 @@ private Optional> getCost(CascadesContext currentCtx // set subtree rewrite cache currentCtx.getStatementContext().getRewrittenCteProducer() .put(currentCtx.getCurrentTree().orElse(null), (LogicalPlan) cboCtx.getRewritePlan()); - // Do Whole tree rewrite - CascadesContext rootCtxCopy = CascadesContext.newCurrentTreeContext(rootCtx); - Rewriter.getWholeTreeRewriterWithoutCostBasedJobs(rootCtxCopy).execute(); - // Do optimize - new Optimizer(rootCtxCopy).execute(); - return rootCtxCopy.getMemo().getRoot().getLowestCostPlan( - rootCtxCopy.getCurrentJobContext().getRequiredProperties()); - } else { - new Optimizer(cboCtx).execute(); - return cboCtx.getMemo().getRoot().getLowestCostPlan( - cboCtx.getCurrentJobContext().getRequiredProperties()); } + // Do post tree rewrite + CascadesContext rootCtxCopy = CascadesContext.newCurrentTreeContext(rootCtx); + Rewriter.getWholeTreeRewriterWithoutCostBasedJobs(rootCtxCopy).execute(); + // Do optimize + new Optimizer(rootCtxCopy).execute(); + return rootCtxCopy.getMemo().getRoot().getLowestCostPlan( + rootCtxCopy.getCurrentJobContext().getRequiredProperties()); } } diff --git a/regression-test/data/nereids_tpch_shape_sf1000_p0/runtime_filter/test_pushdown_setop.out b/regression-test/data/nereids_tpch_shape_sf1000_p0/runtime_filter/test_pushdown_setop.out index 5d0e6c3143d8d1..4eb9e9d7f0cc70 100644 --- a/regression-test/data/nereids_tpch_shape_sf1000_p0/runtime_filter/test_pushdown_setop.out +++ b/regression-test/data/nereids_tpch_shape_sf1000_p0/runtime_filter/test_pushdown_setop.out @@ -7,17 +7,12 @@ PhysicalResultSink --------PhysicalProject ----------hashJoin[INNER_JOIN] hashCondition=((T.l_linenumber = expr_cast(r_regionkey as BIGINT))) otherCondition=() build RFs:RF0 expr_cast(r_regionkey as BIGINT)->[cast(l_linenumber as BIGINT),o_orderkey] ------------PhysicalExcept ---------------PhysicalProject -----------------hashAgg[GLOBAL] -------------------PhysicalDistribute[DistributionSpecHash] ---------------------hashAgg[LOCAL] -----------------------PhysicalProject -------------------------PhysicalOlapScan[lineitem] apply RFs: RF0 --------------PhysicalDistribute[DistributionSpecHash] ----------------PhysicalProject -------------------hashAgg[LOCAL] ---------------------PhysicalProject -----------------------PhysicalOlapScan[orders] apply RFs: RF0 +------------------PhysicalOlapScan[lineitem] apply RFs: RF0 +--------------PhysicalDistribute[DistributionSpecHash] +----------------PhysicalProject +------------------PhysicalOlapScan[orders] apply RFs: RF0 ------------PhysicalDistribute[DistributionSpecHash] --------------PhysicalProject ----------------PhysicalOlapScan[region] @@ -29,21 +24,15 @@ PhysicalResultSink ------hashAgg[LOCAL] --------PhysicalProject ----------hashJoin[INNER_JOIN] hashCondition=((expr_abs(l_linenumber) = expr_cast(r_regionkey as LARGEINT))) otherCondition=() build RFs:RF0 expr_cast(r_regionkey as LARGEINT)->[abs(l_linenumber),abs(o_orderkey)] -------------PhysicalDistribute[DistributionSpecHash] ---------------PhysicalProject -----------------PhysicalExcept +------------PhysicalProject +--------------PhysicalExcept +----------------PhysicalDistribute[DistributionSpecHash] ------------------PhysicalProject ---------------------hashAgg[GLOBAL] -----------------------PhysicalDistribute[DistributionSpecHash] -------------------------hashAgg[LOCAL] ---------------------------PhysicalProject -----------------------------PhysicalOlapScan[lineitem] apply RFs: RF0 -------------------PhysicalDistribute[DistributionSpecHash] ---------------------PhysicalProject -----------------------hashAgg[LOCAL] -------------------------PhysicalProject ---------------------------PhysicalOlapScan[orders] apply RFs: RF0 -------------PhysicalDistribute[DistributionSpecHash] +--------------------PhysicalOlapScan[lineitem] apply RFs: RF0 +----------------PhysicalDistribute[DistributionSpecHash] +------------------PhysicalProject +--------------------PhysicalOlapScan[orders] apply RFs: RF0 +------------PhysicalDistribute[DistributionSpecReplicated] --------------PhysicalProject ----------------PhysicalOlapScan[region]