Documentation ¶
Index ¶
Constants ¶
const ( FlagGcSubstitute uint64 = 1 << iota FlagPruneColumns FlagStabilizeResults FlagBuildKeyInfo FlagDecorrelate FlagSemiJoinRewrite FlagEliminateAgg FlagSkewDistinctAgg FlagEliminateProjection FlagMaxMinEliminate FlagConstantPropagation FlagConvertOuterToInnerJoin FlagPredicatePushDown FlagEliminateOuterJoin FlagPartitionProcessor FlagCollectPredicateColumnsPoint FlagPushDownAgg FlagDeriveTopNFromWindow FlagPredicateSimplification FlagPushDownTopN FlagSyncWaitStatsLoadPoint FlagJoinReOrder FlagPruneColumnsAgain FlagPushDownSequence FlagResolveExpand )
Note: The order of flags is same as the order of optRule in the list. Do not mess up the order.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BuildKeySolver ¶
type BuildKeySolver struct{}
BuildKeySolver is used to build key info for logical plan.
func (*BuildKeySolver) Name ¶
func (*BuildKeySolver) Name() string
Name implements base.LogicalOptRule.<0th> interface.
func (*BuildKeySolver) Optimize ¶
func (*BuildKeySolver) Optimize(_ context.Context, p base.LogicalPlan, _ *optimizetrace.LogicalOptimizeOp) (base.LogicalPlan, bool, error)
Optimize implements base.LogicalOptRule.<1st> interface.
type ConstantPropagationSolver ¶
type ConstantPropagationSolver struct { }
ConstantPropagationSolver can support constant propagated cross-query block. This is a logical optimize rule. It mainly used for the sub query in FromList and propagated the constant predicate from sub query to outer query. In the future, it will support propagate constant in WhereClause and SelectList.
Example 1: Query: select * from t, (select * from s where s.id>1) tmp where t.id=tmp.id Optimized: select * from t, (select * from s where s.id>1) tmp where t.id=tmp.id and tmp.id>1
Process:
- Match the Join + selection pattern and find the candidate constant predicate, such as 's.id>1'
- Pull up the candidate constant predicate, above of Join node. The new selection will be created with the new constant predicate. 'tmp.id>1'
Steps 1 and 2 will be called recursively
- (ppdSolver in rule_predicate_push_down.go) Push down constant predicate and propagate constant predicate into other side. 't.id>1'
func (*ConstantPropagationSolver) Name ¶
func (*ConstantPropagationSolver) Name() string
Name implements base.LogicalOptRule.<1st> interface.
func (*ConstantPropagationSolver) Optimize ¶
func (cp *ConstantPropagationSolver) Optimize(_ context.Context, p base.LogicalPlan, opt *optimizetrace.LogicalOptimizeOp) (base.LogicalPlan, bool, error)
Optimize implements base.LogicalOptRule.<0th> interface. **Preorder traversal** of logic tree Step1: constant propagation current plan node Step2: optimize all of child
For step1, different logical plan have their own logic for constant propagation, which is mainly implemented in the interface "constantPropagation" of LogicalPlan. Currently only the Logical Join implements this function. (Used for the subquery in FROM List) In the future, the Logical Apply will implements this function. (Used for the subquery in WHERE or SELECT list)