*: fix bytes convert issue
This commit is contained in:
@ -402,14 +402,14 @@ func (r *indexPlan) Next(ctx context.Context) (*plan.Row, error) {
|
||||
}
|
||||
|
||||
func (r *indexPlan) isPointLookup(span *indexSpan) bool {
|
||||
equalOp := span.lowVal == span.highVal && !span.lowExclude && !span.highExclude
|
||||
if !equalOp || !r.unique || span.lowVal == nil {
|
||||
if span.lowExclude || span.highExclude || span.lowVal == nil || !r.unique {
|
||||
return false
|
||||
}
|
||||
n, err := types.Compare(span.seekVal, span.lowVal)
|
||||
n, err := types.Compare(span.seekVal, span.highVal)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
// 'seekVal==highVal' means that 'seekVal==lowVal && lowVal==highVal'
|
||||
return n == 0
|
||||
}
|
||||
|
||||
|
||||
@ -336,6 +336,8 @@ func Convert(val interface{}, target *FieldType) (v interface{}, err error) {
|
||||
return t.RoundFrac(fsp)
|
||||
case string:
|
||||
return mysql.ParseDuration(x, fsp)
|
||||
case []byte:
|
||||
return mysql.ParseDuration(string(x), fsp)
|
||||
default:
|
||||
return invConv(val, tp)
|
||||
}
|
||||
@ -359,6 +361,8 @@ func Convert(val interface{}, target *FieldType) (v interface{}, err error) {
|
||||
return t.RoundFrac(fsp)
|
||||
case string:
|
||||
return mysql.ParseTime(x, tp, fsp)
|
||||
case []byte:
|
||||
return mysql.ParseTime(string(x), tp, fsp)
|
||||
case int64:
|
||||
return mysql.ParseTimeFromNum(x, tp, fsp)
|
||||
default:
|
||||
@ -407,6 +411,8 @@ func Convert(val interface{}, target *FieldType) (v interface{}, err error) {
|
||||
switch x := val.(type) {
|
||||
case string:
|
||||
intVal, err = StrToInt(x)
|
||||
case []byte:
|
||||
intVal, err = StrToInt(string(x))
|
||||
case mysql.Time:
|
||||
return int64(x.Year()), nil
|
||||
case mysql.Duration:
|
||||
|
||||
Reference in New Issue
Block a user