Skip to content

Commit

Permalink
ast: support explain format hint (#654)
Browse files Browse the repository at this point in the history
  • Loading branch information
alivxxx authored Dec 2, 2019
1 parent 12d98d3 commit 54fe742
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
10 changes: 6 additions & 4 deletions ast/misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,11 @@ const (
RepeatableRead = "REPEATABLE-READ"

// Valid formats for explain statement.
ExplainFormatROW = "row"
ExplainFormatDOT = "dot"
PumpType = "PUMP"
DrainerType = "DRAINER"
ExplainFormatROW = "row"
ExplainFormatDOT = "dot"
ExplainFormatHint = "hint"
PumpType = "PUMP"
DrainerType = "DRAINER"
)

// Transaction mode constants.
Expand All @@ -80,6 +81,7 @@ var (
ExplainFormats = []string{
ExplainFormatROW,
ExplainFormatDOT,
ExplainFormatHint,
}
)

Expand Down
1 change: 1 addition & 0 deletions parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3700,6 +3700,7 @@ func (s *testParserSuite) TestExplain(c *C) {
{"EXPLAIN FORMAT = TRADITIONAL SELECT 1", true, "EXPLAIN FORMAT = 'row' SELECT 1"},
{"EXPLAIN FORMAT = JSON FOR CONNECTION 1", true, "EXPLAIN FORMAT = 'json' FOR CONNECTION 1"},
{"EXPLAIN FORMAT = JSON SELECT 1", true, "EXPLAIN FORMAT = 'json' SELECT 1"},
{"EXPLAIN FORMAT = 'hint' SELECT 1", true, "EXPLAIN FORMAT = 'hint' SELECT 1"},
}
s.RunTest(c, table)
}
Expand Down

0 comments on commit 54fe742

Please sign in to comment.