Skip to content

Commit

Permalink
SelectStmt support view now
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewDi committed Oct 23, 2018
1 parent 50a2101 commit 8ad8f80
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions planner/core/logical_plan_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -1836,6 +1836,15 @@ func (b *PlanBuilder) buildDataSource(tn *ast.TableName) (LogicalPlan, error) {
tableInfo := tbl.Meta()
b.visitInfo = appendVisitInfo(b.visitInfo, mysql.SelectPriv, dbName.L, tableInfo.Name.L, "")

if tableInfo.Type == model.View {
parser := parser.New()
stmt, parserErr := parser.ParseOneStmt(tableInfo.ViewSelectStmt, "", "")
if parserErr != nil {
return nil, errors.Trace(parserErr)
}
return b.buildSelect(stmt.(*ast.SelectStmt))
}

if tableInfo.GetPartitionInfo() != nil {
b.optFlag = b.optFlag | flagPartitionProcessor
}
Expand Down

0 comments on commit 8ad8f80

Please sign in to comment.