rule

package
v1.1.0-beta.0...-0c22a2d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 24, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
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

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:

  1. Match the Join + selection pattern and find the candidate constant predicate, such as 's.id>1'
  2. 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

  1. (ppdSolver in rule_predicate_push_down.go) Push down constant predicate and propagate constant predicate into other side. 't.id>1'

func (*ConstantPropagationSolver) Name

Name implements base.LogicalOptRule.<1st> interface.

func (*ConstantPropagationSolver) Optimize

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)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL