func (m *JobExecutor) WalkSource(p *plan.Source) (Task, error) { //u.Debugf("%p NewSource? %p", m, p) if len(p.Static) > 0 { //u.Warnf("found static source") static := membtree.NewStaticData("static") static.SetColumns(p.Cols) _, err := static.Put(nil, nil, p.Static) if err != nil { u.Errorf("Could not put %v", err) } return NewSourceScanner(m.Ctx, p, static), nil } else if p.Conn == nil { u.Warnf("no conn? %T", p.DataSource) if p.DataSource == nil { u.Warnf("no datasource") return nil, fmt.Errorf("missing data source") } source, err := p.DataSource.Open(p.Stmt.SourceName()) if err != nil { return nil, err } p.Conn = source //u.Debugf("setting p.Conn %p %T", p.Conn, p.Conn) } e, hasSourceExec := p.Conn.(ExecutorSource) if hasSourceExec { return e.WalkExecSource(p) } return NewSource(m.Ctx, p) }
func (m *JobExecutor) WalkSourceExec(p *plan.Source) (Task, error) { if p.Conn == nil { if p.DataSource == nil { u.Warnf("no datasource") return nil, fmt.Errorf("missing data source") } source, err := p.DataSource.Open(p.Stmt.SourceName()) if err != nil { return nil, err } p.Conn = source //u.Debugf("setting p.Conn %p %T", p.Conn, p.Conn) } e, hasSourceExec := p.Conn.(ExecutorSource) if hasSourceExec { return e.WalkExecSource(p) } u.Warnf("source %T does not implement datasource.Scanner", p.Conn) return nil, fmt.Errorf("%T Must Implement Scanner for %q", p.Conn, p.Stmt.String()) }