From 6bc9412b1c4d00c0a5cc9dd939a245a82cc50227 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Mon, 8 Oct 2018 21:23:26 +0800 Subject: [PATCH] don't change index's columns sort in Equal --- index.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/index.go b/index.go index 9aa1b7ac..3786f52b 100644 --- a/index.go +++ b/index.go @@ -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 } }