Skip to content

Commit

Permalink
Merge pull request pingcap#911 from pingcap/coocood/fix-ddltest
Browse files Browse the repository at this point in the history
optimizer: only create public result fields for table.
  • Loading branch information
coocood committed Feb 19, 2016
2 parents b9d8a0a + 501c876 commit c818e51
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions optimizer/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,17 +334,21 @@ func (nr *nameResolver) handleTableName(tn *ast.TableName) {
dbInfo, _ := nr.Info.SchemaByName(tn.Schema)
tn.DBInfo = dbInfo

rfs := make([]*ast.ResultField, len(tn.TableInfo.Columns))
for i, v := range tn.TableInfo.Columns {
rfs := make([]*ast.ResultField, 0, len(tn.TableInfo.Columns))
for _, v := range tn.TableInfo.Columns {
if v.State != model.StatePublic {
continue
}
expr := &ast.ValueExpr{}
expr.SetType(&v.FieldType)
rfs[i] = &ast.ResultField{
rf := &ast.ResultField{
Column: v,
Table: tn.TableInfo,
DBName: tn.Schema,
Expr: expr,
TableName: tn,
}
rfs = append(rfs, rf)
}
tn.SetResultFields(rfs)
return
Expand Down

0 comments on commit c818e51

Please sign in to comment.