Esempio n. 1
0
// Main Entry point to take a Plan, and convert into Execution DAG
func (m *JobExecutor) WalkPlan(p plan.Task) (Task, error) {
	switch p := p.(type) {
	case *plan.PreparedStatement:
		return m.Executor.WalkPreparedStatement(p)
	case *plan.Select:
		if len(p.From) > 0 {
			//u.Debugf("walk select p:%p m.Executor: %p ChildDag?%v %v", p, m.Executor, p.ChildDag, p.Stmt.String())
		}
		if p.Ctx != nil && p.IsSchemaQuery() {
			//u.Debugf("is schema query. ctx nil? %v", p.Ctx == nil)
			if p.Ctx.Schema != nil && p.Ctx.Schema.InfoSchema != nil {
				p.Ctx.Schema = p.Ctx.Schema.InfoSchema
			}
			p.Stmt.SetSystemQry()
		}
		return m.Executor.WalkSelect(p)
	case *plan.Upsert:
		return m.Executor.WalkUpsert(p)
	case *plan.Insert:
		return m.Executor.WalkInsert(p)
	case *plan.Update:
		return m.Executor.WalkUpdate(p)
	case *plan.Delete:
		return m.Executor.WalkDelete(p)
	case *plan.Command:
		return m.Executor.WalkCommand(p)
	}
	panic(fmt.Sprintf("Not implemented for %T", p))
}