示例#1
0
文件: from.go 项目: lovedboy/tidb
// Explain implements the plan.Plan Explain interface.
func (r *TableDefaultPlan) Explain(w format.Formatter) {
	fmtStr := "┌Iterate all rows of table %q\n└Output field names %v\n"
	if r.rangeScan {
		fmtStr = "┌Range scan rows of table %q\n└Output field names %v\n"
	}
	w.Format(fmtStr, r.T.TableName(), field.RFQNames(r.Fields))
}
示例#2
0
文件: final.go 项目: superwood/tidb
// Explain implements the plan.Plan Explain interface.
func (r *SelectFinalPlan) Explain(w format.Formatter) {
	r.Src.Explain(w)
	if r.HiddenFieldOffset == len(r.Src.GetFields()) {
		// we have no hidden fields, can return.
		return
	}
	w.Format("┌Evaluate\n└Output field names %v\n", field.RFQNames(r.ResultFields[0:r.HiddenFieldOffset]))
}
示例#3
0
文件: lock.go 项目: ninefive/tidb
// Explain implements plan.Plan Explain interface.
func (r *SelectLockPlan) Explain(w format.Formatter) {
	r.Src.Explain(w)
	if r.Lock != coldef.SelectLockForUpdate {
		// no need to lock, just return.
		return
	}
	w.Format("┌Lock row keys for update\n")
}
示例#4
0
文件: delete.go 项目: Brian110/tidb
// Explain implements the stmt.Statement Explain interface.
func (s *DeleteStmt) Explain(ctx context.Context, w format.Formatter) {
	p, err := s.plan(ctx)
	if err != nil {
		log.Error(err)
		return
	}
	p.Explain(w)
	w.Format("└Delete row\n")
}
示例#5
0
文件: select.go 项目: nengwang/tidb
// Explain implements the stmt.Statement Explain interface.
func (s *SelectStmt) Explain(ctx context.Context, w format.Formatter) {
	p, err := s.Plan(ctx)
	if err != nil {
		w.Format("ERROR: %v\n", err)
		return
	}

	p.Explain(w)
}
示例#6
0
文件: join.go 项目: studygolang/tidb
func (r *JoinPlan) explainNode(w format.Formatter, node plan.Plan) {
	sel := !isTableOrIndex(node)
	if sel {
		w.Format("┌Iterate all rows of virtual table\n")
	}
	node.Explain(w)
	if sel {
		w.Format("└Output field names %v\n", field.RFQNames(node.GetFields()))
	}

}
示例#7
0
文件: update.go 项目: Brian110/tidb
// Explain implements the stmt.Statement Explain interface.
func (s *UpdateStmt) Explain(ctx context.Context, w format.Formatter) {
	p, err := s.plan(ctx)
	if err != nil {
		log.Error(err)
		return
	}
	if p != nil {
		p.Explain(w)
	}
	w.Format("└Update fields %v\n", s.List)
}
示例#8
0
文件: delete.go 项目: szctop/tidb
// Explain implements the stmt.Statement Explain interface.
func (s *DeleteStmt) Explain(ctx context.Context, w format.Formatter) {
	p, err := s.indexPlan(ctx)
	if err != nil {
		log.Error(err)
		return
	}
	if p != nil {
		p.Explain(w)
	} else {
		w.Format("┌Iterate all rows of table: %s\n", s.TableIdent)
	}
	w.Format("└Delete row\n")
}
示例#9
0
文件: join.go 项目: studygolang/tidb
// Explain implements plan.Plan Explain interface.
func (r *JoinPlan) Explain(w format.Formatter) {
	// TODO: show more useful join plan
	if r.Right == nil {
		// if right is nil, we don't do a join, just simple select table
		r.Left.Explain(w)
		return
	}

	w.Format("┌Compute %s Cartesian product of\n", r.Type)

	r.explainNode(w, r.Left)
	r.explainNode(w, r.Right)

	w.Format("└Output field names %v\n", field.RFQNames(r.Fields))
}
示例#10
0
文件: fields.go 项目: H0bby/tidb
// Explain implements the plan.Plan Explain interface.
func (r *SelectFieldsDefaultPlan) Explain(w format.Formatter) {
	// TODO: check for non existing fields
	r.Src.Explain(w)
	w.Format("┌Evaluate")
	for _, v := range r.Fields {
		w.Format(" %s,", v)
	}
	w.Format("\n└Output field names %v\n", field.RFQNames(r.ResultFields))
}
示例#11
0
文件: orderby.go 项目: no2key/tidb
// Explain implements plan.Plan Explain interface.
func (r *OrderByDefaultPlan) Explain(w format.Formatter) {
	r.Src.Explain(w)
	w.Format("┌Order by")

	items := make([]string, len(r.By))
	for i, v := range r.By {
		order := "ASC"
		if !r.Ascs[i] {
			order = "DESC"
		}
		items[i] = fmt.Sprintf(" %s %s", v, order)
	}
	w.Format("%s", strings.Join(items, ","))
	w.Format("\n└Output field names %v\n", field.RFQNames(r.ResultFields))
}
示例#12
0
// Explain implements plan.Plan Explain interface.
func (r *indexPlan) Explain(w format.Formatter) {
	w.Format("┌Iterate rows of table %q using index %q where %s in ", r.src.TableName(), r.idxName, r.col.Name.L)
	for _, span := range r.spans {
		open := "["
		close := "]"
		if span.lowExclude {
			open = "("
		}
		if span.highExclude {
			close = ")"
		}
		w.Format("%s%v,%v%s ", open, span.lowVal, span.highVal, close)
	}
	w.Format("\n└Output field names %v\n", field.RFQNames(r.GetFields()))
}
示例#13
0
文件: limit.go 项目: ninefive/tidb
// Explain implements plan.Plan Explain interface.
func (r *LimitDefaultPlan) Explain(w format.Formatter) {
	r.Src.Explain(w)
	w.Format("┌Limit %d records\n└Output field names %v\n", r.Count, r.Fields)
}
示例#14
0
文件: groupby.go 项目: szctop/tidb
// Explain implements plan.Plan Explain interface.
func (r *GroupByDefaultPlan) Explain(w format.Formatter) {
	r.Src.Explain(w)
	w.Format("┌Evaluate")
	for _, v := range r.Fields {
		w.Format(" %s as %s,", v.Expr, fmt.Sprintf("%q", v.Name))
	}

	switch {
	case len(r.By) == 0: //TODO this case should not exist for this plan.Plan, should become TableDefaultPlan
		w.Format("\n│Group by distinct rows")
	default:
		w.Format("\n│Group by")
		for _, v := range r.By {
			w.Format(" %s,", v)
		}
	}
	w.Format("\n└Output field names %v\n", field.RFQNames(r.ResultFields))
}
示例#15
0
// Explain implements the stmt.Statement Explain interface.
func (s *CreateUserStmt) Explain(ctx context.Context, w format.Formatter) {
	w.Format("%s\n", s.Text)
}
示例#16
0
文件: distinct.go 项目: no2key/tidb
// Explain implements the plan.Plan Explain interface.
func (r *DistinctDefaultPlan) Explain(w format.Formatter) {
	r.Src.Explain(w)
	w.Format("┌Compute distinct rows\n└Output field names %v\n", r.ResultFields)
}
示例#17
0
文件: having.go 项目: superwood/tidb
// Explain implements plan.Plan Explain interface.
func (r *HavingPlan) Explain(w format.Formatter) {
	r.Src.Explain(w)
	w.Format("┌Having %s\n└Output field names %v\n", r.Expr.String(), r.Src.GetFields())
}
示例#18
0
文件: plans.go 项目: szctop/tidb
// Explain implements plan.Plan Explain interface.
func (r *selectIndexDefaultPlan) Explain(w format.Formatter) {
	w.Format("┌Iterate all values of index %q\n└Output field names N/A\n", r.nm)
}
示例#19
0
文件: plans.go 项目: szctop/tidb
// Explain implements plan.Plan Explain interface.
func (r *NullPlan) Explain(w format.Formatter) {
	w.Format("┌Iterate no rows\n└Output field names %v\n", field.RFQNames(r.Fields))
}
示例#20
0
文件: prepared.go 项目: ninefive/tidb
// Explain implements the stmt.Statement Explain interface.
func (s *DeallocateStmt) Explain(ctx context.Context, w format.Formatter) {
	w.Format("%s\n", s.Text)
}
示例#21
0
文件: show.go 项目: ninefive/tidb
// Explain implements the stmt.Statement Explain interface.
func (s *ShowStmt) Explain(ctx context.Context, w format.Formatter) {
	w.Format("%s\n", s.Text)
}
示例#22
0
文件: limit.go 项目: ninefive/tidb
// Explain implements plan.Plan Explain interface.
func (r *OffsetDefaultPlan) Explain(w format.Formatter) {
	r.Src.Explain(w)
	w.Format("┌Skip first %d records\n└Output field names %v\n", r.Count, field.RFQNames(r.Fields))
}
示例#23
0
文件: drop.go 项目: yzl11/vessel
// Explain implements the stmt.Statement Explain interface.
func (s *DropTableStmt) Explain(ctx context.Context, w format.Formatter) {
	w.Format("%s\n", s.Text)
}
示例#24
0
文件: where.go 项目: hxiaodon/tidb
// Explain implements plan.Plan Explain interface.
func (r *FilterDefaultPlan) Explain(w format.Formatter) {
	r.Plan.Explain(w)
	w.Format("┌FilterDefaultPlan Filter on %v\n", r.Expr)
	w.Format("└Output field names %v\n", field.RFQNames(r.GetFields()))
}
示例#25
0
文件: from.go 项目: hulunbier/tidb
// Explain implements the plan.Plan interface.
func (r *TableNilPlan) Explain(w format.Formatter) {
	w.Format("┌Iterate all rows of table %q\n└Output field names %v\n", r.T.TableName(), field.RFQNames(r.GetFields()))
}
示例#26
0
文件: replace.go 项目: yzl11/vessel
// Explain implements the stmt.Statement Explain interface.
func (s *ReplaceIntoStmt) Explain(ctx context.Context, w format.Formatter) {
	w.Format("%s\n", s.Text)
}