MCPcopy Create free account
hub / github.com/araddon/qlbridge / BuildSqlJobPlanned

Function BuildSqlJobPlanned

exec/executor.go:62–98  ·  view source on GitHub ↗

BuildSqlJobPlanned Create Job made up of sub-tasks in DAG that is the plan for execution of this query/job.

(planner plan.Planner, executor Executor, ctx *plan.Context)

Source from the content-addressed store, hash-verified

60// BuildSqlJobPlanned Create Job made up of sub-tasks in DAG that is the
61// plan for execution of this query/job.
62func BuildSqlJobPlanned(planner plan.Planner, executor Executor, ctx *plan.Context) (Task, error) {
63
64 //u.Debugf("build: %q", ctx.Raw)
65 if ctx.Raw == "" {
66 return nil, fmt.Errorf("no sql provided")
67 }
68 stmt, err := rel.ParseSql(ctx.Raw)
69 if err != nil {
70 u.Debugf("could not parse sql : %v", err)
71 return nil, err
72 }
73 if stmt == nil {
74 return nil, fmt.Errorf("Not statement for parse? %v", ctx.Raw)
75 }
76 ctx.Stmt = stmt
77
78 pln, err := plan.WalkStmt(ctx, stmt, planner)
79
80 if err != nil {
81 return nil, err
82 }
83 if pln == nil {
84 u.Warnf("error, no plan task, should not be possible? %v", err)
85 return nil, fmt.Errorf("No plan root task found? %v", ctx.Raw)
86 }
87
88 execRoot, err := executor.WalkPlan(pln)
89
90 if err != nil {
91 return nil, err
92 }
93 if execRoot == nil {
94 return nil, fmt.Errorf("No plan root task found? %v", ctx.Raw)
95 }
96
97 return execRoot, err
98}
99
100// NewTask create new task (from current context).
101func (m *JobExecutor) NewTask(p plan.Task) Task {

Callers 1

BuildSqlJobFunction · 0.85

Calls 4

ParseSqlFunction · 0.92
WalkStmtFunction · 0.92
ErrorfMethod · 0.80
WalkPlanMethod · 0.65

Tested by

no test coverage detected