Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go/vt/vtgate/vindexes/binary.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vtgate/vindexes/binary_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
4 changes: 3 additions & 1 deletion go/vt/vtgate/vindexes/null_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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)
Expand All @@ -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)
}
}
2 changes: 2 additions & 0 deletions go/vt/vtgate/vindexes/numeric_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions go/vt/vtgate/vindexes/xxhash_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down