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

Method load

plan/plan.go:751–789  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

749 return nil
750}
751func (m *Source) load() error {
752 // u.Debugf("source load schema=%s from=%s %#v", m.ctx.Schema.Name, m.Stmt.SourceName(), m.Stmt)
753 if m.Stmt == nil {
754 return nil
755 }
756 fromName := strings.ToLower(m.Stmt.SourceName())
757 if m.ctx == nil {
758 return fmt.Errorf("missing context in Source")
759 }
760 if m.ctx.Schema == nil {
761 u.Errorf("missing schema in *plan.Source load() from:%q", fromName)
762 return fmt.Errorf("Missing schema for %v", fromName)
763 }
764
765 ss, err := m.ctx.Schema.SchemaForTable(fromName)
766 if err != nil {
767 // u.Debugf("no schema found for %T %q.%q ? err=%v", m.ctx.Schema, m.Stmt.Schema, fromName, err)
768 return nil
769 }
770 if ss == nil {
771 u.Warnf("%p Schema no %s found", m.ctx.Schema, fromName)
772 return fmt.Errorf("Could not find source for %v", m.Stmt.SourceName())
773 }
774 m.Schema = ss
775 // Create a context-datasource
776 m.DataSource = ss.DS
777
778 tbl, err := m.ctx.Schema.Table(fromName)
779 if err != nil {
780 return err
781 }
782 if tbl == nil {
783 return fmt.Errorf("No table found for %q", fromName)
784 }
785 m.Tbl = tbl
786
787 //u.Infof("schema=%s ds:%T tbl:%v", m.Schema.Name, m.DataSource, tbl)
788 return projectionForSourcePlan(m)
789}
790
791// Equal checks if two tasks are equal.
792func (m *Projection) Equal(t Task) bool {

Callers 3

SourceFromPBFunction · 0.95
NewSourceFunction · 0.95
LoadConnMethod · 0.95

Calls 5

projectionForSourcePlanFunction · 0.85
ErrorfMethod · 0.80
SchemaForTableMethod · 0.80
TableMethod · 0.65
SourceNameMethod · 0.45

Tested by

no test coverage detected