planner,executor: relax the restrictions of trace format='row' (#10979)
This commit is contained in:
@ -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)
|
||||
}
|
||||
|
||||
@ -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"}
|
||||
|
||||
Reference in New Issue
Block a user