@@ -16,6 +16,9 @@ package plan
1616
1717import (
1818 "github.com/dolthub/go-mysql-server/sql"
19+ "github.com/dolthub/go-mysql-server/sql/types"
20+
21+ "github.com/dolthub/vitess/go/sqltypes"
1922)
2023
2124// Describe is a node that describes its children.
@@ -102,6 +105,22 @@ func (*DescribeQuery) CollationCoercibility(ctx *sql.Context) (collation sql.Col
102105
103106// DescribeSchema is the schema returned by a DescribeQuery node.
104107var DescribeSchema = sql.Schema {
108+ {Name : "id" , Type : types .Uint64 },
109+ {Name : "select_type" , Type : types .MustCreateStringWithDefaults (sqltypes .VarChar , 57 )},
110+ {Name : "table" , Type : types .MustCreateStringWithDefaults (sqltypes .VarChar , 192 )},
111+ {Name : "partitions" , Type : types .Text },
112+ {Name : "type" , Type : types .MustCreateStringWithDefaults (sqltypes .VarChar , 30 )},
113+ {Name : "possible_keys" , Type : types .MustCreateStringWithDefaults (sqltypes .VarChar , 12288 )},
114+ {Name : "key" , Type : types .MustCreateStringWithDefaults (sqltypes .VarChar , 192 )},
115+ {Name : "key_len" , Type : types .MustCreateStringWithDefaults (sqltypes .VarChar , 12288 )},
116+ {Name : "ref" , Type : types .MustCreateStringWithDefaults (sqltypes .VarChar , 3072 )},
117+ {Name : "rows" , Type : types .Uint64 },
118+ {Name : "filtered" , Type : types .Float64 },
119+ {Name : "Extra" , Type : types .MustCreateStringWithDefaults (sqltypes .VarChar , 765 )},
120+ }
121+
122+ // DescribePlanSchema is the schema returned by a DescribeQuery node.
123+ var DescribePlanSchema = sql.Schema {
105124 {Name : "plan" , Type : VarChar25000 },
106125}
107126
@@ -112,7 +131,11 @@ func NewDescribeQuery(format sql.DescribeOptions, child sql.Node) *DescribeQuery
112131
113132// Schema implements the Node interface.
114133func (d * DescribeQuery ) Schema () sql.Schema {
115- return DescribeSchema
134+ if d .Format .Plan {
135+ return DescribePlanSchema
136+ } else {
137+ return DescribeSchema
138+ }
116139}
117140
118141func (d * DescribeQuery ) Describe (options sql.DescribeOptions ) string {
0 commit comments