Add selectDummyPlan

parent 6896c851
......@@ -49,6 +49,7 @@ var (
_ plan = (*selectFieldsDefaultPlan)(nil)
_ plan = (*selectFieldsGroupPlan)(nil)
_ plan = (*selectIndexDefaultPlan)(nil)
_ plan = (*selectDummyPlan)(nil)
_ plan = (*sysColumnDefaultPlan)(nil)
_ plan = (*sysIndexDefaultPlan)(nil)
_ plan = (*sysTableDefaultPlan)(nil)
......@@ -2798,3 +2799,24 @@ func (r *fullJoinDefaultPlan) do(ctx *execCtx, f func(id interface{}, data []int
}
}
}
type selectDummyPlan struct {
fields []interface{}
}
func (r *selectDummyPlan) hasID() bool { return true }
func (r *selectDummyPlan) explain(w strutil.Formatter) {
// w.Format("┌Iterate all rows of table %q\n└Output field names %v\n", r.t.name, qnames(r.fieldNames()))
}
func (r *selectDummyPlan) fieldNames() []string { return make([]string, len(r.fields)) }
func (r *selectDummyPlan) filter(expr expression) (plan, []string, error) {
return nil, nil, nil
}
func (r *selectDummyPlan) do(ctx *execCtx, f func(id interface{}, data []interface{}) (bool, error)) (err error) {
_, err = f(nil, r.fields)
return
}
......@@ -787,7 +787,15 @@ func (s *selectStmt) plan(ctx *execCtx) (plan, error) { //LATER overlapping goro
if err != nil {
return nil, err
}
if r == nil {
var fds []interface{}
for _, v := range s.flds {
if val, ok := v.expr.(value); ok {
fds = append(fds, val)
}
}
r = &selectDummyPlan{fields: fds}
}
if w := s.where; w != nil {
if r, err = (&whereRset{expr: w.expr, src: r}).plan(ctx); err != nil {
return nil, err
......
......@@ -8396,3 +8396,8 @@ SELECT * FROM t WHERE c1 == 1;
│CREATE INDEX xt_c1 ON t(c1);
└Output field names ["c1" "c2"]
---- 1347
SELECT 42;
┌Evaluate 42 as "",
└Output field names [""]
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment