Skip to content

Commit

Permalink
Fix projection
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewDi committed Dec 24, 2018
1 parent d45a3d6 commit c855ba4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions planner/core/logical_plan_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -2020,7 +2020,7 @@ func (b *PlanBuilder) buildDataSourceFromView(dbName model.CIStr, tableInfo *mod
return nil, ErrViewInvalid.GenWithStackByArgs(dbName.O, tableInfo.Name.O)
}
projSchema.Append(&expression.Column{
UniqueID: col.UniqueID,
UniqueID: b.ctx.GetSessionVars().AllocPlanColumnID(),
TblName: col.TblName,
OrigTblName: col.OrigTblName,
ColName: tableInfo.Cols()[i].Name,
Expand All @@ -2030,7 +2030,7 @@ func (b *PlanBuilder) buildDataSourceFromView(dbName model.CIStr, tableInfo *mod
})
}

projUponView := LogicalProjection{Exprs: expression.Column2Exprs(projSchema.Columns)}.Init(b.ctx)
projUponView := LogicalProjection{Exprs: expression.Column2Exprs(selectLogicalPlan.Schema().Columns)}.Init(b.ctx)
projUponView.SetChildren(selectLogicalPlan.(LogicalPlan))
projUponView.SetSchema(projSchema)
return projUponView, nil
Expand Down

0 comments on commit c855ba4

Please sign in to comment.