Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,13 @@ private Optional<Pair<Cost, GroupExpression>> 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());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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]