Skip to content

Commit

Permalink
Address comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
doggeral committed Dec 27, 2019
1 parent a9976ad commit df53bfd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@
"Group#0 Schema:[test.t.b]",
" Projection_2 input:[Group#1], test.t.b",
"Group#1 Schema:[test.t.b]",
" Limit_6 input:[Group#2], offset:0, count:2",
" Limit_3 input:[Group#2], offset:0, count:2",
"Group#2 Schema:[test.t.b]",
" TiKVSingleGather_5 input:[Group#3], table:t",
"Group#3 Schema:[test.t.b]",
Expand Down
10 changes: 3 additions & 7 deletions planner/cascades/transformation_rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,8 @@ type PushLimitDownProjection struct {
baseRule
}

// NewRulePushLimitDownProjection creates a new Transformation. The pattern of this rule is `Limit->Projection->X` to `Projection->Limit->X`.
// NewRulePushLimitDownProjection creates a new Transformation.
// The pattern of this rule is `Limit->Projection->X` to `Projection->Limit->X`.
func NewRulePushLimitDownProjection() Transformation {
rule := &PushLimitDownProjection{}
rule.pattern = memo.BuildPattern(
Expand Down Expand Up @@ -700,13 +701,8 @@ func (r *PushLimitDownProjection) OnTransform(old *memo.ExprIter) (newExprs []*m
proj := old.Children[0].GetExpr().ExprNode.(*plannercore.LogicalProjection)
childGroup := old.Children[0].GetExpr().Children[0]

newLimit := plannercore.LogicalLimit{
Offset: limit.Offset,
Count: limit.Count,
}.Init(limit.SCtx(), limit.SelectBlockOffset())

projExpr := memo.NewGroupExpr(proj)
limitExpr := memo.NewGroupExpr(newLimit)
limitExpr := memo.NewGroupExpr(limit)
limitExpr.SetChildren(childGroup)
limitGroup := memo.NewGroupWithSchema(limitExpr, childGroup.Prop.Schema)
projExpr.SetChildren(limitGroup)
Expand Down

0 comments on commit df53bfd

Please sign in to comment.