From 6f00d0e563404d93e46f070fe7e2da0273f910f5 Mon Sep 17 00:00:00 2001 From: Haibin Xie Date: Fri, 29 Nov 2019 17:41:13 +0800 Subject: [PATCH] ast: support explain format hint --- ast/misc.go | 10 ++++++---- parser_test.go | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ast/misc.go b/ast/misc.go index 1e259893d..f70f8a2dc 100755 --- a/ast/misc.go +++ b/ast/misc.go @@ -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. @@ -80,6 +81,7 @@ var ( ExplainFormats = []string{ ExplainFormatROW, ExplainFormatDOT, + ExplainFormatHint, } ) diff --git a/parser_test.go b/parser_test.go index a9c1c445b..0c6048cee 100644 --- a/parser_test.go +++ b/parser_test.go @@ -3667,6 +3667,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) }