func (r *TableDefaultPlan) filterBinOp(ctx context.Context, x *expression.BinaryOperation) (plan.Plan, bool, error) { ok, cn, rval, err := x.IsIdentRelOpVal() if err != nil { return r, false, err } if !ok { return r, false, nil } t := r.T c := column.FindCol(t.Cols(), cn) if c == nil { return nil, false, errors.Errorf("No such column: %s", cn) } ix := t.FindIndexByColName(cn) if ix == nil { // Column cn has no index. return r, false, nil } if rval, err = types.Convert(rval, &c.FieldType); err != nil { return nil, false, err } if rval == nil { // if nil, any <, <=, >, >=, =, != operator will do nothing // any value compared null returns null // TODO: if we support <=> later, we must handle null return &NullPlan{r.GetFields()}, true, nil } return &indexPlan{ src: t, colName: cn, idxName: ix.Name.O, idx: ix.X, spans: toSpans(x.Op, rval), }, true, nil }