Skip to content

Commit

Permalink
add parsing & ast for vexplain trace
Browse files Browse the repository at this point in the history
Signed-off-by: Andres Taylor <[email protected]>
  • Loading branch information
systay committed Sep 12, 2024
1 parent 2a6d8ce commit aa8e02f
Show file tree
Hide file tree
Showing 7 changed files with 8,589 additions and 8,590 deletions.
2 changes: 2 additions & 0 deletions go/vt/sqlparser/ast_funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1923,6 +1923,8 @@ func (ty VExplainType) ToString() string {
return QueriesStr
case AllVExplainType:
return AllVExplainStr
case TraceVExplainType:
return TraceStr
default:
return "Unknown VExplainType"
}
Expand Down
2 changes: 2 additions & 0 deletions go/vt/sqlparser/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ const (
QueriesStr = "queries"
AllVExplainStr = "all"
PlanStr = "plan"
TraceStr = "trace"

// Lock Types
ReadStr = "read"
Expand Down Expand Up @@ -846,6 +847,7 @@ const (
QueriesVExplainType VExplainType = iota
PlanVExplainType
AllVExplainType
TraceVExplainType
)

// Constant for Enum Type - SelectIntoType
Expand Down
1 change: 1 addition & 0 deletions go/vt/sqlparser/keywords.go
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,7 @@ var keywords = []keyword{
{"tinyint", TINYINT},
{"tinytext", TINYTEXT},
{"to", TO},
{"trace", TRACE},
{"trailing", TRAILING},
{"transaction", TRANSACTION},
{"transactions", TRANSACTIONS},
Expand Down
3 changes: 3 additions & 0 deletions go/vt/sqlparser/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2567,6 +2567,9 @@ var (
}, {
input: "vexplain select * from t",
output: "vexplain plan select * from t",
}, {
input: "vexplain trace select * from t",
output: "vexplain trace select * from t",
}, {
input: "explain analyze select * from t",
}, {
Expand Down
Loading

0 comments on commit aa8e02f

Please sign in to comment.