planner,executor: relax the restrictions of trace format='row' (#10979)

This commit is contained in:
tiancaiamao
2019-06-28 16:47:33 +08:00
committed by Jack Yu
parent c32db315ea
commit 2e369cd520
2 changed files with 2 additions and 5 deletions

View File

@ -39,6 +39,8 @@ func (s *testSuite1) TestTraceExec(c *C) {
// | └─recordSet.Next | 22:08:38.249340 | 155.317µs |
// +---------------------------+-----------------+------------+
rows = tk.MustQuery("trace format='row' select * from trace where id = 0;").Rows()
c.Assert(len(rows) > 1, IsTrue)
rows = tk.MustQuery("trace format='row' delete from trace where id = 0").Rows()
c.Assert(len(rows) > 1, IsTrue)
}

View File

@ -1984,12 +1984,7 @@ func (b *PlanBuilder) buildDDL(node ast.DDLNode) (Plan, error) {
// underlying query and then constructs a schema, which will be used to constructs
// rows result.
func (b *PlanBuilder) buildTrace(trace *ast.TraceStmt) (Plan, error) {
if _, ok := trace.Stmt.(*ast.SelectStmt); !ok && trace.Format == "row" {
return nil, errors.New("trace only supports select query when format is row")
}
p := &Trace{StmtNode: trace.Stmt, Format: trace.Format}
switch trace.Format {
case "row":
retFields := []string{"operation", "duration", "spanID"}