don't change index's columns sort in Equal

This commit is contained in:
Lunny Xiao 2018-10-08 21:23:26 +08:00
parent b8d39bd0ff
commit 6bc9412b1c
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
1 changed files with 8 additions and 4 deletions

View File

@ -2,7 +2,6 @@ package core
import (
"fmt"
"sort"
"strings"
)
@ -46,11 +45,16 @@ func (index *Index) Equal(dst *Index) bool {
if len(index.Cols) != len(dst.Cols) {
return false
}
sort.StringSlice(index.Cols).Sort()
sort.StringSlice(dst.Cols).Sort()
for i := 0; i < len(index.Cols); i++ {
if index.Cols[i] != dst.Cols[i] {
var found bool
for j := 0; j < len(dst.Cols); j++ {
if index.Cols[i] == dst.Cols[j] {
found = true
break
}
}
if !found {
return false
}
}