diff --git a/go/vt/vtgate/vindexes/binary.go b/go/vt/vtgate/vindexes/binary.go index 2affb723c09..95c8208a69d 100644 --- a/go/vt/vtgate/vindexes/binary.go +++ b/go/vt/vtgate/vindexes/binary.go @@ -46,7 +46,7 @@ func (vind *Binary) String() string { // Cost returns the cost as 1. func (vind *Binary) Cost() int { - return 1 + return 0 } // IsUnique returns true since the Vindex is unique. diff --git a/go/vt/vtgate/vindexes/binary_test.go b/go/vt/vtgate/vindexes/binary_test.go index 9ca5c57a4a1..c5935d53d0f 100644 --- a/go/vt/vtgate/vindexes/binary_test.go +++ b/go/vt/vtgate/vindexes/binary_test.go @@ -35,7 +35,7 @@ func init() { } func TestBinaryInfo(t *testing.T) { - assert.Equal(t, 1, binOnlyVindex.Cost()) + assert.Equal(t, 0, binOnlyVindex.Cost()) assert.Equal(t, "binary_varchar", binOnlyVindex.String()) assert.True(t, binOnlyVindex.IsUnique()) assert.False(t, binOnlyVindex.NeedsVCursor()) diff --git a/go/vt/vtgate/vindexes/null_test.go b/go/vt/vtgate/vindexes/null_test.go index a357aba1dd7..5d12f42828f 100644 --- a/go/vt/vtgate/vindexes/null_test.go +++ b/go/vt/vtgate/vindexes/null_test.go @@ -51,6 +51,7 @@ func TestNullMap(t *testing.T) { sqltypes.NewInt64(4), sqltypes.NewInt64(5), sqltypes.NewInt64(6), + sqltypes.NewVarChar("1234567890123"), }) require.NoError(t, err) want := []key.Destination{ @@ -60,6 +61,7 @@ func TestNullMap(t *testing.T) { key.DestinationKeyspaceID([]byte{0}), key.DestinationKeyspaceID([]byte{0}), key.DestinationKeyspaceID([]byte{0}), + key.DestinationKeyspaceID([]byte{0}), } if !reflect.DeepEqual(got, want) { t.Errorf("Map(): %#v, want %+v", got, want) @@ -75,6 +77,6 @@ func TestNullVerify(t *testing.T) { } want := []bool{true, false} if !reflect.DeepEqual(got, want) { - t.Errorf("binaryMD5.Verify: %v, want %v", got, want) + t.Errorf("null.Verify: %v, want %v", got, want) } } diff --git a/go/vt/vtgate/vindexes/numeric_test.go b/go/vt/vtgate/vindexes/numeric_test.go index 57dd11b68b9..a593f40f330 100644 --- a/go/vt/vtgate/vindexes/numeric_test.go +++ b/go/vt/vtgate/vindexes/numeric_test.go @@ -51,6 +51,7 @@ func TestNumericMap(t *testing.T) { sqltypes.NewInt64(6), sqltypes.NewInt64(7), sqltypes.NewInt64(8), + sqltypes.NewInt32(8), }) require.NoError(t, err) want := []key.Destination{ @@ -63,6 +64,7 @@ func TestNumericMap(t *testing.T) { key.DestinationKeyspaceID([]byte("\x00\x00\x00\x00\x00\x00\x00\x06")), key.DestinationKeyspaceID([]byte("\x00\x00\x00\x00\x00\x00\x00\x07")), key.DestinationKeyspaceID([]byte("\x00\x00\x00\x00\x00\x00\x00\x08")), + key.DestinationKeyspaceID([]byte("\x00\x00\x00\x00\x00\x00\x00\x08")), } if !reflect.DeepEqual(got, want) { t.Errorf("Map(): %+v, want %+v", got, want) diff --git a/go/vt/vtgate/vindexes/xxhash_test.go b/go/vt/vtgate/vindexes/xxhash_test.go index dc66aa3d7bc..049ce56d862 100644 --- a/go/vt/vtgate/vindexes/xxhash_test.go +++ b/go/vt/vtgate/vindexes/xxhash_test.go @@ -56,6 +56,9 @@ func TestXXHashMap(t *testing.T) { }, { in: sqltypes.NewVarChar("test2"), out: []byte{0x87, 0xeb, 0x11, 0x71, 0x4c, 0xa, 0xe, 0x89}, + }, { + in: sqltypes.NewVarChar("testaverylongvaluetomakesurethisworks"), + out: []byte{0x81, 0xd8, 0xc3, 0x8e, 0xd, 0x85, 0xe, 0x6a}, }, { in: sqltypes.NewInt64(1), out: []byte{0xd4, 0x64, 0x5, 0x36, 0x76, 0x12, 0xb4, 0xb7},